diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 7eb037277d..03ac922923 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -160,3 +160,39 @@ func TestBaseAppCreateQueryContext(t *testing.T) { }) } } + +// Test and ensure that consensus params has been updated. +// See: +// - https://github.com/line/lbm-sdk/pull/673 +func TestBaseAppBeginBlockConsensusParams(t *testing.T) { + t.Parallel() + + logger := defaultLogger() + db := dbm.NewMemDB() + name := t.Name() + app := NewBaseApp(name, logger, db, nil) + app.SetParamStore(¶mStore{db: dbm.NewMemDB()}) + app.InitChain(abci.RequestInitChain{ + ConsensusParams: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: -1, + }, + }, + }) + app.init() + + // set block params + app.BeginBlock(abci.RequestBeginBlock{Header: ocproto.Header{Height: 1}}) + ctx := app.deliverState.ctx + maxGas := int64(123456789) + app.paramStore.Set(ctx, ParamStoreKeyBlockParams, + &abci.BlockParams{ + MaxGas: maxGas, + }) + app.Commit() + + // confirm consensus params updated into the context + app.BeginBlock(abci.RequestBeginBlock{Header: ocproto.Header{Height: 2}}) + newCtx := app.getContextForTx(app.checkState, []byte{}) + require.Equal(t, maxGas, newCtx.ConsensusParams().Block.MaxGas) +}