diff --git a/baseapp/abci.go b/baseapp/abci.go index 5fa19d5989..8a76786091 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -125,7 +125,7 @@ func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOp } // BeginBlock implements the ABCI application interface. -func (app *BaseApp) BeginBlock(req ocabci.RequestBeginBlock) (res abci.ResponseBeginBlock) { +func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) { defer telemetry.MeasureSince(time.Now(), "abci", "begin_block") if app.cms.TracingEnabled() { @@ -228,7 +228,7 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc // internal CheckTx state if the AnteHandler passes. Otherwise, the ResponseCheckTx // will contain releveant error information. Regardless of tx execution outcome, // the ResponseCheckTx will contain relevant gas execution context. -func (app *BaseApp) CheckTxSync(req abci.RequestCheckTx) ocabci.ResponseCheckTx { +func (app *BaseApp) CheckTxSync(req abci.RequestCheckTx) abci.ResponseCheckTx { defer telemetry.MeasureSince(time.Now(), "abci", "check_tx") if req.Type != abci.CheckTxType_New && req.Type != abci.CheckTxType_Recheck { @@ -251,7 +251,7 @@ func (app *BaseApp) CheckTxSync(req abci.RequestCheckTx) ocabci.ResponseCheckTx // return sdkerrors.ResponseCheckTxWithEvents(err, gInfo.GasWanted, gInfo.GasUsed, anteEvents, app.trace) // TODO(dudong2): need to fix to use ResponseCheckTxWithEvents } - return ocabci.ResponseCheckTx{ + return abci.ResponseCheckTx{ GasWanted: int64(gInfo.GasWanted), // TODO: Should type accept unsigned ints? GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints? } diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 028282be22..b148149956 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -9,8 +9,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" - sdk "github.com/Finschia/finschia-sdk/types" ) @@ -142,10 +140,10 @@ func TestBaseAppCreateQueryContext(t *testing.T) { app := NewBaseApp(name, logger, db, nil) app.init() - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) app.Commit() - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) app.Commit() testCases := []struct { @@ -193,7 +191,7 @@ func TestBaseAppBeginBlockConsensusParams(t *testing.T) { app.init() // set block params - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) ctx := app.deliverState.ctx maxGas := int64(123456789) app.paramStore.Set(ctx, ParamStoreKeyBlockParams, @@ -203,7 +201,7 @@ func TestBaseAppBeginBlockConsensusParams(t *testing.T) { app.Commit() // confirm consensus params updated into the context - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) newCtx := app.getContextForTx(app.checkState, []byte{}) require.Equal(t, maxGas, newCtx.ConsensusParams().Block.MaxGas) } diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 2c9aa35830..db6ba11dce 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -520,7 +520,7 @@ func (app *BaseApp) getMaximumBlockGas(ctx sdk.Context) uint64 { } } -func (app *BaseApp) validateHeight(req ocabci.RequestBeginBlock) error { +func (app *BaseApp) validateHeight(req abci.RequestBeginBlock) error { if req.Header.Height < 1 { return fmt.Errorf("invalid height: %d", req.Header.Height) } diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 4dea4bc6bf..20ef3a1307 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -11,7 +11,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/Finschia/finschia-sdk/codec" @@ -106,7 +105,7 @@ func TestLoadVersionPruning(t *testing.T) { // Commit seven blocks, of which 7 (latest) is kept in addition to 6, 5 // (keep recent) and 3 (keep every). for i := int64(1); i <= 7; i++ { - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) res := app.Commit() lastCommitID = sdk.CommitID{Version: i, Hash: res.Data} } diff --git a/baseapp/block_gas_test.go b/baseapp/block_gas_test.go index b5bc31cbd6..65ac437b6c 100644 --- a/baseapp/block_gas_test.go +++ b/baseapp/block_gas_test.go @@ -11,7 +11,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/Finschia/finschia-sdk/baseapp" @@ -106,7 +105,7 @@ func TestBaseApp_BlockGas(t *testing.T) { _, txBytes, err := createTestTx(encCfg.TxConfig, txBuilder, privs, accNums, accSeqs, ctx.ChainID()) require.NoError(t, err) - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) rsp := app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) // check result diff --git a/baseapp/deliver_tx_test.go b/baseapp/deliver_tx_test.go index 268329a0fd..038b7f207d 100644 --- a/baseapp/deliver_tx_test.go +++ b/baseapp/deliver_tx_test.go @@ -218,7 +218,7 @@ func TestWithRouter(t *testing.T) { for blockN := 0; blockN < nBlocks; blockN++ { header := tmproto.Header{Height: int64(blockN) + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) for i := 0; i < txPerHeight; i++ { counter := int64(blockN*txPerHeight + i) @@ -313,7 +313,7 @@ func TestQuery(t *testing.T) { // query is still empty after a DeliverTx before we commit header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) _, resTx, err := app.Deliver(aminoTxEncoder(), tx) require.NoError(t, err) @@ -339,7 +339,7 @@ func TestGRPCQuery(t *testing.T) { app.InitChain(abci.RequestInitChain{}) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) app.Commit() req := testdata.SayHelloRequest{Name: "foo"} @@ -418,7 +418,7 @@ func TestMultiMsgDeliverTx(t *testing.T) { // with all msgs the same route header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) tx := newTxCounter(0, 0, 1, 2) txBytes, err := codec.Marshal(tx) require.NoError(t, err) @@ -499,7 +499,7 @@ func TestSimulateTx(t *testing.T) { for blockN := 0; blockN < nBlocks; blockN++ { count := int64(blockN + 1) header := tmproto.Header{Height: count} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) tx := newTxCounter(count, count) txBytes, err := cdc.Marshal(tx) @@ -554,7 +554,7 @@ func TestRunInvalidTransaction(t *testing.T) { app := setupBaseApp(t, anteOpt, routerOpt) header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) // transaction with no messages { @@ -681,7 +681,7 @@ func TestTxGasLimits(t *testing.T) { app := setupBaseApp(t, anteOpt, routerOpt) header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) testCases := []struct { tx *txTest @@ -795,7 +795,7 @@ func TestMaxBlockGasLimits(t *testing.T) { // reset the block gas header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) // execute the transaction multiple times for j := 0; j < tc.numDelivers; j++ { @@ -848,7 +848,7 @@ func TestCustomRunTxPanicHandler(t *testing.T) { app := setupBaseApp(t, anteOpt, routerOpt) header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) app.AddRunTxRecoveryHandler(func(recoveryObj interface{}) error { err, ok := recoveryObj.(error) @@ -890,7 +890,7 @@ func TestBaseAppAnteHandler(t *testing.T) { registerTestCodec(cdc) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) // execute a tx that will fail ante handler execution // @@ -999,7 +999,7 @@ func TestGasConsumptionBadTx(t *testing.T) { app.InitChain(abci.RequestInitChain{}) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) tx := newTxCounter(5, 0) tx.setFailOnAnte(true) @@ -1092,7 +1092,7 @@ func TestInitChainer(t *testing.T) { // commit and ensure we can still query header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) app.Commit() res = app.Query(query) @@ -1128,14 +1128,14 @@ func TestBeginBlock_WithInitialHeight(t *testing.T) { ) require.PanicsWithError(t, "invalid height: 4; expected: 3", func() { - app.BeginBlock(ocabci.RequestBeginBlock{ + app.BeginBlock(abci.RequestBeginBlock{ Header: tmproto.Header{ Height: 4, }, }) }) - app.BeginBlock(ocabci.RequestBeginBlock{ + app.BeginBlock(abci.RequestBeginBlock{ Header: tmproto.Header{ Height: 3, }, @@ -1440,7 +1440,7 @@ func TestCheckTx(t *testing.T) { // If a block is committed, CheckTx state should be reset. header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header, Hash: []byte("hash")}) + app.BeginBlock(abci.RequestBeginBlock{Header: header, Hash: []byte("hash")}) require.NotNil(t, app.checkState.ctx.BlockGasMeter(), "block gas meter should have been set to checkState") require.NotEmpty(t, app.checkState.ctx.HeaderHash()) @@ -1482,7 +1482,7 @@ func TestDeliverTx(t *testing.T) { for blockN := 0; blockN < nBlocks; blockN++ { header := tmproto.Header{Height: int64(blockN) + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) for i := 0; i < txPerHeight; i++ { counter := int64(blockN*txPerHeight + i) @@ -1628,7 +1628,7 @@ func TestLoadVersionInvalid(t *testing.T) { require.Error(t, err) header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) res := app.Commit() commitID1 := sdk.CommitID{Version: 1, Hash: res.Data} @@ -1678,7 +1678,7 @@ func setupBaseAppWithSnapshots(t *testing.T, blocks uint, blockTxs int, options r := rand.New(rand.NewSource(3920758213583)) keyCounter := 0 for height := int64(1); height <= int64(blocks); height++ { - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) for txNum := 0; txNum < blockTxs; txNum++ { tx := txTest{Msgs: []sdk.Msg{}} for msgNum := 0; msgNum < 100; msgNum++ { @@ -1750,13 +1750,13 @@ func TestLoadVersion(t *testing.T) { // execute a block, collect commit ID header := tmproto.Header{Height: 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) res := app.Commit() commitID1 := sdk.CommitID{Version: 1, Hash: res.Data} // execute a block, collect commit ID header = tmproto.Header{Height: 2} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) res = app.Commit() commitID2 := sdk.CommitID{Version: 2, Hash: res.Data} @@ -1773,7 +1773,7 @@ func TestLoadVersion(t *testing.T) { err = app.LoadVersion(1) require.Nil(t, err) testLoadVersionHelper(t, app, int64(1), commitID1) - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) app.Commit() testLoadVersionHelper(t, app, int64(2), commitID2) } @@ -1854,7 +1854,7 @@ func TestSetLoader(t *testing.T) { require.Nil(t, err) // "execute" one block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) res := app.Commit() require.NotNil(t, res.Data) diff --git a/baseapp/msg_service_router_test.go b/baseapp/msg_service_router_test.go index 4c0363e0f5..4196b31b26 100644 --- a/baseapp/msg_service_router_test.go +++ b/baseapp/msg_service_router_test.go @@ -9,7 +9,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/Finschia/finschia-sdk/baseapp" @@ -80,7 +79,7 @@ func TestMsgService(t *testing.T) { app.MsgServiceRouter(), testdata.MsgServerImpl{}, ) - _ = app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) + _ = app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 1}}) msg := testdata.MsgCreateDog{Dog: &testdata.Dog{Name: "Spot"}} txBuilder := encCfg.TxConfig.NewTxBuilder() diff --git a/baseapp/reactor.go b/baseapp/reactor.go index aa1d27b740..0252d67e0d 100644 --- a/baseapp/reactor.go +++ b/baseapp/reactor.go @@ -4,6 +4,7 @@ import ( "sync" ocabci "github.com/Finschia/ostracon/abci/types" + abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/Finschia/finschia-sdk/types" sdkerrors "github.com/Finschia/finschia-sdk/types/errors" @@ -52,7 +53,7 @@ func (app *BaseApp) checkTxAsync(req *RequestCheckTxAsync, waits []*sync.WaitGro return } - req.callback(ocabci.ResponseCheckTx{ + req.callback(abci.ResponseCheckTx{ GasWanted: int64(gInfo.GasWanted), // TODO: Should type accept unsigned ints? GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints? }) diff --git a/baseapp/streaming.go b/baseapp/streaming.go index aeaec29a93..7219432434 100644 --- a/baseapp/streaming.go +++ b/baseapp/streaming.go @@ -6,8 +6,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" - ocabci "github.com/Finschia/ostracon/abci/types" - store "github.com/Finschia/finschia-sdk/store/types" "github.com/Finschia/finschia-sdk/types" ) @@ -15,7 +13,7 @@ import ( // ABCIListener interface used to hook into the ABCI message processing of the BaseApp type ABCIListener interface { // ListenBeginBlock updates the streaming service with the latest BeginBlock messages - ListenBeginBlock(ctx types.Context, req ocabci.RequestBeginBlock, res abci.ResponseBeginBlock) error + ListenBeginBlock(ctx types.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error // ListenEndBlock updates the steaming service with the latest EndBlock messages ListenEndBlock(ctx types.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error // ListenDeliverTx updates the steaming service with the latest DeliverTx messages diff --git a/go.mod b/go.mod index 69a06e4472..918dead475 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ module github.com/Finschia/finschia-sdk require ( github.com/99designs/keyring v1.1.6 - github.com/Finschia/ostracon v1.1.1 + github.com/Finschia/ostracon v1.1.2-0.20230810030810-5836604d7dd0 github.com/VictoriaMetrics/fastcache v1.12.1 github.com/armon/go-metrics v0.4.1 github.com/bgentry/speakeasy v0.1.0 @@ -113,7 +113,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rs/cors v1.9.0 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.30.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -122,7 +122,7 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.13.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/term v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/go.sum b/go.sum index 159042b009..a8566878ae 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Finschia/ostracon v1.1.1 h1:Hdj2Xe9YSlD0hXbacIXUfOL6NfkF/lxg6AB8OnKvwgM= -github.com/Finschia/ostracon v1.1.1/go.mod h1:Ub1TWTN2+PfdCFo8ckdc4PxkfPmh2qQ8mmey+gLK5fw= +github.com/Finschia/ostracon v1.1.2-0.20230810030810-5836604d7dd0 h1:Egfr/T7uj5ZzxpvNFIWqb254e4PVBgdtAgB4L4OKuhQ= +github.com/Finschia/ostracon v1.1.2-0.20230810030810-5836604d7dd0/go.mod h1:jzv79jl0uNMxg8Lvi00zzS8uMgY4sFmHkZwl8n9S2Ns= github.com/Finschia/r2ishiguro_vrf v0.1.2 h1:lDBz6NQMx1pw5I3End6xFmXpM//7KcmTr3Ka983e7v8= github.com/Finschia/r2ishiguro_vrf v0.1.2/go.mod h1:OHRtvzcJnfIrcJ0bvPNktJozRFAyZFuv56E9R3/qB+Y= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -144,6 +144,7 @@ github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creachadair/taskgroup v0.6.0 h1:DogJ77FOD+9ZyQcD2cPn9Ivz6a607iPu+qC9CG/+mgo= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= @@ -586,9 +587,9 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= +github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -806,8 +807,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= +golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/server/export_test.go b/server/export_test.go index db08cc37c3..ce28d0293d 100644 --- a/server/export_test.go +++ b/server/export_test.go @@ -14,7 +14,6 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" ostjson "github.com/Finschia/ostracon/libs/json" "github.com/Finschia/ostracon/libs/log" octypes "github.com/Finschia/ostracon/types" @@ -101,7 +100,7 @@ func TestExportCmd_Height(t *testing.T) { // Fast forward to block `tc.fastForward`. for i := int64(2); i <= tc.fastForward; i++ { - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) app.Commit() } diff --git a/server/mock/app_test.go b/server/mock/app_test.go index fc5e27dfdd..afbe30f374 100644 --- a/server/mock/app_test.go +++ b/server/mock/app_test.go @@ -7,7 +7,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/types" ) @@ -62,7 +61,7 @@ func TestDeliverTx(t *testing.T) { AppHash: []byte("apphash"), Height: 1, } - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) dres := app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.Equal(t, uint32(0), dres.Code, dres.Log) app.EndBlock(abci.RequestEndBlock{}) diff --git a/simapp/app.go b/simapp/app.go index c9bc2ee09e..24abeb340c 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -14,7 +14,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" ostos "github.com/Finschia/ostracon/libs/os" @@ -564,7 +563,7 @@ func NewSimApp( func (app *SimApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block -func (app *SimApp) BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock { +func (app *SimApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index fa656570f0..fab98c81a5 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -165,7 +165,7 @@ func Setup(isCheckTx bool) *SimApp { // // // commit genesis changes // app.Commit() -// app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{ +// app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{ // Height: app.LastBlockHeight() + 1, // AppHash: app.LastCommitID().Hash, // ValidatorsHash: valSet.Hash(), @@ -204,7 +204,7 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba ) app.Commit() - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) return app } @@ -409,7 +409,7 @@ func SignCheckDeliver( } // Simulate a sending a transaction and committing a block and recheck - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) if expPass { @@ -448,7 +448,7 @@ func SignAndDeliver( require.NoError(t, err) // Simulate a sending a transaction and committing a block - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) if expPass { diff --git a/simapp/types.go b/simapp/types.go index 1f0314978f..d072d5a236 100644 --- a/simapp/types.go +++ b/simapp/types.go @@ -1,7 +1,6 @@ package simapp import ( - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/codec" @@ -21,7 +20,7 @@ type App interface { LegacyAmino() *codec.LegacyAmino // Application updates every begin block. - BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock + BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock // Application updates every end block. EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock diff --git a/store/rootmulti/rollback_test.go b/store/rootmulti/rollback_test.go index 4b1d4fb7a6..b4e3356f99 100644 --- a/store/rootmulti/rollback_test.go +++ b/store/rootmulti/rollback_test.go @@ -10,7 +10,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/Finschia/finschia-sdk/simapp" @@ -60,7 +59,7 @@ func TestRollback(t *testing.T) { Height: ver0 + i, AppHash: app.LastCommitID().Hash, } - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := app.NewContext(false, header) store := ctx.KVStore(app.GetKey("bank")) store.Set([]byte("key"), []byte(fmt.Sprintf("value%d", i))) @@ -88,7 +87,7 @@ func TestRollback(t *testing.T) { Height: ver0 + i, AppHash: app.LastCommitID().Hash, } - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := app.NewContext(false, header) store := ctx.KVStore(app.GetKey("bank")) store.Set([]byte("key"), []byte(fmt.Sprintf("VALUE%d", i))) diff --git a/store/streaming/file/service.go b/store/streaming/file/service.go index 98d8fed761..e8a1a3a8e2 100644 --- a/store/streaming/file/service.go +++ b/store/streaming/file/service.go @@ -10,8 +10,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/baseapp" "github.com/Finschia/finschia-sdk/codec" "github.com/Finschia/finschia-sdk/store/types" @@ -89,7 +87,7 @@ func (fss *StreamingService) Listeners() map[types.StoreKey][]types.WriteListene // ListenBeginBlock satisfies the baseapp.ABCIListener interface // It writes the received BeginBlock request and response and the resulting state changes // out to a file as described in the above the naming schema -func (fss *StreamingService) ListenBeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock, res abci.ResponseBeginBlock) error { +func (fss *StreamingService) ListenBeginBlock(ctx sdk.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error { // generate the new file dstFile, err := fss.openBeginBlockFile(req) if err != nil { @@ -127,7 +125,7 @@ func (fss *StreamingService) ListenBeginBlock(ctx sdk.Context, req ocabci.Reques return dstFile.Close() } -func (fss *StreamingService) openBeginBlockFile(req ocabci.RequestBeginBlock) (*os.File, error) { +func (fss *StreamingService) openBeginBlockFile(req abci.RequestBeginBlock) (*os.File, error) { fss.currentBlockNumber = req.GetHeader().Height fss.currentTxIndex = 0 fileName := fmt.Sprintf("block-%d-begin", fss.currentBlockNumber) diff --git a/store/streaming/file/service_test.go b/store/streaming/file/service_test.go index d08d4d6c93..528fd66963 100644 --- a/store/streaming/file/service_test.go +++ b/store/streaming/file/service_test.go @@ -12,8 +12,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/codec" codecTypes "github.com/Finschia/finschia-sdk/codec/types" "github.com/Finschia/finschia-sdk/store/types" @@ -29,7 +27,7 @@ var ( // test abci message types mockHash = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9} - testBeginBlockReq = ocabci.RequestBeginBlock{ + testBeginBlockReq = abci.RequestBeginBlock{ Header: tmproto.Header{ Height: 1, }, diff --git a/tests/mocks/types_module_module.go b/tests/mocks/types_module_module.go index cff731f73c..70af211fb7 100644 --- a/tests/mocks/types_module_module.go +++ b/tests/mocks/types_module_module.go @@ -15,9 +15,8 @@ import ( types "github.com/Finschia/finschia-sdk/codec/types" types0 "github.com/Finschia/finschia-sdk/types" module "github.com/Finschia/finschia-sdk/types/module" - ocabci "github.com/Finschia/ostracon/abci/types" cobra "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + types1 "github.com/tendermint/tendermint/abci/types" ) // MockAppModuleBasic is a mock of AppModuleBasic interface. @@ -229,10 +228,10 @@ func (mr *MockAppModuleGenesisMockRecorder) GetTxCmd() *gomock.Call { } // InitGenesis mocks base method. -func (m *MockAppModuleGenesis) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []abci.ValidatorUpdate { +func (m *MockAppModuleGenesis) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) - ret0, _ := ret[0].([]abci.ValidatorUpdate) + ret0, _ := ret[0].([]types1.ValidatorUpdate) return ret0 } @@ -330,7 +329,7 @@ func (m *MockAppModule) EXPECT() *MockAppModuleMockRecorder { } // BeginBlock mocks base method. -func (m *MockAppModule) BeginBlock(arg0 types0.Context, arg1 ocabci.RequestBeginBlock) { +func (m *MockAppModule) BeginBlock(arg0 types0.Context, arg1 types1.RequestBeginBlock) { m.ctrl.T.Helper() m.ctrl.Call(m, "BeginBlock", arg0, arg1) } @@ -370,10 +369,10 @@ func (mr *MockAppModuleMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Ca } // EndBlock mocks base method. -func (m *MockAppModule) EndBlock(arg0 types0.Context, arg1 abci.RequestEndBlock) []abci.ValidatorUpdate { +func (m *MockAppModule) EndBlock(arg0 types0.Context, arg1 types1.RequestEndBlock) []types1.ValidatorUpdate { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EndBlock", arg0, arg1) - ret0, _ := ret[0].([]abci.ValidatorUpdate) + ret0, _ := ret[0].([]types1.ValidatorUpdate) return ret0 } @@ -426,10 +425,10 @@ func (mr *MockAppModuleMockRecorder) GetTxCmd() *gomock.Call { } // InitGenesis mocks base method. -func (m *MockAppModule) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []abci.ValidatorUpdate { +func (m *MockAppModule) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) - ret0, _ := ret[0].([]abci.ValidatorUpdate) + ret0, _ := ret[0].([]types1.ValidatorUpdate) return ret0 } diff --git a/third_party/proto/ostracon/abci/types.proto b/third_party/proto/ostracon/abci/types.proto index 158fb4b6b8..d4a4f3725c 100644 --- a/third_party/proto/ostracon/abci/types.proto +++ b/third_party/proto/ostracon/abci/types.proto @@ -7,7 +7,7 @@ option go_package = "github.com/Finschia/ostracon/abci/types"; // https://github.com/gogo/protobuf/blob/master/extensions.md import "tendermint/abci/types.proto"; import "tendermint/types/types.proto"; -import "ostracon/types/types.proto"; +import "tendermint/crypto/keys.proto"; import "gogoproto/gogo.proto"; // This file is copied from http://github.com/tendermint/abci @@ -25,7 +25,7 @@ message Request { tendermint.abci.RequestSetOption set_option = 4; tendermint.abci.RequestInitChain init_chain = 5; tendermint.abci.RequestQuery query = 6; - RequestBeginBlock begin_block = 7; + tendermint.abci.RequestBeginBlock begin_block = 7; tendermint.abci.RequestCheckTx check_tx = 8; tendermint.abci.RequestDeliverTx deliver_tx = 9; tendermint.abci.RequestEndBlock end_block = 10; @@ -39,16 +39,6 @@ message Request { } } -message RequestBeginBlock { - bytes hash = 1; - tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; - tendermint.abci.LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated tendermint.abci.Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; - - // *** Ostracon Extended Fields *** - ostracon.types.Entropy entropy = 1000 [(gogoproto.nullable) = false]; -} - message RequestBeginRecheckTx { tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; } @@ -70,7 +60,7 @@ message Response { tendermint.abci.ResponseInitChain init_chain = 6; tendermint.abci.ResponseQuery query = 7; tendermint.abci.ResponseBeginBlock begin_block = 8; - ResponseCheckTx check_tx = 9; + tendermint.abci.ResponseCheckTx check_tx = 9; tendermint.abci.ResponseDeliverTx deliver_tx = 10; tendermint.abci.ResponseEndBlock end_block = 11; tendermint.abci.ResponseCommit commit = 12; @@ -83,24 +73,6 @@ message Response { } } -message ResponseCheckTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5 [json_name = "gas_wanted"]; - int64 gas_used = 6 [json_name = "gas_used"]; - repeated tendermint.abci.Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; - string sender = 9; // MEMO: not used, just reservation to implement https://github.com/tendermint/tendermint/pull/6740 first - int64 priority = 10; // MEMO: not used, just reservation to implement https://github.com/tendermint/tendermint/pull/6740 first - - // mempool_error is set by Ostracon. - // ABCI applictions creating a ResponseCheckTX should not set mempool_error. - string mempool_error = 11; -} - message ResponseBeginRecheckTx { uint32 code = 1; } @@ -118,11 +90,11 @@ service ABCIApplication { rpc Info(tendermint.abci.RequestInfo) returns (tendermint.abci.ResponseInfo); rpc SetOption(tendermint.abci.RequestSetOption) returns (tendermint.abci.ResponseSetOption); rpc DeliverTx(tendermint.abci.RequestDeliverTx) returns (tendermint.abci.ResponseDeliverTx); - rpc CheckTx(tendermint.abci.RequestCheckTx) returns (ResponseCheckTx); + rpc CheckTx(tendermint.abci.RequestCheckTx) returns (tendermint.abci.ResponseCheckTx); rpc Query(tendermint.abci.RequestQuery) returns (tendermint.abci.ResponseQuery); rpc Commit(tendermint.abci.RequestCommit) returns (tendermint.abci.ResponseCommit); rpc InitChain(tendermint.abci.RequestInitChain) returns (tendermint.abci.ResponseInitChain); - rpc BeginBlock(RequestBeginBlock) returns (tendermint.abci.ResponseBeginBlock); + rpc BeginBlock(tendermint.abci.RequestBeginBlock) returns (tendermint.abci.ResponseBeginBlock); rpc EndBlock(tendermint.abci.RequestEndBlock) returns (tendermint.abci.ResponseEndBlock); rpc ListSnapshots(tendermint.abci.RequestListSnapshots) returns (tendermint.abci.ResponseListSnapshots); rpc OfferSnapshot(tendermint.abci.RequestOfferSnapshot) returns (tendermint.abci.ResponseOfferSnapshot); diff --git a/types/abci.go b/types/abci.go index 6cd54a411e..d803e5e274 100644 --- a/types/abci.go +++ b/types/abci.go @@ -2,8 +2,6 @@ package types import ( abci "github.com/tendermint/tendermint/abci/types" - - ocabci "github.com/Finschia/ostracon/abci/types" ) // InitChainer initializes application state at genesis @@ -13,7 +11,7 @@ type InitChainer func(ctx Context, req abci.RequestInitChain) abci.ResponseInitC // // Note: applications which set create_empty_blocks=false will not have regular block timing and should use // e.g. BFT timestamps rather than block height for any periodic BeginBlock logic -type BeginBlocker func(ctx Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock +type BeginBlocker func(ctx Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock // EndBlocker runs code after the transactions in a block and return updates to the validator set // diff --git a/types/errors/abci.go b/types/errors/abci.go index bcfb37977c..352adfe15f 100644 --- a/types/errors/abci.go +++ b/types/errors/abci.go @@ -5,8 +5,6 @@ import ( "reflect" abci "github.com/tendermint/tendermint/abci/types" - - ocabci "github.com/Finschia/ostracon/abci/types" ) const ( @@ -43,9 +41,9 @@ func ABCIInfo(err error, debug bool) (codespace string, code uint32, log string) // ResponseCheckTx returns an ABCI ResponseCheckTx object with fields filled in // from the given error and gas values. -func ResponseCheckTx(err error, gw, gu uint64, debug bool) ocabci.ResponseCheckTx { +func ResponseCheckTx(err error, gw, gu uint64, debug bool) abci.ResponseCheckTx { space, code, log := ABCIInfo(err, debug) - return ocabci.ResponseCheckTx{ + return abci.ResponseCheckTx{ Codespace: space, Code: code, Log: log, @@ -56,9 +54,9 @@ func ResponseCheckTx(err error, gw, gu uint64, debug bool) ocabci.ResponseCheckT // ResponseCheckTxWithEvents returns an ABCI ResponseCheckTx object with fields filled in // from the given error, gas values and events. -func ResponseCheckTxWithEvents(err error, gw, gu uint64, events []abci.Event, debug bool) ocabci.ResponseCheckTx { +func ResponseCheckTxWithEvents(err error, gw, gu uint64, events []abci.Event, debug bool) abci.ResponseCheckTx { space, code, log := ABCIInfo(err, debug) - return ocabci.ResponseCheckTx{ + return abci.ResponseCheckTx{ Codespace: space, Code: code, Log: log, diff --git a/types/module/module.go b/types/module/module.go index 527d3bcd02..e1724fa5a0 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -36,7 +36,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/client" @@ -176,7 +175,7 @@ type AppModule interface { // BeginBlockAppModule is an extension interface that contains information about the AppModule and BeginBlock. type BeginBlockAppModule interface { AppModule - BeginBlock(sdk.Context, ocabci.RequestBeginBlock) + BeginBlock(sdk.Context, abci.RequestBeginBlock) } // EndBlockAppModule is an extension interface that contains information about the AppModule and EndBlock. @@ -216,7 +215,7 @@ func (gam GenesisOnlyAppModule) RegisterServices(Configurator) {} func (gam GenesisOnlyAppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns an empty module begin-block -func (gam GenesisOnlyAppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) {} +func (gam GenesisOnlyAppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} // EndBlock returns an empty module end-block func (GenesisOnlyAppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { @@ -475,7 +474,7 @@ func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, fromVM Version // BeginBlock performs begin block functionality for all modules. It creates a // child context with an event manager to aggregate events emitted from all // modules. -func (m *Manager) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock { +func (m *Manager) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { ctx = ctx.WithEventManager(sdk.NewEventManager()) for _, moduleName := range m.OrderBeginBlockers { diff --git a/types/module/module_test.go b/types/module/module_test.go index 5f0f54bc4e..75aebf1f87 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -7,7 +7,6 @@ import ( "github.com/Finschia/finschia-sdk/codec/types" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/golang/mock/gomock" "github.com/spf13/cobra" "github.com/stretchr/testify/require" @@ -250,7 +249,7 @@ func TestManager_BeginBlock(t *testing.T) { require.NotNil(t, mm) require.Equal(t, 2, len(mm.Modules)) - req := ocabci.RequestBeginBlock{Hash: []byte("test")} + req := abci.RequestBeginBlock{Hash: []byte("test")} mockAppModule1.EXPECT().BeginBlock(gomock.Any(), gomock.Eq(req)).Times(1) mockAppModule2.EXPECT().BeginBlock(gomock.Any(), gomock.Eq(req)).Times(1) diff --git a/types/result_test.go b/types/result_test.go index fcd3872a21..57fb1fb990 100644 --- a/types/result_test.go +++ b/types/result_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/bytes" ctypes "github.com/Finschia/ostracon/rpc/core/types" @@ -213,7 +212,7 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() { checkTxResult := &ctypes.ResultBroadcastTxCommit{ Height: 10, Hash: bytes.HexBytes([]byte("test")), - CheckTx: ocabci.ResponseCheckTx{ + CheckTx: abci.ResponseCheckTx{ Code: 90, Data: nil, Log: `[]`, diff --git a/x/authz/simulation/operations_test.go b/x/authz/simulation/operations_test.go index 0d92cc64cc..9dad59dd7d 100644 --- a/x/authz/simulation/operations_test.go +++ b/x/authz/simulation/operations_test.go @@ -6,10 +6,9 @@ import ( "time" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" sdk "github.com/Finschia/finschia-sdk/types" simtypes "github.com/Finschia/finschia-sdk/types/simulation" @@ -90,7 +89,7 @@ func (suite *SimTestSuite) TestSimulateGrant() { ctx := suite.ctx.WithBlockTime(blockTime) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{ + suite.app.BeginBlock(abci.RequestBeginBlock{ Header: tmproto.Header{ Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash, @@ -120,7 +119,7 @@ func (suite *SimTestSuite) TestSimulateRevoke() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{ + suite.app.BeginBlock(abci.RequestBeginBlock{ Header: tmproto.Header{ Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash, @@ -159,7 +158,7 @@ func (suite *SimTestSuite) TestSimulateExec() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) initAmt := suite.app.StakingKeeper.TokensFromConsensusPower(suite.ctx, 200000) initCoins := sdk.NewCoins(sdk.NewCoin("stake", initAmt)) diff --git a/x/bank/bench_test.go b/x/bank/bench_test.go index 68e0720589..3a55ae9230 100644 --- a/x/bank/bench_test.go +++ b/x/bank/bench_test.go @@ -7,8 +7,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -47,7 +45,7 @@ func BenchmarkOneBankSendTxPerBlock(b *testing.B) { // Run this with a profiler, so its easy to distinguish what time comes from // Committing, and what time comes from Check/Deliver Tx. for i := 0; i < b.N; i++ { - benchmarkApp.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) + benchmarkApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) _, err := benchmarkApp.Check(txGen.TxEncoder(), txs[i]) if err != nil { panic("something is broken in checking transaction") @@ -89,7 +87,7 @@ func BenchmarkOneBankMultiSendTxPerBlock(b *testing.B) { // Run this with a profiler, so its easy to distinguish what time comes from // Committing, and what time comes from Check/Deliver Tx. for i := 0; i < b.N; i++ { - benchmarkApp.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) + benchmarkApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height}}) _, err := benchmarkApp.Check(txGen.TxEncoder(), txs[i]) if err != nil { panic("something is broken in checking transaction") diff --git a/x/bank/simulation/operations_test.go b/x/bank/simulation/operations_test.go index fc67f57647..497f7e9ae3 100644 --- a/x/bank/simulation/operations_test.go +++ b/x/bank/simulation/operations_test.go @@ -5,10 +5,9 @@ import ( "testing" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -72,7 +71,7 @@ func (suite *SimTestSuite) TestSimulateMsgSend() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgSend(suite.app.AccountKeeper, suite.app.BankKeeper) @@ -100,7 +99,7 @@ func (suite *SimTestSuite) TestSimulateMsgMultiSend() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgMultiSend(suite.app.AccountKeeper, suite.app.BankKeeper) @@ -135,7 +134,7 @@ func (suite *SimTestSuite) TestSimulateModuleAccountMsgSend() { accounts := suite.getTestingAccounts(r, accCount) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgSendToModuleAccount(suite.app.AccountKeeper, suite.app.BankKeeper, moduleAccCount) @@ -168,7 +167,7 @@ func (suite *SimTestSuite) TestSimulateMsgMultiSendToModuleAccount() { accounts := suite.getTestingAccounts(r, accCount) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgMultiSendToModuleAccount(suite.app.AccountKeeper, suite.app.BankKeeper, mAccCount) diff --git a/x/capability/capability_test.go b/x/capability/capability_test.go index ae48072ce0..f81fdaf093 100644 --- a/x/capability/capability_test.go +++ b/x/capability/capability_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/Finschia/finschia-sdk/codec" @@ -14,7 +15,6 @@ import ( "github.com/Finschia/finschia-sdk/x/capability" "github.com/Finschia/finschia-sdk/x/capability/keeper" "github.com/Finschia/finschia-sdk/x/capability/types" - ocabci "github.com/Finschia/ostracon/abci/types" ) type CapabilityTestSuite struct { @@ -64,7 +64,7 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() { ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockGasMeter(sdk.NewGasMeter(50)) prevGas := ctx.BlockGasMeter().GasConsumed() restartedModule := capability.NewAppModule(suite.cdc, *newKeeper) - restartedModule.BeginBlock(ctx, ocabci.RequestBeginBlock{}) + restartedModule.BeginBlock(ctx, abci.RequestBeginBlock{}) suite.Require().True(newKeeper.IsInitialized(ctx), "memstore initialized flag not set") gasUsed := ctx.BlockGasMeter().GasConsumed() @@ -85,7 +85,7 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() { // Ensure the capabilities don't get reinitialized on next BeginBlock // by testing to see if capability returns same pointer // also check that initialized flag is still set - restartedModule.BeginBlock(ctx, ocabci.RequestBeginBlock{}) + restartedModule.BeginBlock(ctx, abci.RequestBeginBlock{}) recap, ok := newSk1.GetCapability(ctx, "transfer") suite.Require().True(ok) suite.Require().Equal(cap1, recap, "capabilities got reinitialized after second BeginBlock") diff --git a/x/capability/module.go b/x/capability/module.go index 07181e22c1..f22e7017e7 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -9,7 +9,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/client" @@ -146,7 +145,7 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlocker calls InitMemStore to assert that the memory store is initialized. // It's safe to run multiple times. -func (am AppModule) BeginBlock(ctx sdk.Context, _ ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) am.keeper.InitMemStore(ctx) diff --git a/x/crisis/keeper/keeper_test.go b/x/crisis/keeper/keeper_test.go index 243aa1a714..acafe96685 100644 --- a/x/crisis/keeper/keeper_test.go +++ b/x/crisis/keeper/keeper_test.go @@ -4,10 +4,9 @@ import ( "testing" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" sdk "github.com/Finschia/finschia-sdk/types" ) @@ -22,7 +21,7 @@ func TestLogger(t *testing.T) { func TestInvariants(t *testing.T) { app := simapp.Setup(false) app.Commit() - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) require.Equal(t, app.CrisisKeeper.InvCheckPeriod(), uint(5)) @@ -35,7 +34,7 @@ func TestInvariants(t *testing.T) { func TestAssertInvariants(t *testing.T) { app := simapp.Setup(false) app.Commit() - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) ctx := app.NewContext(true, tmproto.Header{}) diff --git a/x/distribution/abci.go b/x/distribution/abci.go index 7f005e79aa..1c2dabc761 100644 --- a/x/distribution/abci.go +++ b/x/distribution/abci.go @@ -3,7 +3,7 @@ package distribution import ( "time" - ocabci "github.com/Finschia/ostracon/abci/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/telemetry" sdk "github.com/Finschia/finschia-sdk/types" @@ -13,7 +13,7 @@ import ( // BeginBlocker sets the proposer for determining distribution during endblock // and distribute rewards for the previous block -func BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) // determine the total power signing the block diff --git a/x/distribution/module.go b/x/distribution/module.go index b2fc955f6c..7a788a8c89 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -8,7 +8,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -164,7 +163,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the distribution module. -func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) } diff --git a/x/distribution/simulation/operations_test.go b/x/distribution/simulation/operations_test.go index 6b37ef7123..78ff44f8c6 100644 --- a/x/distribution/simulation/operations_test.go +++ b/x/distribution/simulation/operations_test.go @@ -5,10 +5,9 @@ import ( "testing" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -64,7 +63,7 @@ func (suite *SimTestSuite) TestSimulateMsgSetWithdrawAddress() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgSetWithdrawAddress(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.DistrKeeper) @@ -105,7 +104,7 @@ func (suite *SimTestSuite) TestSimulateMsgWithdrawDelegatorReward() { suite.setupValidatorRewards(validator0.GetOperator()) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgWithdrawDelegatorReward(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.DistrKeeper, suite.app.StakingKeeper) @@ -161,7 +160,7 @@ func (suite *SimTestSuite) testSimulateMsgWithdrawValidatorCommission(tokenName suite.app.DistrKeeper.SetValidatorAccumulatedCommission(suite.ctx, validator0.GetOperator(), types.ValidatorAccumulatedCommission{Commission: valCommission}) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgWithdrawValidatorCommission(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.DistrKeeper, suite.app.StakingKeeper) @@ -187,7 +186,7 @@ func (suite *SimTestSuite) TestSimulateMsgFundCommunityPool() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - suite.app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgFundCommunityPool(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.DistrKeeper, suite.app.StakingKeeper) diff --git a/x/evidence/abci.go b/x/evidence/abci.go index 5341a62c12..da3b9e1983 100644 --- a/x/evidence/abci.go +++ b/x/evidence/abci.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/telemetry" @@ -15,7 +14,7 @@ import ( // BeginBlocker iterates through and handles any newly discovered evidence of // misbehavior submitted by Tendermint. Currently, only equivocation is handled. -func BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) for _, tmEvidence := range req.ByzantineValidators { diff --git a/x/evidence/module.go b/x/evidence/module.go index 050b943d21..ed26e2f999 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/client" @@ -175,7 +174,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the evidence module. -func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) } diff --git a/x/feegrant/simulation/operations_test.go b/x/feegrant/simulation/operations_test.go index 5abc7cfd12..b09b3b5f52 100644 --- a/x/feegrant/simulation/operations_test.go +++ b/x/feegrant/simulation/operations_test.go @@ -6,10 +6,9 @@ import ( "time" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -104,7 +103,7 @@ func (suite *SimTestSuite) TestSimulateMsgGrantAllowance() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgGrantAllowance(app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper) @@ -129,7 +128,7 @@ func (suite *SimTestSuite) TestSimulateMsgRevokeAllowance() { accounts := suite.getTestingAccounts(r, 3) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) feeAmt := app.StakingKeeper.TokensFromConsensusPower(ctx, 200000) feeCoins := sdk.NewCoins(sdk.NewCoin("foo", feeAmt)) diff --git a/x/foundation/module/module.go b/x/foundation/module/module.go index 801dfc4901..ecc3e4f7da 100644 --- a/x/foundation/module/module.go +++ b/x/foundation/module/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -141,7 +140,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return consensusVersion } // BeginBlock performs a no-op. -func (am AppModule) BeginBlock(ctx sdk.Context, _ ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { keeper.BeginBlocker(ctx, am.keeper) } diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 870b939268..1feca479aa 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -5,10 +5,9 @@ import ( "time" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/gov" @@ -23,7 +22,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) govHandler := gov.NewHandler(app.GovKeeper) @@ -75,7 +74,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) govHandler := gov.NewHandler(app.GovKeeper) @@ -152,7 +151,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) govHandler := gov.NewHandler(app.GovKeeper) @@ -211,7 +210,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { SortAddresses(addrs) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) govHandler := gov.NewHandler(app.GovKeeper) @@ -282,7 +281,7 @@ func TestProposalPassedEndblocker(t *testing.T) { stakingHandler := staking.NewHandler(app.StakingKeeper) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) valAddr := sdk.ValAddress(addrs[0]) @@ -331,7 +330,7 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) { stakingHandler := staking.NewHandler(app.StakingKeeper) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) valAddr := sdk.ValAddress(addrs[0]) diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index ea96276e62..eaf115b0b7 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -6,7 +6,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -29,7 +28,7 @@ func TestImportExportQueues(t *testing.T) { SortAddresses(addrs) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx = app.BaseApp.NewContext(false, tmproto.Header{}) @@ -82,10 +81,10 @@ func TestImportExportQueues(t *testing.T) { ) app2.Commit() - app2.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app2.LastBlockHeight() + 1}}) + app2.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app2.LastBlockHeight() + 1}}) header = tmproto.Header{Height: app2.LastBlockHeight() + 1} - app2.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app2.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx2 := app2.BaseApp.NewContext(false, tmproto.Header{}) @@ -143,7 +142,7 @@ func TestEqualProposals(t *testing.T) { SortAddresses(addrs) header := tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) // Submit two proposals proposal := TestProposal diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index ba492587f7..504e82a1b0 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/Finschia/finschia-sdk/simapp" @@ -104,7 +104,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { accounts := getTestingAccounts(t, r, app, ctx, 3) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgSubmitProposal(app.AccountKeeper, app.BankKeeper, app.GovKeeper, MockWeightedProposalContent{3}.ContentSimulatorFn()) @@ -148,7 +148,7 @@ func TestSimulateMsgDeposit(t *testing.T) { app.GovKeeper.SetProposal(ctx, proposal) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgDeposit(app.AccountKeeper, app.BankKeeper, app.GovKeeper) @@ -191,7 +191,7 @@ func TestSimulateMsgVote(t *testing.T) { app.GovKeeper.ActivateVotingPeriod(ctx, proposal) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgVote(app.AccountKeeper, app.BankKeeper, app.GovKeeper) @@ -234,7 +234,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { app.GovKeeper.ActivateVotingPeriod(ctx, proposal) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgVoteWeighted(app.AccountKeeper, app.BankKeeper, app.GovKeeper) diff --git a/x/mint/module.go b/x/mint/module.go index 07e328d46e..d13d8024bd 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -147,7 +146,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the mint module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper) } diff --git a/x/simulation/mock_ostracon.go b/x/simulation/mock_ostracon.go index 0fea9e6243..020d9cb1bd 100644 --- a/x/simulation/mock_ostracon.go +++ b/x/simulation/mock_ostracon.go @@ -10,7 +10,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" cryptoenc "github.com/Finschia/ostracon/crypto/encoding" ostbytes "github.com/Finschia/ostracon/libs/bytes" ) @@ -120,9 +119,9 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, validators mockValidators, pastTimes []time.Time, pastVoteInfos [][]abci.VoteInfo, event func(route, op, evResult string), header tmproto.Header, -) ocabci.RequestBeginBlock { +) abci.RequestBeginBlock { if len(validators) == 0 { - return ocabci.RequestBeginBlock{ + return abci.RequestBeginBlock{ Header: header, } } @@ -166,7 +165,7 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, // return if no past times if len(pastTimes) == 0 { - return ocabci.RequestBeginBlock{ + return abci.RequestBeginBlock{ Header: header, LastCommitInfo: abci.LastCommitInfo{ Votes: voteInfos, @@ -209,7 +208,7 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, event("begin_block", "evidence", "ok") } - return ocabci.RequestBeginBlock{ + return abci.RequestBeginBlock{ Header: header, LastCommitInfo: abci.LastCommitInfo{ Votes: voteInfos, diff --git a/x/slashing/abci.go b/x/slashing/abci.go index 6870452534..d3d991ddb2 100644 --- a/x/slashing/abci.go +++ b/x/slashing/abci.go @@ -3,7 +3,7 @@ package slashing import ( "time" - ocabci "github.com/Finschia/ostracon/abci/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/telemetry" sdk "github.com/Finschia/finschia-sdk/types" @@ -13,7 +13,7 @@ import ( // BeginBlocker check for infraction evidence or downtime of validators // on every begin block -func BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) // Iterate over all the validators which *should* have signed this block diff --git a/x/slashing/abci_test.go b/x/slashing/abci_test.go index 990bf0e2c8..7764e9fc24 100644 --- a/x/slashing/abci_test.go +++ b/x/slashing/abci_test.go @@ -8,8 +8,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/slashing" @@ -43,7 +41,7 @@ func TestBeginBlocker(t *testing.T) { } // mark the validator as having signed - req := ocabci.RequestBeginBlock{ + req := abci.RequestBeginBlock{ LastCommitInfo: abci.LastCommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, @@ -66,7 +64,7 @@ func TestBeginBlocker(t *testing.T) { // for 1000 blocks, mark the validator as having signed for ; height < app.SlashingKeeper.SignedBlocksWindow(ctx); height++ { ctx = ctx.WithBlockHeight(height) - req = ocabci.RequestBeginBlock{ + req = abci.RequestBeginBlock{ LastCommitInfo: abci.LastCommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, @@ -81,7 +79,7 @@ func TestBeginBlocker(t *testing.T) { // for 500 blocks, mark the validator as having not signed for ; height < ((app.SlashingKeeper.SignedBlocksWindow(ctx) * 2) - app.SlashingKeeper.MinSignedPerWindow(ctx) + 1); height++ { ctx = ctx.WithBlockHeight(height) - req = ocabci.RequestBeginBlock{ + req = abci.RequestBeginBlock{ LastCommitInfo: abci.LastCommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index 14c6aab848..441e32a654 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -5,10 +5,9 @@ import ( "testing" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/crypto/keys/ed25519" "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1" "github.com/Finschia/finschia-sdk/simapp" @@ -76,7 +75,7 @@ func TestSlashingMsgs(t *testing.T) { simapp.CheckBalance(t, app, addr1, sdk.Coins{genCoin.Sub(bondCoin)}) header = tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) validator := checkValidator(t, app, addr1, true) require.Equal(t, sdk.ValAddress(addr1).String(), validator.OperatorAddress) diff --git a/x/slashing/module.go b/x/slashing/module.go index 3e336c2f0d..aa626b325f 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/client" @@ -160,7 +159,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the slashing module. -func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) } diff --git a/x/slashing/simulation/operations_test.go b/x/slashing/simulation/operations_test.go index 066f8c9e5e..ede3d09534 100644 --- a/x/slashing/simulation/operations_test.go +++ b/x/slashing/simulation/operations_test.go @@ -6,10 +6,9 @@ import ( "time" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -87,7 +86,7 @@ func TestSimulateMsgUnjail(t *testing.T) { app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.GetOperator(), val0AccAddress.Bytes(), distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgUnjail(app.AccountKeeper, app.BankKeeper, app.SlashingKeeper, app.StakingKeeper) diff --git a/x/staking/app_test.go b/x/staking/app_test.go index c546eb6e60..8f24682ff4 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -4,10 +4,9 @@ import ( "testing" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" sdk "github.com/Finschia/finschia-sdk/types" authtypes "github.com/Finschia/finschia-sdk/x/auth/types" @@ -77,7 +76,7 @@ func TestStakingMsgs(t *testing.T) { simapp.CheckBalance(t, app, addr1, sdk.Coins{genCoin.Sub(bondCoin)}) header = tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) validator := checkValidator(t, app, sdk.ValAddress(addr1), true) require.Equal(t, sdk.ValAddress(addr1).String(), validator.OperatorAddress) @@ -85,7 +84,7 @@ func TestStakingMsgs(t *testing.T) { require.True(sdk.IntEq(t, bondTokens, validator.BondedTokens())) header = tmproto.Header{Height: app.LastBlockHeight() + 1} - app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) + app.BeginBlock(abci.RequestBeginBlock{Header: header}) // edit the validator description = types.NewDescription("bar_moniker", "", "", "", "") diff --git a/x/staking/module.go b/x/staking/module.go index fa038e479d..3e683ab03a 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -8,7 +8,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -162,7 +161,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the staking module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper) } diff --git a/x/staking/simulation/operations_test.go b/x/staking/simulation/operations_test.go index 063c665383..9810b8e885 100644 --- a/x/staking/simulation/operations_test.go +++ b/x/staking/simulation/operations_test.go @@ -6,10 +6,9 @@ import ( "time" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/simapp" simappparams "github.com/Finschia/finschia-sdk/simapp/params" sdk "github.com/Finschia/finschia-sdk/types" @@ -72,7 +71,7 @@ func TestSimulateMsgCreateValidator(t *testing.T) { accounts := getTestingAccounts(t, r, app, ctx, 3) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgCreateValidator(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) @@ -109,7 +108,7 @@ func TestSimulateMsgEditValidator(t *testing.T) { _ = getTestingValidator0(t, app, ctx, accounts) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgEditValidator(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) @@ -147,7 +146,7 @@ func TestSimulateMsgDelegate(t *testing.T) { setupValidatorRewards(app, ctx, validator0.GetOperator()) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgDelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) @@ -192,7 +191,7 @@ func TestSimulateMsgUndelegate(t *testing.T) { setupValidatorRewards(app, ctx, validator0.GetOperator()) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation op := simulation.SimulateMsgUndelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) @@ -240,7 +239,7 @@ func TestSimulateMsgBeginRedelegate(t *testing.T) { setupValidatorRewards(app, ctx, validator1.GetOperator()) // begin a new block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) // execute operation // SimulateMsgBeginRedelegate selects a validator randomly, so this test code was modified such that diff --git a/x/stakingplus/module/module.go b/x/stakingplus/module/module.go index 0e4d18079c..aa8ad6cc61 100644 --- a/x/stakingplus/module/module.go +++ b/x/stakingplus/module/module.go @@ -3,7 +3,6 @@ package module import ( "encoding/json" - ocabci "github.com/Finschia/ostracon/abci/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/Finschia/finschia-sdk/codec" @@ -110,7 +109,7 @@ func (am AppModule) ConsensusVersion() uint64 { } // BeginBlock returns the begin blocker for the stakingplus module. -func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { am.impl.BeginBlock(ctx, req) } diff --git a/x/upgrade/abci.go b/x/upgrade/abci.go index cf3180ec80..d8e44a000a 100644 --- a/x/upgrade/abci.go +++ b/x/upgrade/abci.go @@ -4,12 +4,11 @@ import ( "fmt" "time" - ocabci "github.com/Finschia/ostracon/abci/types" - "github.com/Finschia/finschia-sdk/telemetry" sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/upgrade/keeper" "github.com/Finschia/finschia-sdk/x/upgrade/types" + abci "github.com/tendermint/tendermint/abci/types" ) // BeginBlock will check if there is a scheduled plan and if it is ready to be executed. @@ -20,7 +19,7 @@ import ( // The purpose is to ensure the binary is switched EXACTLY at the desired block, and to allow // a migration to be executed if needed upon this switch (migration defined in the new binary) // skipUpgradeHeightArray is a set of block heights for which the upgrade must be skipped -func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ ocabci.RequestBeginBlock) { +func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) plan, found := k.GetUpgradePlan(ctx) diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index e78ac83d80..e0ca7bdb11 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -10,7 +10,6 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tm-db" @@ -99,7 +98,7 @@ func VerifyDoUpgrade(t *testing.T) { t.Log("Verify that a panic happens at the upgrade height") newCtx := s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1).WithBlockTime(time.Now()) - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} require.Panics(t, func() { s.module.BeginBlock(newCtx, req) }) @@ -117,7 +116,7 @@ func VerifyDoUpgrade(t *testing.T) { func VerifyDoUpgradeWithCtx(t *testing.T, newCtx sdk.Context, proposalName string) { t.Log("Verify that a panic happens at the upgrade height") - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} require.Panics(t, func() { s.module.BeginBlock(newCtx, req) }) @@ -143,7 +142,7 @@ func TestHaltIfTooNew(t *testing.T) { }) newCtx := s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1).WithBlockTime(time.Now()) - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} require.NotPanics(t, func() { s.module.BeginBlock(newCtx, req) }) @@ -160,7 +159,7 @@ func TestHaltIfTooNew(t *testing.T) { t.Log("Verify we no longer panic if the plan is on time") futCtx := s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 3).WithBlockTime(time.Now()) - req = ocabci.RequestBeginBlock{Header: futCtx.BlockHeader()} + req = abci.RequestBeginBlock{Header: futCtx.BlockHeader()} require.NotPanics(t, func() { s.module.BeginBlock(futCtx, req) }) @@ -203,7 +202,7 @@ func TestCantApplySameUpgradeTwice(t *testing.T) { func TestNoSpuriousUpgrades(t *testing.T) { s := setupTest(10, map[int64]bool{}) t.Log("Verify that no upgrade panic is triggered in the BeginBlocker when we haven't scheduled an upgrade") - req := ocabci.RequestBeginBlock{Header: s.ctx.BlockHeader()} + req := abci.RequestBeginBlock{Header: s.ctx.BlockHeader()} require.NotPanics(t, func() { s.module.BeginBlock(s.ctx, req) }) @@ -262,7 +261,7 @@ func TestSkipUpgradeSkippingAll(t *testing.T) { newCtx := s.ctx - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} err := s.handler(s.ctx, &types.SoftwareUpgradeProposal{Title: "prop", Plan: types.Plan{Name: "test", Height: skipOne}}) require.NoError(t, err) @@ -299,7 +298,7 @@ func TestUpgradeSkippingOne(t *testing.T) { newCtx := s.ctx - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} err := s.handler(s.ctx, &types.SoftwareUpgradeProposal{Title: "prop", Plan: types.Plan{Name: "test", Height: skipOne}}) require.NoError(t, err) @@ -334,7 +333,7 @@ func TestUpgradeSkippingOnlyTwo(t *testing.T) { newCtx := s.ctx - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} err := s.handler(s.ctx, &types.SoftwareUpgradeProposal{Title: "prop", Plan: types.Plan{Name: "test", Height: skipOne}}) require.NoError(t, err) @@ -371,7 +370,7 @@ func TestUpgradeSkippingOnlyTwo(t *testing.T) { func TestUpgradeWithoutSkip(t *testing.T) { s := setupTest(10, map[int64]bool{}) newCtx := s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1).WithBlockTime(time.Now()) - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} err := s.handler(s.ctx, &types.SoftwareUpgradeProposal{Title: "prop", Plan: types.Plan{Name: "test", Height: s.ctx.BlockHeight() + 1}}) require.NoError(t, err) t.Log("Verify if upgrade happens without skip upgrade") @@ -417,20 +416,20 @@ func TestBinaryVersion(t *testing.T) { testCases := []struct { name string - preRun func() (sdk.Context, ocabci.RequestBeginBlock) + preRun func() (sdk.Context, abci.RequestBeginBlock) expectPanic bool }{ { "test not panic: no scheduled upgrade or applied upgrade is present", - func() (sdk.Context, ocabci.RequestBeginBlock) { - req := ocabci.RequestBeginBlock{Header: s.ctx.BlockHeader()} + func() (sdk.Context, abci.RequestBeginBlock) { + req := abci.RequestBeginBlock{Header: s.ctx.BlockHeader()} return s.ctx, req }, false, }, { "test not panic: upgrade handler is present for last applied upgrade", - func() (sdk.Context, ocabci.RequestBeginBlock) { + func() (sdk.Context, abci.RequestBeginBlock) { s.keeper.SetUpgradeHandler("test0", func(_ sdk.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) { return vm, nil }) @@ -444,19 +443,19 @@ func TestBinaryVersion(t *testing.T) { Height: 12, }) - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} return newCtx, req }, false, }, { "test panic: upgrade needed", - func() (sdk.Context, ocabci.RequestBeginBlock) { + func() (sdk.Context, abci.RequestBeginBlock) { err := s.handler(s.ctx, &types.SoftwareUpgradeProposal{Title: "Upgrade test", Plan: types.Plan{Name: "test2", Height: 13}}) require.NoError(t, err) newCtx := s.ctx.WithBlockHeight(13) - req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} return newCtx, req }, true, diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 2b320521a4..3da462e2b8 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -128,6 +127,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock calls the upgrade module hooks // // CONTRACT: this is registered in BeginBlocker *before* all other modules' BeginBlock functions -func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(am.keeper, ctx, req) } diff --git a/x/upgrade/types/storeloader_test.go b/x/upgrade/types/storeloader_test.go index 429baf50c0..da7f8def21 100644 --- a/x/upgrade/types/storeloader_test.go +++ b/x/upgrade/types/storeloader_test.go @@ -7,10 +7,10 @@ import ( "testing" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - ocabci "github.com/Finschia/ostracon/abci/types" "github.com/Finschia/ostracon/libs/log" "github.com/Finschia/finschia-sdk/baseapp" @@ -125,7 +125,7 @@ func TestSetLoader(t *testing.T) { require.Nil(t, err) for i := int64(2); i <= upgradeHeight-1; i++ { - origapp.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) + origapp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: i}}) res := origapp.Commit() require.NotNil(t, res.Data) } @@ -141,7 +141,7 @@ func TestSetLoader(t *testing.T) { require.Nil(t, err) // "execute" one block - app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: upgradeHeight}}) + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: upgradeHeight}}) res := app.Commit() require.NotNil(t, res.Data)