From e09516f4795c637ab12b30bf732ce5d86da78424 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 5 Sep 2022 09:39:12 +0200 Subject: [PATCH] chore: bump tendermint version (#13148) --- Makefile | 6 ++-- baseapp/abci.go | 18 +++++++---- baseapp/abci_test.go | 2 +- baseapp/baseapp.go | 8 ++--- baseapp/baseapp_test.go | 8 ++--- baseapp/deliver_tx_test.go | 12 ++++---- baseapp/params.go | 3 +- baseapp/params_test.go | 11 +++---- codec/proto_codec.go | 2 +- crypto/keys/secp256k1/secp256k1.go | 2 +- go.mod | 9 +++--- go.sum | 22 +++++--------- server/export.go | 14 ++++----- server/rosetta/converter.go | 10 +++--- server/types/app.go | 3 +- store/streaming/file/service_test.go | 16 +++++----- tests/e2e/server/export_test.go | 3 +- tests/integration/bank/keeper/keeper_test.go | 18 +++++------ testutil/sims/app_helpers.go | 4 +-- types/context.go | 8 ++--- types/context_test.go | 2 +- types/events.go | 21 +++---------- types/events_test.go | 32 ++++++++++---------- types/result_test.go | 12 ++++---- x/authz/keeper/keeper.go | 8 ++--- x/bank/keeper/keeper_test.go | 18 +++++------ x/evidence/abci.go | 2 +- x/evidence/types/evidence.go | 2 +- x/evidence/types/evidence_test.go | 4 +-- x/params/types/consensus_params.go | 3 +- x/simulation/mock_tendermint.go | 10 +++--- x/simulation/params.go | 7 ++--- x/slashing/abci_test.go | 6 ++-- x/upgrade/abci.go | 2 +- 34 files changed, 145 insertions(+), 163 deletions(-) diff --git a/Makefile b/Makefile index a0613927c8..c6a605247b 100644 --- a/Makefile +++ b/Makefile @@ -427,7 +427,7 @@ proto-check-breaking: @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main -TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.21/proto/tendermint +TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.37.0-alpha.1/proto/tendermint GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/v1.3.3-alpha.regen.1 COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/v0.3.1 CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/go/v0.7.0 @@ -477,8 +477,8 @@ proto-update-deps: @mkdir -p $(TM_P2P) @curl -sSL $(TM_URL)/p2p/types.proto > $(TM_P2P)/types.proto - @mkdir -p $(CONFIO_TYPES) - @curl -sSL $(CONFIO_URL)/proofs.proto > $(CONFIO_TYPES)/proofs.proto + + ## insert go package option into proofs.proto file ## Issue link: https://github.com/confio/ics23/issues/32 @sed -i '4ioption go_package = "github.com/confio/ics23/go";' $(CONFIO_TYPES)/proofs.proto diff --git a/baseapp/abci.go b/baseapp/abci.go index 924a9f8191..b59c63dbee 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -111,12 +111,6 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC } } -// SetOption implements the ABCI interface. -func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption) { - // TODO: Implement! - return -} - // Info implements the ABCI interface. func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo { lastCommitID := app.cms.LastCommitID() @@ -238,6 +232,18 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc return res } +// ProcessProposal implements the ability for the application to verify and/or modify transactions in a block proposal. +func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePrepareProposal { + // treated as a noop until app side mempool is implemented + return abci.ResponsePrepareProposal{Txs: req.Txs} +} + +// ProcessProposal implements the ability for the application to verify transactions in a block proposal, and decide if they should accept the block or not. +func (app *BaseApp) ProcessProposal(req abci.RequestProcessProposal) abci.ResponseProcessProposal { + // accept all proposed blocks until app side mempool is implemented + return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT} +} + // CheckTx implements the ABCI interface and executes a tx in CheckTx mode. In // CheckTx mode, messages are not executed. This means messages are only validated // and only the AnteHandler is executed. State is persisted to the BaseApp's diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index fd383128c7..7ff313c41a 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -118,7 +118,7 @@ func TestGetBlockRentionHeight(t *testing.T) { tc.bapp.SetParamStore(¶mStore{db: dbm.NewMemDB()}) tc.bapp.InitChain(abci.RequestInitChain{ - ConsensusParams: &abci.ConsensusParams{ + ConsensusParams: &tmproto.ConsensusParams{ Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: tc.maxAgeBlocks, }, diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index cab7aa27e5..dbe20e20dd 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -394,15 +394,15 @@ func (app *BaseApp) setDeliverState(header tmproto.Header) { // GetConsensusParams returns the current consensus parameters from the BaseApp's // ParamStore. If the BaseApp has no ParamStore defined, nil is returned. -func (app *BaseApp) GetConsensusParams(ctx sdk.Context) *abci.ConsensusParams { +func (app *BaseApp) GetConsensusParams(ctx sdk.Context) *tmproto.ConsensusParams { if app.paramStore == nil { return nil } - cp := new(abci.ConsensusParams) + cp := new(tmproto.ConsensusParams) if app.paramStore.Has(ctx, ParamStoreKeyBlockParams) { - var bp abci.BlockParams + var bp tmproto.BlockParams app.paramStore.Get(ctx, ParamStoreKeyBlockParams, &bp) cp.Block = &bp @@ -433,7 +433,7 @@ func (app *BaseApp) AddRunTxRecoveryHandler(handlers ...RecoveryHandler) { } // StoreConsensusParams sets the consensus parameters to the baseapp's param store. -func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp *abci.ConsensusParams) { +func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp *tmproto.ConsensusParams) { if app.paramStore == nil { panic("cannot store consensus params with no params store set") } diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index e60394d5e2..697841e1a8 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -30,16 +30,16 @@ func TestGetMaximumBlockGas(t *testing.T) { app.InitChain(abci.RequestInitChain{}) ctx := app.NewContext(true, tmproto.Header{}) - app.StoreConsensusParams(ctx, &abci.ConsensusParams{Block: &abci.BlockParams{MaxGas: 0}}) + app.StoreConsensusParams(ctx, &tmproto.ConsensusParams{Block: &tmproto.BlockParams{MaxGas: 0}}) require.Equal(t, uint64(0), app.getMaximumBlockGas(ctx)) - app.StoreConsensusParams(ctx, &abci.ConsensusParams{Block: &abci.BlockParams{MaxGas: -1}}) + app.StoreConsensusParams(ctx, &tmproto.ConsensusParams{Block: &tmproto.BlockParams{MaxGas: -1}}) require.Equal(t, uint64(0), app.getMaximumBlockGas(ctx)) - app.StoreConsensusParams(ctx, &abci.ConsensusParams{Block: &abci.BlockParams{MaxGas: 5000000}}) + app.StoreConsensusParams(ctx, &tmproto.ConsensusParams{Block: &tmproto.BlockParams{MaxGas: 5000000}}) require.Equal(t, uint64(5000000), app.getMaximumBlockGas(ctx)) - app.StoreConsensusParams(ctx, &abci.ConsensusParams{Block: &abci.BlockParams{MaxGas: -5000000}}) + app.StoreConsensusParams(ctx, &tmproto.ConsensusParams{Block: &tmproto.BlockParams{MaxGas: -5000000}}) require.Panics(t, func() { app.getMaximumBlockGas(ctx) }) } diff --git a/baseapp/deliver_tx_test.go b/baseapp/deliver_tx_test.go index 601a5b642a..8cac0b94c4 100644 --- a/baseapp/deliver_tx_test.go +++ b/baseapp/deliver_tx_test.go @@ -959,8 +959,8 @@ func TestBaseApp_EndBlock(t *testing.T) { name := t.Name() logger := defaultLogger() - cp := &abci.ConsensusParams{ - Block: &abci.BlockParams{ + cp := &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxGas: 5000000, }, } @@ -1565,8 +1565,8 @@ func TestMaxBlockGasLimits(t *testing.T) { app.SetParamStore(¶mStore{db: dbm.NewMemDB()}) app.InitChain(abci.RequestInitChain{ - ConsensusParams: &abci.ConsensusParams{ - Block: &abci.BlockParams{ + ConsensusParams: &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxGas: 100, }, }, @@ -1824,8 +1824,8 @@ func TestGasConsumptionBadTx(t *testing.T) { app.SetParamStore(¶mStore{db: dbm.NewMemDB()}) app.InitChain(abci.RequestInitChain{ - ConsensusParams: &abci.ConsensusParams{ - Block: &abci.BlockParams{ + ConsensusParams: &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxGas: 9, }, }, diff --git a/baseapp/params.go b/baseapp/params.go index 14701d5247..5cf31125b0 100644 --- a/baseapp/params.go +++ b/baseapp/params.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" - abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -31,7 +30,7 @@ type ParamStore interface { // ValidateBlockParams defines a stateless validation on BlockParams. This function // is called whenever the parameters are updated or stored. func ValidateBlockParams(i interface{}) error { - v, ok := i.(abci.BlockParams) + v, ok := i.(tmproto.BlockParams) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/baseapp/params_test.go b/baseapp/params_test.go index 6507e17a8a..3f9d26a56f 100644 --- a/baseapp/params_test.go +++ b/baseapp/params_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -16,11 +15,11 @@ func TestValidateBlockParams(t *testing.T) { expectErr bool }{ {nil, true}, - {&abci.BlockParams{}, true}, - {abci.BlockParams{}, true}, - {abci.BlockParams{MaxBytes: -1, MaxGas: -1}, true}, - {abci.BlockParams{MaxBytes: 2000000, MaxGas: -5}, true}, - {abci.BlockParams{MaxBytes: 2000000, MaxGas: 300000}, false}, + {&tmproto.BlockParams{}, true}, + {tmproto.BlockParams{}, true}, + {tmproto.BlockParams{MaxBytes: -1, MaxGas: -1}, true}, + {tmproto.BlockParams{MaxBytes: 2000000, MaxGas: -5}, true}, + {tmproto.BlockParams{MaxBytes: 2000000, MaxGas: 300000}, false}, } for _, tc := range testCases { diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 5225bd08d4..dc96d21fbc 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - legacyproto "github.com/golang/protobuf/proto" //nolint:staticcheck // we're aware this is deprecated and using it anyhow. + legacyproto "github.com/golang/protobuf/proto" //nolint:staticcheck "google.golang.org/grpc/encoding" "google.golang.org/protobuf/proto" diff --git a/crypto/keys/secp256k1/secp256k1.go b/crypto/keys/secp256k1/secp256k1.go index 9ec713acbe..98bb17c247 100644 --- a/crypto/keys/secp256k1/secp256k1.go +++ b/crypto/keys/secp256k1/secp256k1.go @@ -10,7 +10,7 @@ import ( secp256k1 "github.com/btcsuite/btcd/btcec" "github.com/tendermint/tendermint/crypto" - "golang.org/x/crypto/ripemd160" //nolint: staticcheck // necessary for Bitcoin address format + "golang.org/x/crypto/ripemd160" //nolint: staticcheck "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" diff --git a/go.mod b/go.mod index 2c437b0c18..468f7b04ef 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/tendermint/btcd v0.1.1 github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/go-amino v0.16.0 - github.com/tendermint/tendermint v0.34.21 + github.com/tendermint/tendermint v0.37.0-alpha.1 github.com/tendermint/tm-db v0.6.7 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e @@ -81,7 +81,6 @@ require ( github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/OpenPeeDeeP/depguard v1.1.0 // indirect - github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.3.0 // indirect @@ -198,7 +197,7 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.2.3 // indirect - github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect + github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect @@ -224,12 +223,12 @@ require ( github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rs/cors v1.8.2 // indirect github.com/ryancurrah/gomodguard v1.2.4 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect - github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect + github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.13.0 // indirect github.com/securego/gosec/v2 v2.13.1 // indirect diff --git a/go.sum b/go.sum index 7bd03da8ce..54c131ef92 100644 --- a/go.sum +++ b/go.sum @@ -103,8 +103,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= -github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= @@ -746,8 +744,9 @@ github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aks github.com/mgechev/revive v1.2.3 h1:NzIEEa9+WimQ6q2Ov7OcNeySS/IOcwtkQ8RAh0R5UJ4= github.com/mgechev/revive v1.2.3/go.mod h1:iAWlQishqCuj4yhV24FTnKSXGpbAA+0SckXB8GQMX/Q= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= +github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -848,7 +847,6 @@ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -916,8 +914,8 @@ github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8 github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= @@ -946,8 +944,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= +github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.13.0 h1:uObNudVEEHf6JbOJy5bgKJloA1bWjxR9fwgNFpPzKnI= @@ -1039,8 +1037,8 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RM github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.21 h1:UiGGnBFHVrZhoQVQ7EfwSOLuCtarqCSsRf8VrklqB7s= -github.com/tendermint/tendermint v0.34.21/go.mod h1:XDvfg6U7grcFTDx7VkzxnhazQ/bspGJAn4DZ6DcLLjQ= +github.com/tendermint/tendermint v0.37.0-alpha.1 h1:sE/jlVRBX00nsyH/Kroya17BR0RkBvWCZDzz1qzW7gU= +github.com/tendermint/tendermint v0.37.0-alpha.1/go.mod h1:f8Nk7ZdkIYqle2nzjkOib4XNlwXcSCoHvcG969xRuOs= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -1053,13 +1051,11 @@ github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDH github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/timonwong/logrlint v0.1.0 h1:phZCcypL/vtx6cGxObJgWZ5wexZF5SXFPLOM+ru0e/M= github.com/timonwong/logrlint v0.1.0/go.mod h1:Zleg4Gw+kRxNej+Ra7o+tEaW5k1qthTaYKU7rSD39LU= -github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomarrell/wrapcheck/v2 v2.6.2 h1:3dI6YNcrJTQ/CJQ6M/DUkc0gnqYSIk6o0rChn9E/D0M= github.com/tomarrell/wrapcheck/v2 v2.6.2/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= @@ -1468,7 +1464,6 @@ golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1719,7 +1714,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/server/export.go b/server/export.go index 1ae4f1c723..a50501284d 100644 --- a/server/export.go +++ b/server/export.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/cobra" tmjson "github.com/tendermint/tendermint/libs/json" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/client/flags" @@ -80,18 +79,17 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com doc.AppState = exported.AppState doc.Validators = exported.Validators doc.InitialHeight = exported.Height - doc.ConsensusParams = &tmproto.ConsensusParams{ - Block: tmproto.BlockParams{ - MaxBytes: exported.ConsensusParams.Block.MaxBytes, - MaxGas: exported.ConsensusParams.Block.MaxGas, - TimeIotaMs: doc.ConsensusParams.Block.TimeIotaMs, + doc.ConsensusParams = &tmtypes.ConsensusParams{ + Block: tmtypes.BlockParams{ + MaxBytes: exported.ConsensusParams.Block.MaxBytes, + MaxGas: exported.ConsensusParams.Block.MaxGas, }, - Evidence: tmproto.EvidenceParams{ + Evidence: tmtypes.EvidenceParams{ MaxAgeNumBlocks: exported.ConsensusParams.Evidence.MaxAgeNumBlocks, MaxAgeDuration: exported.ConsensusParams.Evidence.MaxAgeDuration, MaxBytes: exported.ConsensusParams.Evidence.MaxBytes, }, - Validator: tmproto.ValidatorParams{ + Validator: tmtypes.ValidatorParams{ PubKeyTypes: exported.ConsensusParams.Validator.PubKeyTypes, }, } diff --git a/server/rosetta/converter.go b/server/rosetta/converter.go index 7e0e27376a..d2d331a175 100644 --- a/server/rosetta/converter.go +++ b/server/rosetta/converter.go @@ -338,8 +338,8 @@ func sdkEventToBalanceOperations(status string, event abci.Event) (operations [] default: return nil, false case banktypes.EventTypeCoinSpent: - spender := sdk.MustAccAddressFromBech32(string(event.Attributes[0].Value)) - coins, err := sdk.ParseCoinsNormalized(string(event.Attributes[1].Value)) + spender := sdk.MustAccAddressFromBech32(event.Attributes[0].Value) + coins, err := sdk.ParseCoinsNormalized(event.Attributes[1].Value) if err != nil { panic(err) } @@ -349,8 +349,8 @@ func sdkEventToBalanceOperations(status string, event abci.Event) (operations [] accountIdentifier = spender.String() case banktypes.EventTypeCoinReceived: - receiver := sdk.MustAccAddressFromBech32(string(event.Attributes[0].Value)) - coins, err := sdk.ParseCoinsNormalized(string(event.Attributes[1].Value)) + receiver := sdk.MustAccAddressFromBech32(event.Attributes[0].Value) + coins, err := sdk.ParseCoinsNormalized(event.Attributes[1].Value) if err != nil { panic(err) } @@ -362,7 +362,7 @@ func sdkEventToBalanceOperations(status string, event abci.Event) (operations [] // rosetta does not have the concept of burning coins, so we need to mock // the burn as a send to an address that cannot be resolved to anything case banktypes.EventTypeCoinBurn: - coins, err := sdk.ParseCoinsNormalized(string(event.Attributes[1].Value)) + coins, err := sdk.ParseCoinsNormalized(event.Attributes[1].Value) if err != nil { panic(err) } diff --git a/server/types/app.go b/server/types/app.go index 69cc0476f0..b6474d97e9 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" @@ -74,7 +75,7 @@ type ( // Height is the app's latest block height. Height int64 // ConsensusParams are the exported consensus params for ABCI. - ConsensusParams *abci.ConsensusParams + ConsensusParams *tmproto.ConsensusParams } // AppExporter is a function that dumps all app state to diff --git a/store/streaming/file/service_test.go b/store/streaming/file/service_test.go index 52f477ed6a..5960403a26 100644 --- a/store/streaming/file/service_test.go +++ b/store/streaming/file/service_test.go @@ -8,14 +8,14 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" codecTypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - types1 "github.com/tendermint/tendermint/proto/tendermint/types" ) var ( @@ -28,12 +28,12 @@ var ( // test abci message types mockHash = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9} testBeginBlockReq = abci.RequestBeginBlock{ - Header: types1.Header{ + Header: tmproto.Header{ Height: 1, }, - ByzantineValidators: []abci.Evidence{}, + ByzantineValidators: []abci.Misbehavior{}, Hash: mockHash, - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Round: 1, Votes: []abci.VoteInfo{}, }, @@ -53,7 +53,7 @@ var ( } testEndBlockRes = abci.ResponseEndBlock{ Events: []abci.Event{}, - ConsensusParamUpdates: &abci.ConsensusParams{}, + ConsensusParamUpdates: &tmproto.ConsensusParams{}, ValidatorUpdates: []abci.ValidatorUpdate{}, } mockTxBytes1 = []byte{9, 8, 7, 6, 5, 4, 3, 2, 1} diff --git a/tests/e2e/server/export_test.go b/tests/e2e/server/export_test.go index dc9e8e763e..0238ddd8f5 100644 --- a/tests/e2e/server/export_test.go +++ b/tests/e2e/server/export_test.go @@ -35,7 +35,7 @@ import ( func TestExportCmd_ConsensusParams(t *testing.T) { tempDir := t.TempDir() - _, ctx, genDoc, cmd := setupApp(t, tempDir) + _, ctx, _, cmd := setupApp(t, tempDir) output := &bytes.Buffer{} cmd.SetOut(output) @@ -50,7 +50,6 @@ func TestExportCmd_ConsensusParams(t *testing.T) { require.Equal(t, simtestutil.DefaultConsensusParams.Block.MaxBytes, exportedGenDoc.ConsensusParams.Block.MaxBytes) require.Equal(t, simtestutil.DefaultConsensusParams.Block.MaxGas, exportedGenDoc.ConsensusParams.Block.MaxGas) - require.Equal(t, genDoc.ConsensusParams.Block.TimeIotaMs, exportedGenDoc.ConsensusParams.Block.TimeIotaMs) require.Equal(t, simtestutil.DefaultConsensusParams.Evidence.MaxAgeDuration, exportedGenDoc.ConsensusParams.Evidence.MaxAgeDuration) require.Equal(t, simtestutil.DefaultConsensusParams.Evidence.MaxAgeNumBlocks, exportedGenDoc.ConsensusParams.Evidence.MaxAgeNumBlocks) diff --git a/tests/integration/bank/keeper/keeper_test.go b/tests/integration/bank/keeper/keeper_test.go index c76dc17070..24413331d2 100644 --- a/tests/integration/bank/keeper/keeper_test.go +++ b/tests/integration/bank/keeper/keeper_test.go @@ -602,15 +602,15 @@ func (suite *IntegrationTestSuite) TestMsgSendEvents() { } event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeyRecipient), Value: []byte(addr2.String())}, + abci.EventAttribute{Key: types.AttributeKeyRecipient, Value: addr2.String()}, ) event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeySender), Value: []byte(addr.String())}, + abci.EventAttribute{Key: types.AttributeKeySender, Value: addr.String()}, ) event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())}, + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}, ) event2 := sdk.Event{ @@ -619,7 +619,7 @@ func (suite *IntegrationTestSuite) TestMsgSendEvents() { } event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeySender), Value: []byte(addr.String())}, + abci.EventAttribute{Key: types.AttributeKeySender, Value: addr.String()}, ) // events are shifted due to the funding account events @@ -676,7 +676,7 @@ func (suite *IntegrationTestSuite) TestMsgMultiSendEvents() { } event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeySender), Value: []byte(addr.String())}, + abci.EventAttribute{Key: types.AttributeKeySender, Value: addr.String()}, ) suite.Require().Equal(abci.Event(event1), events[7]) @@ -698,22 +698,22 @@ func (suite *IntegrationTestSuite) TestMsgMultiSendEvents() { } event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeyRecipient), Value: []byte(addr3.String())}, + abci.EventAttribute{Key: types.AttributeKeyRecipient, Value: addr3.String()}, ) event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())}) + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}) event3 := sdk.Event{ Type: types.EventTypeTransfer, Attributes: []abci.EventAttribute{}, } event3.Attributes = append( event3.Attributes, - abci.EventAttribute{Key: []byte(types.AttributeKeyRecipient), Value: []byte(addr4.String())}, + abci.EventAttribute{Key: types.AttributeKeyRecipient, Value: addr4.String()}, ) event3.Attributes = append( event3.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins2.String())}, + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins2.String()}, ) // events are shifted due to the funding account events suite.Require().Equal(abci.Event(event1), events[25]) diff --git a/testutil/sims/app_helpers.go b/testutil/sims/app_helpers.go index 5db49d1e87..fb030e49f8 100644 --- a/testutil/sims/app_helpers.go +++ b/testutil/sims/app_helpers.go @@ -36,8 +36,8 @@ const ( // DefaultConsensusParams defines the default Tendermint consensus params used in // SimApp testing. -var DefaultConsensusParams = &abci.ConsensusParams{ - Block: &abci.BlockParams{ +var DefaultConsensusParams = &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, diff --git a/types/context.go b/types/context.go index 8a050a1b08..56765bb732 100644 --- a/types/context.go +++ b/types/context.go @@ -36,7 +36,7 @@ type Context struct { checkTx bool recheckTx bool // if recheckTx == true, then checkTx must also be true minGasPrice DecCoins - consParams *abci.ConsensusParams + consParams *tmproto.ConsensusParams eventManager *EventManager priority int64 // The tx priority, only relevant in CheckTx } @@ -74,8 +74,8 @@ func (c Context) HeaderHash() tmbytes.HexBytes { return hash } -func (c Context) ConsensusParams() *abci.ConsensusParams { - return proto.Clone(c.consParams).(*abci.ConsensusParams) +func (c Context) ConsensusParams() *tmproto.ConsensusParams { + return proto.Clone(c.consParams).(*tmproto.ConsensusParams) } func (c Context) Deadline() (deadline time.Time, ok bool) { @@ -217,7 +217,7 @@ func (c Context) WithMinGasPrices(gasPrices DecCoins) Context { } // WithConsensusParams returns a Context with an updated consensus params -func (c Context) WithConsensusParams(params *abci.ConsensusParams) Context { +func (c Context) WithConsensusParams(params *tmproto.ConsensusParams) Context { c.consParams = params return c } diff --git a/types/context_test.go b/types/context_test.go index f5c7cadeb5..b84276e9ad 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -132,7 +132,7 @@ func (s *contextTestSuite) TestContextWithCustom() { // test consensus param s.Require().Nil(ctx.ConsensusParams()) - cp := &abci.ConsensusParams{} + cp := &tmproto.ConsensusParams{} s.Require().Equal(cp, ctx.WithConsensusParams(cp).ConsensusParams()) // test inner context diff --git a/types/events.go b/types/events.go index b7ce9868ec..9fee6b3b4c 100644 --- a/types/events.go +++ b/types/events.go @@ -98,8 +98,8 @@ func TypedEventToEvent(tev proto.Message) (Event, error) { for _, k := range keys { v := attrMap[k] attrs = append(attrs, abci.EventAttribute{ - Key: []byte(k), - Value: v, + Key: k, + Value: string(v), }) } @@ -130,7 +130,7 @@ func ParseTypedEvent(event abci.Event) (proto.Message, error) { attrMap := make(map[string]json.RawMessage) for _, attr := range event.Attributes { - attrMap[string(attr.Key)] = json.RawMessage(attr.Value) + attrMap[attr.Key] = json.RawMessage(attr.Value) } attrBytes, err := json.Marshal(attrMap) @@ -186,18 +186,7 @@ func (a Attribute) String() string { // ToKVPair converts an Attribute object into a Tendermint key/value pair. func (a Attribute) ToKVPair() abci.EventAttribute { - return abci.EventAttribute{Key: toBytes(a.Key), Value: toBytes(a.Value)} -} - -func toBytes(i interface{}) []byte { - switch x := i.(type) { - case []uint8: - return x - case string: - return []byte(x) - default: - panic(i) - } + return abci.EventAttribute{Key: a.Key, Value: a.Value} } // AppendAttributes adds one or more attributes to an Event. @@ -295,7 +284,7 @@ func StringifyEvent(e abci.Event) StringEvent { for _, attr := range e.Attributes { res.Attributes = append( res.Attributes, - Attribute{Key: string(attr.Key), Value: string(attr.Value)}, + Attribute{Key: attr.Key, Value: attr.Value}, ) } diff --git a/types/events_test.go b/types/events_test.go index 8565a14be0..f95f8a1612 100644 --- a/types/events_test.go +++ b/types/events_test.go @@ -158,15 +158,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() { { Type: "message", Attributes: []abci.EventAttribute{ - {Key: []byte("sender"), Value: []byte("foo")}, - {Key: []byte("recipient"), Value: []byte("bar")}, + {Key: "sender", Value: "foo"}, + {Key: "recipient", Value: "bar"}, }, }, { Type: "staking", Attributes: []abci.EventAttribute{ - {Key: []byte("deposit"), Value: []byte("5")}, - {Key: []byte("unbond"), Value: []byte("10")}, + {Key: "deposit", Value: "5"}, + {Key: "unbond", Value: "10"}, }, }, } @@ -182,15 +182,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() { { Type: "message", Attributes: []abci.EventAttribute{ - {Key: []byte("sender"), Value: []byte("foo"), Index: true}, - {Key: []byte("recipient"), Value: []byte("bar"), Index: true}, + {Key: "sender", Value: "foo", Index: true}, + {Key: "recipient", Value: "bar", Index: true}, }, }, { Type: "staking", Attributes: []abci.EventAttribute{ - {Key: []byte("deposit"), Value: []byte("5"), Index: true}, - {Key: []byte("unbond"), Value: []byte("10"), Index: true}, + {Key: "deposit", Value: "5", Index: true}, + {Key: "unbond", Value: "10", Index: true}, }, }, }, @@ -202,15 +202,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() { { Type: "message", Attributes: []abci.EventAttribute{ - {Key: []byte("sender"), Value: []byte("foo"), Index: true}, - {Key: []byte("recipient"), Value: []byte("bar")}, + {Key: "sender", Value: "foo", Index: true}, + {Key: "recipient", Value: "bar"}, }, }, { Type: "staking", Attributes: []abci.EventAttribute{ - {Key: []byte("deposit"), Value: []byte("5"), Index: true}, - {Key: []byte("unbond"), Value: []byte("10")}, + {Key: "deposit", Value: "5", Index: true}, + {Key: "unbond", Value: "10"}, }, }, }, @@ -225,15 +225,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() { { Type: "message", Attributes: []abci.EventAttribute{ - {Key: []byte("sender"), Value: []byte("foo"), Index: true}, - {Key: []byte("recipient"), Value: []byte("bar"), Index: true}, + {Key: "sender", Value: "foo", Index: true}, + {Key: "recipient", Value: "bar", Index: true}, }, }, { Type: "staking", Attributes: []abci.EventAttribute{ - {Key: []byte("deposit"), Value: []byte("5"), Index: true}, - {Key: []byte("unbond"), Value: []byte("10"), Index: true}, + {Key: "deposit", Value: "5", Index: true}, + {Key: "unbond", Value: "10", Index: true}, }, }, }, diff --git a/types/result_test.go b/types/result_test.go index a7ef4ef06a..5c58313b11 100644 --- a/types/result_test.go +++ b/types/result_test.go @@ -159,8 +159,8 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() { Type: "message", Attributes: []abci.EventAttribute{ { - Key: []byte("action"), - Value: []byte("foo"), + Key: "action", + Value: "foo", Index: true, }, }, @@ -184,8 +184,8 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() { Type: "message", Attributes: []abci.EventAttribute{ { - Key: []byte("action"), - Value: []byte("foo"), + Key: "action", + Value: "foo", Index: true, }, }, @@ -209,8 +209,8 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() { Type: "message", Attributes: []abci.EventAttribute{ { - Key: []byte("action"), - Value: []byte("foo"), + Key: "action", + Value: "foo", Index: true, }, }, diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index a5a5a5e7af..7e1b6c790b 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -149,7 +149,7 @@ func (k Keeper) DispatchActions(ctx sdk.Context, grantee sdk.AccAddress, msgs [] sdkEvents := make([]sdk.Event, 0, len(events)) for _, event := range events { e := event - e.Attributes = append(e.Attributes, abci.EventAttribute{Key: []byte("authz_msg_index"), Value: []byte(strconv.Itoa(i))}) + e.Attributes = append(e.Attributes, abci.EventAttribute{Key: "authz_msg_index", Value: strconv.Itoa(i)}) sdkEvents = append(sdkEvents, sdk.Event(e)) } @@ -252,9 +252,9 @@ func (k Keeper) GetAuthorizations(ctx sdk.Context, grantee sdk.AccAddress, grant // GetAuthorization returns an Authorization and it's expiration time. // A nil Authorization is returned under the following circumstances: -// - No grant is found. -// - A grant is found, but it is expired. -// - There was an error getting the authorization from the grant. +// - No grant is found. +// - A grant is found, but it is expired. +// - There was an error getting the authorization from the grant. func (k Keeper) GetAuthorization(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (authz.Authorization, *time.Time) { grant, found := k.getGrant(ctx, grantStoreKey(grantee, granter, msgType)) if !found || (grant.Expiration != nil && grant.Expiration.Before(ctx.BlockHeader().Time)) { diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index d492f1ae9d..090f794561 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -643,15 +643,15 @@ func (suite *KeeperTestSuite) TestMsgSendEvents() { } event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeyRecipient), Value: []byte(accAddrs[1].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeyRecipient, Value: accAddrs[1].String()}, ) event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeySender), Value: []byte(accAddrs[0].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeySender, Value: accAddrs[0].String()}, ) event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())}, + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}, ) event2 := sdk.Event{ @@ -660,7 +660,7 @@ func (suite *KeeperTestSuite) TestMsgSendEvents() { } event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeySender), Value: []byte(accAddrs[0].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeySender, Value: accAddrs[0].String()}, ) // events are shifted due to the funding account events @@ -713,7 +713,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { } event1.Attributes = append( event1.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeySender), Value: []byte(accAddrs[0].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeySender, Value: accAddrs[0].String()}, ) require.Equal(abci.Event(event1), events[7]) @@ -738,22 +738,22 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { } event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeyRecipient), Value: []byte(accAddrs[2].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeyRecipient, Value: accAddrs[2].String()}, ) event2.Attributes = append( event2.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())}) + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}) event3 := sdk.Event{ Type: banktypes.EventTypeTransfer, Attributes: []abci.EventAttribute{}, } event3.Attributes = append( event3.Attributes, - abci.EventAttribute{Key: []byte(banktypes.AttributeKeyRecipient), Value: []byte(accAddrs[3].String())}, + abci.EventAttribute{Key: banktypes.AttributeKeyRecipient, Value: accAddrs[3].String()}, ) event3.Attributes = append( event3.Attributes, - abci.EventAttribute{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins2.String())}, + abci.EventAttribute{Key: sdk.AttributeKeyAmount, Value: newCoins2.String()}, ) // events are shifted due to the funding account events require.Equal(abci.Event(event1), events[25]) diff --git a/x/evidence/abci.go b/x/evidence/abci.go index 63866fd2bc..6812de29c1 100644 --- a/x/evidence/abci.go +++ b/x/evidence/abci.go @@ -21,7 +21,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) switch tmEvidence.Type { // It's still ongoing discussion how should we treat and slash attacks with // premeditation. So for now we agree to treat them in the same way. - case abci.EvidenceType_DUPLICATE_VOTE, abci.EvidenceType_LIGHT_CLIENT_ATTACK: + case abci.MisbehaviorType_DUPLICATE_VOTE, abci.MisbehaviorType_LIGHT_CLIENT_ATTACK: evidence := types.FromABCIEvidence(tmEvidence) k.HandleEquivocationEvidence(ctx, evidence.(*types.Equivocation)) diff --git a/x/evidence/types/evidence.go b/x/evidence/types/evidence.go index 70b992a9ff..cdcb984f8c 100644 --- a/x/evidence/types/evidence.go +++ b/x/evidence/types/evidence.go @@ -87,7 +87,7 @@ func (e Equivocation) GetTotalPower() int64 { return 0 } // FromABCIEvidence converts a Tendermint concrete Evidence type to // SDK Evidence using Equivocation as the concrete type. -func FromABCIEvidence(e abci.Evidence) exported.Evidence { +func FromABCIEvidence(e abci.Misbehavior) exported.Evidence { bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() consAddr, err := sdk.Bech32ifyAddressBytes(bech32PrefixConsAddr, e.Validator.Address) if err != nil { diff --git a/x/evidence/types/evidence_test.go b/x/evidence/types/evidence_test.go index 46b88a115b..4ac2cd34b7 100644 --- a/x/evidence/types/evidence_test.go +++ b/x/evidence/types/evidence_test.go @@ -72,8 +72,8 @@ func TestEquivocationValidateBasic(t *testing.T) { func TestEvidenceAddressConversion(t *testing.T) { sdk.GetConfig().SetBech32PrefixForConsensusNode("testcnclcons", "testcnclconspub") - tmEvidence := abci.Evidence{ - Type: abci.EvidenceType_DUPLICATE_VOTE, + tmEvidence := abci.Misbehavior{ + Type: abci.MisbehaviorType_DUPLICATE_VOTE, Validator: abci.Validator{ Address: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Power: 100, diff --git a/x/params/types/consensus_params.go b/x/params/types/consensus_params.go index fe27f7e8d9..4c7edb5620 100644 --- a/x/params/types/consensus_params.go +++ b/x/params/types/consensus_params.go @@ -1,7 +1,6 @@ package types import ( - abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -15,7 +14,7 @@ import ( func ConsensusParamsKeyTable() KeyTable { return NewKeyTable( NewParamSetPair( - baseapp.ParamStoreKeyBlockParams, abci.BlockParams{}, baseapp.ValidateBlockParams, + baseapp.ParamStoreKeyBlockParams, tmproto.BlockParams{}, baseapp.ValidateBlockParams, ), NewParamSetPair( baseapp.ParamStoreKeyEvidenceParams, tmproto.EvidenceParams{}, baseapp.ValidateEvidenceParams, diff --git a/x/simulation/mock_tendermint.go b/x/simulation/mock_tendermint.go index 7d7f1dc997..6c7c5e7481 100644 --- a/x/simulation/mock_tendermint.go +++ b/x/simulation/mock_tendermint.go @@ -166,14 +166,14 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, if len(pastTimes) == 0 { return abci.RequestBeginBlock{ Header: header, - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Votes: voteInfos, }, } } // TODO: Determine capacity before allocation - evidence := make([]abci.Evidence, 0) + evidence := make([]abci.Misbehavior, 0) for r.Float64() < params.EvidenceFraction() { height := header.Height @@ -195,8 +195,8 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, } evidence = append(evidence, - abci.Evidence{ - Type: abci.EvidenceType_DUPLICATE_VOTE, + abci.Misbehavior{ + Type: abci.MisbehaviorType_DUPLICATE_VOTE, Validator: validator, Height: height, Time: time, @@ -209,7 +209,7 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params, return abci.RequestBeginBlock{ Header: header, - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Votes: voteInfos, }, ByzantineValidators: evidence, diff --git a/x/simulation/params.go b/x/simulation/params.go index 51dfb6439f..acc7d9b6d8 100644 --- a/x/simulation/params.go +++ b/x/simulation/params.go @@ -5,7 +5,6 @@ import ( "fmt" "math/rand" - abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" @@ -151,7 +150,7 @@ func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulato // Param change proposals // randomConsensusParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state. -func randomConsensusParams(r *rand.Rand, appState json.RawMessage, cdc codec.JSONCodec) *abci.ConsensusParams { +func randomConsensusParams(r *rand.Rand, appState json.RawMessage, cdc codec.JSONCodec) *tmproto.ConsensusParams { var genesisState map[string]json.RawMessage err := json.Unmarshal(appState, &genesisState) if err != nil { @@ -159,8 +158,8 @@ func randomConsensusParams(r *rand.Rand, appState json.RawMessage, cdc codec.JSO } stakingGenesisState := stakingtypes.GetGenesisStateFromAppState(cdc, genesisState) - consensusParams := &abci.ConsensusParams{ - Block: &abci.BlockParams{ + consensusParams := &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxBytes: int64(simulation.RandIntBetween(r, 20000000, 30000000)), MaxGas: -1, }, diff --git a/x/slashing/abci_test.go b/x/slashing/abci_test.go index 3b83c8d8c2..6add22132f 100644 --- a/x/slashing/abci_test.go +++ b/x/slashing/abci_test.go @@ -60,7 +60,7 @@ func TestBeginBlocker(t *testing.T) { // mark the validator as having signed req := abci.RequestBeginBlock{ - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, SignedLastBlock: true, @@ -83,7 +83,7 @@ func TestBeginBlocker(t *testing.T) { for ; height < slashingKeeper.SignedBlocksWindow(ctx); height++ { ctx = ctx.WithBlockHeight(height) req = abci.RequestBeginBlock{ - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, SignedLastBlock: true, @@ -98,7 +98,7 @@ func TestBeginBlocker(t *testing.T) { for ; height < ((slashingKeeper.SignedBlocksWindow(ctx) * 2) - slashingKeeper.MinSignedPerWindow(ctx) + 1); height++ { ctx = ctx.WithBlockHeight(height) req = abci.RequestBeginBlock{ - LastCommitInfo: abci.LastCommitInfo{ + LastCommitInfo: abci.CommitInfo{ Votes: []abci.VoteInfo{{ Validator: val, SignedLastBlock: false, diff --git a/x/upgrade/abci.go b/x/upgrade/abci.go index f021475142..91795b9f70 100644 --- a/x/upgrade/abci.go +++ b/x/upgrade/abci.go @@ -85,7 +85,7 @@ func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) { cp := ctx.ConsensusParams() if cp != nil && cp.Version != nil { - appVersion = cp.Version.AppVersion + appVersion = cp.Version.App } panic(fmt.Sprintf("Wrong app version %d, upgrade handler is missing for %s upgrade plan", appVersion, lastAppliedPlan))