diff --git a/baseapp/abci.go b/baseapp/abci.go index dd1ceb5a1f..a255e60f7c 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc/codes" grpcstatus "google.golang.org/grpc/status" + corecomet "cosmossdk.io/core/comet" coreheader "cosmossdk.io/core/header" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/rootmulti" @@ -428,7 +429,12 @@ func (app *BaseApp) PrepareProposal(req *abci.RequestPrepareProposal) (resp *abc WithBlockTime(req.Time). WithProposer(req.ProposerAddress). WithExecMode(sdk.ExecModePrepareProposal). - WithCometInfo(prepareProposalInfo{req}). + WithCometInfo(corecomet.Info{ + Evidence: sdk.ToSDKEvidence(req.Misbehavior), + ValidatorsHash: req.NextValidatorsHash, + ProposerAddress: req.ProposerAddress, + LastCommit: sdk.ToSDKExtendedCommitInfo(req.LocalLastCommit), + }). WithHeaderInfo(coreheader.Info{ ChainID: app.chainID, Height: req.Height, @@ -514,7 +520,13 @@ func (app *BaseApp) ProcessProposal(req *abci.RequestProcessProposal) (resp *abc WithBlockTime(req.Time). WithHeaderHash(req.Hash). WithProposer(req.ProposerAddress). - WithCometInfo(cometInfo{ProposerAddress: req.ProposerAddress, ValidatorsHash: req.NextValidatorsHash, Misbehavior: req.Misbehavior, LastCommit: req.ProposedLastCommit}). + WithCometInfo(corecomet.Info{ + ProposerAddress: req.ProposerAddress, + ValidatorsHash: req.NextValidatorsHash, + Evidence: sdk.ToSDKEvidence(req.Misbehavior), + LastCommit: sdk.ToSDKCommitInfo(req.ProposedLastCommit), + }, + ). WithExecMode(sdk.ExecModeProcessProposal). WithHeaderInfo(coreheader.Info{ ChainID: app.chainID, @@ -713,11 +725,11 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons WithConsensusParams(app.GetConsensusParams(app.finalizeBlockState.ctx)). WithVoteInfos(req.DecidedLastCommit.Votes). WithExecMode(sdk.ExecModeFinalize). - WithCometInfo(cometInfo{ - Misbehavior: req.Misbehavior, + WithCometInfo(corecomet.Info{ + Evidence: sdk.ToSDKEvidence(req.Misbehavior), ValidatorsHash: req.NextValidatorsHash, ProposerAddress: req.ProposerAddress, - LastCommit: req.DecidedLastCommit, + LastCommit: sdk.ToSDKCommitInfo(req.DecidedLastCommit), }) // GasMeter must be set after we get a context with updated consensus params. diff --git a/baseapp/info.go b/baseapp/info.go deleted file mode 100644 index 8c8a445120..0000000000 --- a/baseapp/info.go +++ /dev/null @@ -1,197 +0,0 @@ -package baseapp - -import ( - "time" - - abci "github.com/cometbft/cometbft/abci/types" - - "cosmossdk.io/core/comet" -) - -var _ comet.BlockInfo = (*cometInfo)(nil) - -// CometInfo defines the properties provided by comet to the application -type cometInfo struct { - Misbehavior []abci.Misbehavior - ValidatorsHash []byte - ProposerAddress []byte - LastCommit abci.CommitInfo -} - -func (r cometInfo) GetEvidence() comet.EvidenceList { - return evidenceWrapper{evidence: r.Misbehavior} -} - -func (r cometInfo) GetValidatorsHash() []byte { - return r.ValidatorsHash -} - -func (r cometInfo) GetProposerAddress() []byte { - return r.ProposerAddress -} - -func (r cometInfo) GetLastCommit() comet.CommitInfo { - return commitInfoWrapper{r.LastCommit} -} - -type evidenceWrapper struct { - evidence []abci.Misbehavior -} - -func (e evidenceWrapper) Len() int { - return len(e.evidence) -} - -func (e evidenceWrapper) Get(i int) comet.Evidence { - return misbehaviorWrapper{e.evidence[i]} -} - -// commitInfoWrapper is a wrapper around abci.CommitInfo that implements CommitInfo interface -type commitInfoWrapper struct { - abci.CommitInfo -} - -var _ comet.CommitInfo = (*commitInfoWrapper)(nil) - -func (c commitInfoWrapper) Round() int32 { - return c.CommitInfo.Round -} - -func (c commitInfoWrapper) Votes() comet.VoteInfos { - return abciVoteInfoWrapper{c.CommitInfo.Votes} -} - -// abciVoteInfoWrapper is a wrapper around abci.VoteInfo that implements VoteInfos interface -type abciVoteInfoWrapper struct { - votes []abci.VoteInfo -} - -var _ comet.VoteInfos = (*abciVoteInfoWrapper)(nil) - -func (e abciVoteInfoWrapper) Len() int { - return len(e.votes) -} - -func (e abciVoteInfoWrapper) Get(i int) comet.VoteInfo { - return voteInfoWrapper{e.votes[i]} -} - -// voteInfoWrapper is a wrapper around abci.VoteInfo that implements VoteInfo interface -type voteInfoWrapper struct { - abci.VoteInfo -} - -var _ comet.VoteInfo = (*voteInfoWrapper)(nil) - -func (v voteInfoWrapper) GetBlockIDFlag() comet.BlockIDFlag { - return comet.BlockIDFlag(v.VoteInfo.BlockIdFlag) -} - -func (v voteInfoWrapper) Validator() comet.Validator { - return validatorWrapper{v.VoteInfo.Validator} -} - -// validatorWrapper is a wrapper around abci.Validator that implements Validator interface -type validatorWrapper struct { - abci.Validator -} - -var _ comet.Validator = (*validatorWrapper)(nil) - -func (v validatorWrapper) Address() []byte { - return v.Validator.Address -} - -func (v validatorWrapper) Power() int64 { - return v.Validator.Power -} - -type misbehaviorWrapper struct { - abci.Misbehavior -} - -func (m misbehaviorWrapper) Type() comet.MisbehaviorType { - return comet.MisbehaviorType(m.Misbehavior.Type) -} - -func (m misbehaviorWrapper) Height() int64 { - return m.Misbehavior.Height -} - -func (m misbehaviorWrapper) Validator() comet.Validator { - return validatorWrapper{m.Misbehavior.Validator} -} - -func (m misbehaviorWrapper) Time() time.Time { - return m.Misbehavior.Time -} - -func (m misbehaviorWrapper) TotalVotingPower() int64 { - return m.Misbehavior.TotalVotingPower -} - -type prepareProposalInfo struct { - *abci.RequestPrepareProposal -} - -var _ comet.BlockInfo = (*prepareProposalInfo)(nil) - -func (r prepareProposalInfo) GetEvidence() comet.EvidenceList { - return evidenceWrapper{r.Misbehavior} -} - -func (r prepareProposalInfo) GetValidatorsHash() []byte { - return r.NextValidatorsHash -} - -func (r prepareProposalInfo) GetProposerAddress() []byte { - return r.RequestPrepareProposal.ProposerAddress -} - -func (r prepareProposalInfo) GetLastCommit() comet.CommitInfo { - return extendedCommitInfoWrapper{r.RequestPrepareProposal.LocalLastCommit} -} - -var _ comet.BlockInfo = (*prepareProposalInfo)(nil) - -type extendedCommitInfoWrapper struct { - abci.ExtendedCommitInfo -} - -var _ comet.CommitInfo = (*extendedCommitInfoWrapper)(nil) - -func (e extendedCommitInfoWrapper) Round() int32 { - return e.ExtendedCommitInfo.Round -} - -func (e extendedCommitInfoWrapper) Votes() comet.VoteInfos { - return extendedVoteInfoWrapperList{e.ExtendedCommitInfo.Votes} -} - -type extendedVoteInfoWrapperList struct { - votes []abci.ExtendedVoteInfo -} - -var _ comet.VoteInfos = (*extendedVoteInfoWrapperList)(nil) - -func (e extendedVoteInfoWrapperList) Len() int { - return len(e.votes) -} - -func (e extendedVoteInfoWrapperList) Get(i int) comet.VoteInfo { - return extendedVoteInfoWrapper{e.votes[i]} -} - -type extendedVoteInfoWrapper struct { - abci.ExtendedVoteInfo -} - -var _ comet.VoteInfo = (*extendedVoteInfoWrapper)(nil) - -func (e extendedVoteInfoWrapper) GetBlockIDFlag() comet.BlockIDFlag { - return comet.BlockIDFlag(e.ExtendedVoteInfo.BlockIdFlag) -} - -func (e extendedVoteInfoWrapper) Validator() comet.Validator { - return validatorWrapper{e.ExtendedVoteInfo.Validator} -} diff --git a/go.mod b/go.mod index d3f5658e8a..1ce7c69728 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ module github.com/cosmos/cosmos-sdk require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/go.sum b/go.sum index c136ddf590..85ab65894a 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/runtime/module.go b/runtime/module.go index ad7d04d479..efb71ca315 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -14,7 +14,6 @@ import ( stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/comet" "cosmossdk.io/core/event" "cosmossdk.io/core/genesis" "cosmossdk.io/core/header" @@ -73,7 +72,6 @@ func init() { ProvideTransientStoreService, ProvideEventService, ProvideHeaderInfoService, - ProvideCometInfoService, ProvideBasicManager, ProvideAppVersionModifier, ProvideAddressCodec, @@ -247,10 +245,6 @@ func ProvideEventService() event.Service { return EventService{} } -func ProvideCometInfoService() comet.BlockInfoService { - return cometInfoService{} -} - func ProvideHeaderInfoService(app *AppBuilder) header.Service { return headerInfoService{} } diff --git a/runtime/services.go b/runtime/services.go index 5dcd2bf342..844a5f7e3a 100644 --- a/runtime/services.go +++ b/runtime/services.go @@ -6,7 +6,6 @@ import ( appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/core/comet" "cosmossdk.io/core/header" "github.com/cosmos/cosmos-sdk/runtime/services" @@ -27,14 +26,6 @@ func (a *App) registerRuntimeServices(cfg module.Configurator) error { return nil } -var _ comet.BlockInfoService = cometInfoService{} - -type cometInfoService struct{} - -func (cometInfoService) GetCometBlockInfo(ctx context.Context) comet.BlockInfo { - return sdk.UnwrapSDKContext(ctx).CometInfo() -} - var _ header.Service = headerInfoService{} type headerInfoService struct{} diff --git a/simapp/app.go b/simapp/app.go index 1d7ed0776f..0ee7b707ef 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -364,7 +364,7 @@ func NewSimApp( // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, app.AccountKeeper.AddressCodec(), runtime.ProvideCometInfoService(), + appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, app.AccountKeeper.AddressCodec(), ) // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper diff --git a/simapp/go.mod b/simapp/go.mod index 386f0872c1..e80faaad8d 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.1.2 diff --git a/simapp/go.sum b/simapp/go.sum index 1800eee822..58f81aac1a 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -191,8 +191,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index 5942be698d..036935839e 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -23,8 +23,8 @@ schema = 3 version = "v0.4.0" hash = "sha256-minFyzgO/D+Oda4E3B1qvOAN5qd65SjS6nmjca4cp/8=" [mod."cosmossdk.io/core"] - version = "v0.11.0" - hash = "sha256-zUiOF04lWHK8OZqGhwVuzKYfig5I0107D+8fWX5/pbQ=" + version = "v0.12.0" + hash = "sha256-/BbjTNEoPUQaHf0j+QEp3rmCkrzlYqWhE9lpffGCib0=" [mod."cosmossdk.io/depinject"] version = "v1.0.0-alpha.4" hash = "sha256-xpLH0K6ivQznFrLw2hmhWIIyYgqjstV47OhTEj/c1oQ=" diff --git a/tests/go.mod b/tests/go.mod index 829677832a..7352559fd8 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/tests/go.sum b/tests/go.sum index e0b700b510..4dbbfc0bf9 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -191,8 +191,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index f06fc2bb85..4acef9136e 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -125,7 +125,7 @@ func initFixture(tb testing.TB) *fixture { slashingKeeper := slashingkeeper.NewKeeper(cdc, codec.NewLegacyAmino(), runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), stakingKeeper, authority.String()) - evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec("cosmos"), runtime.ProvideCometInfoService()) + evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec("cosmos")) router := evidencetypes.NewRouter() router = router.AddRoute(evidencetypes.RouteEquivocation, testEquivocationHandler(evidenceKeeper)) evidenceKeeper.SetRouter(router) @@ -205,14 +205,14 @@ func TestHandleDoubleSign(t *testing.T) { assert.NilError(t, err) oldTokens := val.GetTokens() - nci := NewCometInfo(abci.RequestFinalizeBlock{ - Misbehavior: []abci.Misbehavior{{ - Validator: abci.Validator{Address: valpubkey.Address(), Power: power}, - Type: abci.MisbehaviorType_DUPLICATE_VOTE, + nci := comet.Info{ + Evidence: []comet.Evidence{{ + Validator: comet.Validator{Address: valpubkey.Address(), Power: power}, + Type: comet.DuplicateVote, Time: time.Now().UTC(), Height: 1, }}, - }) + } ctx = ctx.WithCometInfo(nci) assert.NilError(t, f.evidenceKeeper.BeginBlocker(ctx.WithCometInfo(nci))) @@ -285,14 +285,12 @@ func TestHandleDoubleSign_TooOld(t *testing.T) { assert.NilError(t, err) assert.DeepEqual(t, amt, val.GetBondedTokens()) - nci := NewCometInfo(abci.RequestFinalizeBlock{ - Misbehavior: []abci.Misbehavior{{ - Validator: abci.Validator{Address: valpubkey.Address(), Power: power}, - Type: abci.MisbehaviorType_DUPLICATE_VOTE, - Time: ctx.BlockTime(), - Height: 0, - }}, - }) + nci := comet.Info{Evidence: []comet.Evidence{{ + Validator: comet.Validator{Address: valpubkey.Address(), Power: power}, + Type: comet.MisbehaviorType(abci.MisbehaviorType_DUPLICATE_VOTE), + Time: ctx.BlockTime(), + Height: 0, + }}} assert.NilError(t, f.app.BaseApp.StoreConsensusParams(ctx, *simtestutil.DefaultConsensusParams)) cp := f.app.BaseApp.GetConsensusParams(ctx) @@ -349,80 +347,3 @@ func testEquivocationHandler(_ interface{}) evidencetypes.Handler { return nil } } - -type CometService struct { - Evidence []abci.Misbehavior -} - -func NewCometInfo(bg abci.RequestFinalizeBlock) comet.BlockInfo { - return CometService{ - Evidence: bg.Misbehavior, - } -} - -func (r CometService) GetEvidence() comet.EvidenceList { - return evidenceWrapper{evidence: r.Evidence} -} - -func (CometService) GetValidatorsHash() []byte { - return []byte{} -} - -func (CometService) GetProposerAddress() []byte { - return []byte{} -} - -func (CometService) GetLastCommit() comet.CommitInfo { - return nil -} - -type evidenceWrapper struct { - evidence []abci.Misbehavior -} - -func (e evidenceWrapper) Len() int { - return len(e.evidence) -} - -func (e evidenceWrapper) Get(i int) comet.Evidence { - return misbehaviorWrapper{e.evidence[i]} -} - -type misbehaviorWrapper struct { - abci.Misbehavior -} - -func (m misbehaviorWrapper) Type() comet.MisbehaviorType { - return comet.MisbehaviorType(m.Misbehavior.Type) -} - -func (m misbehaviorWrapper) Height() int64 { - return m.Misbehavior.Height -} - -func (m misbehaviorWrapper) Validator() comet.Validator { - return validatorWrapper{m.Misbehavior.Validator} -} - -func (m misbehaviorWrapper) Time() time.Time { - return m.Misbehavior.Time -} - -func (m misbehaviorWrapper) TotalVotingPower() int64 { - return m.Misbehavior.TotalVotingPower -} - -// validatorWrapper is a wrapper around abci.Validator that implements Validator interface -type validatorWrapper struct { - abci.Validator -} - -var _ comet.Validator = (*validatorWrapper)(nil) - -func (v validatorWrapper) Address() []byte { - return v.Validator.Address -} - -func (v validatorWrapper) Power() int64 { - return v.Validator.Power -} diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 76a5fe5eb1..510d82d771 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -41,7 +41,7 @@ require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core v0.11.0 // indirect + cosmossdk.io/core v0.12.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/errors v1.0.0 // indirect cosmossdk.io/store v1.0.0-rc.0 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index f60e57ef40..8f4ec9e23f 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -191,8 +191,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/types/context.go b/types/context.go index 2a0ac17340..3260818674 100644 --- a/types/context.go +++ b/types/context.go @@ -61,7 +61,7 @@ type Context struct { kvGasConfig storetypes.GasConfig transientKVGasConfig storetypes.GasConfig streamingManager storetypes.StreamingManager - cometInfo comet.BlockInfo + cometInfo comet.Info headerInfo header.Info } @@ -88,7 +88,7 @@ func (c Context) Priority() int64 { return c.prior func (c Context) KVGasConfig() storetypes.GasConfig { return c.kvGasConfig } func (c Context) TransientKVGasConfig() storetypes.GasConfig { return c.transientKVGasConfig } func (c Context) StreamingManager() storetypes.StreamingManager { return c.streamingManager } -func (c Context) CometInfo() comet.BlockInfo { return c.cometInfo } +func (c Context) CometInfo() comet.Info { return c.cometInfo } func (c Context) HeaderInfo() header.Info { return c.headerInfo } // clone the header before returning @@ -302,7 +302,7 @@ func (c Context) WithStreamingManager(sm storetypes.StreamingManager) Context { } // WithCometInfo returns a Context with an updated comet info -func (c Context) WithCometInfo(cometInfo comet.BlockInfo) Context { +func (c Context) WithCometInfo(cometInfo comet.Info) Context { c.cometInfo = cometInfo return c } @@ -393,3 +393,58 @@ func UnwrapSDKContext(ctx context.Context) Context { } return ctx.Value(SdkContextKey).(Context) } + +// ToSDKEvidence takes comet evidence and returns sdk evidence +func ToSDKEvidence(ev []abci.Misbehavior) []comet.Evidence { + evidence := make([]comet.Evidence, len(ev)) + for i, e := range ev { + evidence[i] = comet.Evidence{ + Type: comet.MisbehaviorType(e.Type), + Height: e.Height, + Time: e.Time, + TotalVotingPower: e.TotalVotingPower, + Validator: comet.Validator{ + Address: e.Validator.Address, + Power: e.Validator.Power, + }, + } + } + return evidence +} + +// ToSDKDecidedCommitInfo takes comet commit info and returns sdk commit info +func ToSDKCommitInfo(commit abci.CommitInfo) comet.CommitInfo { + ci := comet.CommitInfo{ + Round: commit.Round, + } + + for _, v := range commit.Votes { + ci.Votes = append(ci.Votes, comet.VoteInfo{ + Validator: comet.Validator{ + Address: v.Validator.Address, + Power: v.Validator.Power, + }, + BlockIDFlag: comet.BlockIDFlag(v.BlockIdFlag), + }) + } + return ci +} + +// ToSDKExtendedCommitInfo takes comet extended commit info and returns sdk commit info +func ToSDKExtendedCommitInfo(commit abci.ExtendedCommitInfo) comet.CommitInfo { + ci := comet.CommitInfo{ + Round: commit.Round, + } + + for _, v := range commit.Votes { + ci.Votes = append(ci.Votes, comet.VoteInfo{ + Validator: comet.Validator{ + Address: v.Validator.Address, + Power: v.Validator.Power, + }, + BlockIDFlag: comet.BlockIDFlag(v.BlockIdFlag), + }) + } + + return ci +} diff --git a/types/mempool/mempool_test.go b/types/mempool/mempool_test.go index 7a88133847..b9a8e2b188 100644 --- a/types/mempool/mempool_test.go +++ b/types/mempool/mempool_test.go @@ -232,11 +232,6 @@ func (s *MempoolTestSuite) TestSampleTxs() { require.NoError(t, err) require.NoError(t, mp.Insert(ctxt, delegatorTx)) require.Equal(t, 1, mp.CountTx()) - - proposalTx, err := unmarshalTx(msgMultiSigMsgSubmitProposal) - require.NoError(t, err) - require.NoError(t, mp.Insert(ctxt, proposalTx)) - require.Equal(t, 2, mp.CountTx()) } func unmarshalTx(txBytes []byte) (sdk.Tx, error) { @@ -244,7 +239,4 @@ func unmarshalTx(txBytes []byte) (sdk.Tx, error) { return cfg.TxConfig.TxJSONDecoder()(txBytes) } -var ( - msgWithdrawDelegatorReward = []byte("{\"body\":{\"messages\":[{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxerarrl\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcvrj90c\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1k2d9ed9vgfuk2m58a2d80q9u6qljkh4vfaqjfq\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1vygmh344ldv9qefss9ek7ggsnxparljlmj56q5\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5wxxp9gd\"}],\"memo\":\"\",\"timeout_height\":\"0\",\"extension_options\":[],\"non_critical_extension_options\":[]},\"auth_info\":{\"signer_infos\":[{\"public_key\":{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AmbXAy10a0SerEefTYQzqyGQdX5kiTEWJZ1PZKX1oswX\"},\"mode_info\":{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}},\"sequence\":\"119\"}],\"fee\":{\"amount\":[{\"denom\":\"uatom\",\"amount\":\"15968\"}],\"gas_limit\":\"638717\",\"payer\":\"\",\"granter\":\"\"}},\"signatures\":[\"ji+inUo4xGlN9piRQLdLCeJWa7irwnqzrMVPcmzJyG5y6NPc+ZuNaIc3uvk5NLDJytRB8AHX0GqNETR\\/Q8fz4Q==\"]}") - msgMultiSigMsgSubmitProposal = []byte("{\"body\":{\"messages\":[{\"@type\":\"\\/cosmos.gov.v1beta1.MsgSubmitProposal\",\"content\":{\"@type\":\"\\/cosmos.distribution.v1beta1.CommunityPoolSpendProposal\",\"title\":\"ATOM \\ud83e\\udd1d Osmosis: Allocate Community Pool to ATOM Liquidity Incentives\",\"description\":\"ATOMs should be the base money of Cosmos, just like ETH is the base money of the entire Ethereum DeFi ecosystem. ATOM is currently well positioned to play this role among Cosmos assets because it has the highest market cap, most liquidity, largest brand, and many integrations with fiat onramps. ATOM is the gateway to Cosmos.\\n\\nIn the Cosmos Hub Port City vision, ATOMs are pitched as equity in the Cosmos Hub. However, this alone is insufficient to establish ATOM as the base currency of the Cosmos ecosystem as a whole. Instead, the ATOM community must work to actively promote the use of ATOMs throughout the Cosmos ecosystem, rather than passively relying on the Hub's reputation to create ATOM's value.\\n\\nIn order to cement the role of ATOMs in Cosmos DeFi, the Cosmos Hub should leverage its community pool to help align incentives with other protocols within the Cosmos ecosystem. We propose beginning this initiative by using the community pool ATOMs to incentivize deep ATOM base pair liquidity pools on the Osmosis Network.\\n\\nOsmosis is the first IBC-enabled DeFi application. Within its 3 weeks of existence, it has already 100x\\u2019d the number of IBC transactions ever created, demonstrating the power of IBC and the ability of the Cosmos SDK to bootstrap DeFi protocols with $100M+ TVL in a short period of time. Since its announcement Osmosis has helped bring renewed attention and interest to Cosmos from the crypto community at large and kickstarted the era of Cosmos DeFi.\\n\\nOsmosis has already helped in establishing ATOM as the Schelling Point of the Cosmos ecosystem. The genesis distribution of OSMO was primarily based on an airdrop to ATOM holders specifically, acknowledging the importance of ATOM to all future projects within the Cosmos. Furthermore, the Osmosis LP rewards currently incentivize ATOMs to be one of the main base pairs of the platform.\\n\\nOsmosis has the ability to incentivize AMM liquidity, a feature not available on any other IBC-enabled DEX. Osmosis already uses its own native OSMO liquidity rewards to incentivize ATOMs to be one of the main base pairs, leading to ~2.2 million ATOMs already providing liquidity on the platform.\\n\\nIn addition to these native OSMO LP Rewards, the platform also includes a feature called \\u201cexternal incentives\\u201d that allows anyone to permissionlessly add additional incentives in any token to the LPs of any AMM pools they wish. You can read more about this mechanism here: https:\\/\\/medium.com\\/osmosis\\/osmosis-liquidity-mining-101-2fa58d0e9d4d#f413 . Pools containing Cosmos assets such as AKT and XPRT are already planned to receive incentives from their respective community pools and\\/or foundations.\\n\\nWe propose the Cosmos Hub dedicate 100,000 ATOMs from its Community Pool to be allocated towards liquidity incentives on Osmosis over the next 3 months. This community fund proposal will transfer 100,000 ATOMs to a multisig group who will then allocate the ATOMs to bonded liquidity gauges on Osmosis on a biweekly basis, according to direction given by Cosmos Hub governance. For simplicity, we propose setting the liquidity incentives to initially point to Osmosis Pool #1, the ATOM\\/OSMO pool, which is the pool with by far the highest TVL and Volume. Cosmos Hub governance can then use Text Proposals to further direct the multisig members to reallocate incentives to new pools.\\n\\nThe multisig will consist of a 2\\/3 key holder set consisting of the following individuals whom have all agreed to participate in this process shall this proposal pass:\\n\\n- Zaki Manian\\n- Federico Kunze\\n- Marko Baricevic\\n\\nThis is one small step for the Hub, but one giant leap for ATOM-aligned.\\n\",\"recipient\":\"cosmos157n0d38vwn5dvh64rc39q3lyqez0a689g45rkc\",\"amount\":[{\"denom\":\"uatom\",\"amount\":\"100000000000\"}]},\"initial_deposit\":[{\"denom\":\"uatom\",\"amount\":\"64000000\"}],\"proposer\":\"cosmos1ey69r37gfxvxg62sh4r0ktpuc46pzjrmz29g45\"}],\"memo\":\"\",\"timeout_height\":\"0\",\"extension_options\":[],\"non_critical_extension_options\":[]},\"auth_info\":{\"signer_infos\":[{\"public_key\":{\"@type\":\"\\/cosmos.crypto.multisig.LegacyAminoPubKey\",\"threshold\":2,\"public_keys\":[{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AldOvgv8dU9ZZzuhGydQD5FYreLhfhoBgrDKi8ZSTbCQ\"},{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AxUMR\\/GKoycWplR+2otzaQZ9zhHRQWJFt3h1bPg1ltha\"},{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AlI9yVj2Aejow6bYl2nTRylfU+9LjQLEl3keq0sERx9+\"},{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"A0UvHPcvCCaIoFY9Ygh0Pxq9SZTAWtduOyinit\\/8uo+Q\"},{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"As7R9fDUnwsUVLDr1cxspp+cY9UfXfUf7i9\\/w+N0EzKA\"}]},\"mode_info\":{\"multi\":{\"bitarray\":{\"extra_bits_stored\":5,\"elems\":\"SA==\"},\"mode_infos\":[{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}},{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}}]}},\"sequence\":\"102\"}],\"fee\":{\"amount\":[],\"gas_limit\":\"10000000\",\"payer\":\"\",\"granter\":\"\"}},\"signatures\":[\"CkB\\/KKWTFntEWbg1A0vu7DCHffJ4x4db\\/EI8dIVzRFFW7iuZBzvq+jYBtrcTlVpEVfmCY3ggIMnWfbMbb1egIlYbCkAmDf6Eaj1NbyXY8JZZtYAX3Qj81ZuKZUBeLW1ZvH1XqAg9sl\\/sqpLMnsJzKfmqEXvhoMwu1YxcSzrY6CJfuYL6\"]}") -) +var msgWithdrawDelegatorReward = []byte("{\"body\":{\"messages\":[{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxerarrl\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcvrj90c\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1k2d9ed9vgfuk2m58a2d80q9u6qljkh4vfaqjfq\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1vygmh344ldv9qefss9ek7ggsnxparljlmj56q5\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5wxxp9gd\"}],\"memo\":\"\",\"timeout_height\":\"0\",\"extension_options\":[],\"non_critical_extension_options\":[]},\"auth_info\":{\"signer_infos\":[{\"public_key\":{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AmbXAy10a0SerEefTYQzqyGQdX5kiTEWJZ1PZKX1oswX\"},\"mode_info\":{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}},\"sequence\":\"119\"}],\"fee\":{\"amount\":[{\"denom\":\"uatom\",\"amount\":\"15968\"}],\"gas_limit\":\"638717\",\"payer\":\"\",\"granter\":\"\"}},\"signatures\":[\"ji+inUo4xGlN9piRQLdLCeJWa7irwnqzrMVPcmzJyG5y6NPc+ZuNaIc3uvk5NLDJytRB8AHX0GqNETR\\/Q8fz4Q==\"]}") diff --git a/x/accounts/internal/implementation/protoaccount.go b/x/accounts/internal/implementation/protoaccount.go index 02e2c2f15e..1a507642a2 100644 --- a/x/accounts/internal/implementation/protoaccount.go +++ b/x/accounts/internal/implementation/protoaccount.go @@ -17,7 +17,8 @@ type ProtoMsg[T any] interface { // RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf. func RegisterInitHandler[ Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], -](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error)) { +](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), +) { reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName() respName := ProtoResp(new(Resp)).ProtoReflect().Descriptor().FullName() @@ -47,7 +48,8 @@ func RegisterInitHandler[ // RegisterExecuteHandler registers an execution handler for a smart account that uses protobuf. func RegisterExecuteHandler[ Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], -](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error)) { +](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), +) { reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName() // check if not registered already if _, ok := router.handlers[string(reqName)]; ok { @@ -67,6 +69,7 @@ func RegisterExecuteHandler[ // RegisterQueryHandler registers a query handler for a smart account that uses protobuf. func RegisterQueryHandler[ Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], -](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error)) { +](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), +) { RegisterExecuteHandler(router.er, handler) } diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 338b4548d2..16b4570219 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/math v1.1.2 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index c5ed7f000e..bd1c464273 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/x/evidence/CHANGELOG.md b/x/evidence/CHANGELOG.md index f5920340e9..52f797fedd 100644 --- a/x/evidence/CHANGELOG.md +++ b/x/evidence/CHANGELOG.md @@ -36,6 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (keeper) [#15825](https://github.com/cosmos/cosmos-sdk/pull/15825) Evidence constructor now requires an `address.Codec` (`import "cosmossdk.io/core/address"`) * [#16336](https://github.com/cosmos/cosmos-sdk/pull/16336) Use collections for state management: * Removed: keeper `SetEvidence`, `GetEvidence`, `IterateEvidences`, `GetAllEvidences`, `MustMarshalEvidence`, `MustUnmarshalEvidence`, `MarshalEvidence`, `UnmarshalEvidence` +* [#17688](https://github.com/cosmos/cosmos-sdk/pull/17688) Remove `comet.Info` as an arg to evidence ### Client Breaking Changes diff --git a/x/evidence/go.mod b/x/evidence/go.mod index ee3f479898..437e61bfd0 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index c5ed7f000e..bd1c464273 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/x/evidence/keeper/abci.go b/x/evidence/keeper/abci.go index 2273f793b7..ec7f576185 100644 --- a/x/evidence/keeper/abci.go +++ b/x/evidence/keeper/abci.go @@ -17,27 +17,22 @@ import ( func (k Keeper) BeginBlocker(ctx context.Context) error { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - bi := k.cometInfo.GetCometBlockInfo(ctx) - if bi == nil { - // If we don't have block info, we don't have any evidence to process. Block info may be nil during - // genesis calls or in tests. - return nil - } + bi := sdk.UnwrapSDKContext(ctx).CometInfo() - evidences := bi.GetEvidence() + evidences := bi.Evidence sdkCtx := sdk.UnwrapSDKContext(ctx) - for i := 0; i < evidences.Len(); i++ { - switch evidences.Get(i).Type() { + for _, evidence := range evidences { + switch evidence.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 comet.LightClientAttack, comet.DuplicateVote: - evidence := types.FromABCIEvidence(evidences.Get(i), k.stakingKeeper.ConsensusAddressCodec()) + evidence := types.FromABCIEvidence(evidence, k.stakingKeeper.ConsensusAddressCodec()) err := k.handleEquivocationEvidence(ctx, evidence) if err != nil { return err } default: - k.Logger(sdkCtx).Error(fmt.Sprintf("ignored unknown evidence type: %x", evidences.Get(i).Type())) + k.Logger(sdkCtx).Error(fmt.Sprintf("ignored unknown evidence type: %x", evidence.Type)) } } return nil diff --git a/x/evidence/keeper/keeper.go b/x/evidence/keeper/keeper.go index 74f4d6f393..6a4c99b95d 100644 --- a/x/evidence/keeper/keeper.go +++ b/x/evidence/keeper/keeper.go @@ -8,7 +8,6 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" - "cosmossdk.io/core/comet" "cosmossdk.io/core/store" "cosmossdk.io/errors" "cosmossdk.io/log" @@ -30,8 +29,6 @@ type Keeper struct { slashingKeeper types.SlashingKeeper addressCodec address.Codec - cometInfo comet.BlockInfoService - Schema collections.Schema // Evidences key: evidence hash bytes | value: Evidence Evidences collections.Map[[]byte, exported.Evidence] @@ -40,7 +37,7 @@ type Keeper struct { // NewKeeper creates a new Keeper object. func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, stakingKeeper types.StakingKeeper, - slashingKeeper types.SlashingKeeper, ac address.Codec, ci comet.BlockInfoService, + slashingKeeper types.SlashingKeeper, ac address.Codec, ) *Keeper { sb := collections.NewSchemaBuilder(storeService) k := &Keeper{ @@ -49,7 +46,6 @@ func NewKeeper( stakingKeeper: stakingKeeper, slashingKeeper: slashingKeeper, addressCodec: ac, - cometInfo: ci, Evidences: collections.NewMap(sb, types.KeyPrefixEvidence, "evidences", collections.BytesKey, codec.CollInterfaceValue[exported.Evidence](cdc)), } schema, err := sb.Build() diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index 4b347b5471..7e10dba127 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -77,7 +77,6 @@ type KeeperTestSuite struct { accountKeeper *evidencetestutil.MockAccountKeeper slashingKeeper *evidencetestutil.MockSlashingKeeper stakingKeeper *evidencetestutil.MockStakingKeeper - blockInfo *evidencetestutil.MockCometinfo queryClient types.QueryClient encCfg moduletestutil.TestEncodingConfig msgServer types.MsgServer @@ -97,7 +96,6 @@ func (suite *KeeperTestSuite) SetupTest() { slashingKeeper := evidencetestutil.NewMockSlashingKeeper(ctrl) accountKeeper := evidencetestutil.NewMockAccountKeeper(ctrl) bankKeeper := evidencetestutil.NewMockBankKeeper(ctrl) - suite.blockInfo = &evidencetestutil.MockCometinfo{} evidenceKeeper := keeper.NewKeeper( encCfg.Codec, @@ -105,7 +103,6 @@ func (suite *KeeperTestSuite) SetupTest() { stakingKeeper, slashingKeeper, address.NewBech32Codec("cosmos"), - &evidencetestutil.MockCometinfo{}, ) suite.stakingKeeper = stakingKeeper diff --git a/x/evidence/module.go b/x/evidence/module.go index d9bb011ba5..43f65545bc 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -12,7 +12,6 @@ import ( modulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/comet" store "cosmossdk.io/core/store" "cosmossdk.io/depinject" eviclient "cosmossdk.io/x/evidence/client" @@ -196,8 +195,6 @@ type ModuleInputs struct { StakingKeeper types.StakingKeeper SlashingKeeper types.SlashingKeeper AddressCodec address.Codec - - BlockInfoService comet.BlockInfoService } type ModuleOutputs struct { @@ -208,7 +205,7 @@ type ModuleOutputs struct { } func ProvideModule(in ModuleInputs) ModuleOutputs { - k := keeper.NewKeeper(in.Cdc, in.StoreService, in.StakingKeeper, in.SlashingKeeper, in.AddressCodec, in.BlockInfoService) + k := keeper.NewKeeper(in.Cdc, in.StoreService, in.StakingKeeper, in.SlashingKeeper, in.AddressCodec) m := NewAppModule(*k) return ModuleOutputs{EvidenceKeeper: *k, Module: m} diff --git a/x/evidence/testutil/expected_keepers_mocks.go b/x/evidence/testutil/expected_keepers_mocks.go index b04232f6de..4ac84dbdc1 100644 --- a/x/evidence/testutil/expected_keepers_mocks.go +++ b/x/evidence/testutil/expected_keepers_mocks.go @@ -11,7 +11,6 @@ import ( stakingv1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1" address "cosmossdk.io/core/address" - comet "cosmossdk.io/core/comet" math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/crypto/types" types0 "github.com/cosmos/cosmos-sdk/types" @@ -336,40 +335,3 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderMo mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } - -// MockCometinfo is a mock of Cometinfo interface. -type MockCometinfo struct { - ctrl *gomock.Controller - recorder *MockCometinfoMockRecorder -} - -// MockCometinfoMockRecorder is the mock recorder for MockCometinfo. -type MockCometinfoMockRecorder struct { - mock *MockCometinfo -} - -// NewMockCometinfo creates a new mock instance. -func NewMockCometinfo(ctrl *gomock.Controller) *MockCometinfo { - mock := &MockCometinfo{ctrl: ctrl} - mock.recorder = &MockCometinfoMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockCometinfo) EXPECT() *MockCometinfoMockRecorder { - return m.recorder -} - -// GetCometBlockInfo mocks base method. -func (m *MockCometinfo) GetCometBlockInfo(arg0 context.Context) comet.BlockInfo { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCometBlockInfo", arg0) - ret0, _ := ret[0].(comet.BlockInfo) - return ret0 -} - -// GetCometBlockInfo indicates an expected call of GetCometBlockInfo. -func (mr *MockCometinfoMockRecorder) GetCometBlockInfo(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCometBlockInfo", reflect.TypeOf((*MockCometinfo)(nil).GetCometBlockInfo), arg0) -} diff --git a/x/evidence/types/evidence.go b/x/evidence/types/evidence.go index aed09ec304..c33ec2a266 100644 --- a/x/evidence/types/evidence.go +++ b/x/evidence/types/evidence.go @@ -77,15 +77,15 @@ func (e Equivocation) GetTotalPower() int64 { return 0 } // FromABCIEvidence converts a CometBFT concrete Evidence type to // SDK Evidence using Equivocation as the concrete type. func FromABCIEvidence(e comet.Evidence, conAc address.Codec) *Equivocation { - consAddr, err := conAc.BytesToString(e.Validator().Address()) + consAddr, err := conAc.BytesToString(e.Validator.Address) if err != nil { panic(err) } return &Equivocation{ - Height: e.Height(), - Power: e.Validator().Power(), + Height: e.Height, + Power: e.Validator.Power, ConsensusAddress: consAddr, - Time: e.Time(), + Time: e.Time, } } diff --git a/x/evidence/types/evidence_test.go b/x/evidence/types/evidence_test.go index 8670753268..6e527bf371 100644 --- a/x/evidence/types/evidence_test.go +++ b/x/evidence/types/evidence_test.go @@ -75,64 +75,21 @@ func TestEquivocationValidateBasic(t *testing.T) { func TestEvidenceAddressConversion(t *testing.T) { sdk.GetConfig().SetBech32PrefixForConsensusNode("testcnclcons", "testcnclconspub") tmEvidence := NewCometMisbehavior(1, 100, time.Now(), comet.DuplicateVote, - 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}) + comet.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}) evidence := types.FromABCIEvidence(tmEvidence, address.NewBech32Codec("testcnclcons")) consAddr := evidence.GetConsensusAddress(address.NewBech32Codec("testcnclcons")) // Check the address is the same after conversion - require.Equal(t, tmEvidence.Validator().Address(), consAddr.Bytes()) + require.Equal(t, tmEvidence.Validator.Address, consAddr.Bytes()) sdk.GetConfig().SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) } -type Misbehavior struct { - height int64 - time time.Time - totalVotingPower int64 - validator validator - misBehaviorType comet.MisbehaviorType -} - -func NewCometMisbehavior(height, tvp int64, t time.Time, tpe comet.MisbehaviorType, val validator) comet.Evidence { - return Misbehavior{ - height: height, - time: t, - totalVotingPower: tvp, - misBehaviorType: tpe, - validator: val, +func NewCometMisbehavior(height, tvp int64, t time.Time, tpe comet.MisbehaviorType, val comet.Validator) comet.Evidence { + return comet.Evidence{ + Height: height, + Time: t, + TotalVotingPower: tvp, + Type: tpe, + Validator: val, } } - -func (m Misbehavior) Type() comet.MisbehaviorType { - return m.misBehaviorType -} - -func (m Misbehavior) Height() int64 { - return m.height -} - -func (m Misbehavior) Validator() comet.Validator { - return m.validator -} - -func (m Misbehavior) Time() time.Time { - return m.time -} - -func (m Misbehavior) TotalVotingPower() int64 { - return m.totalVotingPower -} - -type validator struct { - address []byte - power int64 -} - -var _ comet.Validator = (*validator)(nil) - -func (v validator) Address() []byte { - return v.address -} - -func (v validator) Power() int64 { - return v.power -} diff --git a/x/evidence/types/expected_keepers.go b/x/evidence/types/expected_keepers.go index 77c5ea8d9a..ed99ba374f 100644 --- a/x/evidence/types/expected_keepers.go +++ b/x/evidence/types/expected_keepers.go @@ -6,7 +6,6 @@ import ( st "cosmossdk.io/api/cosmos/staking/v1beta1" "cosmossdk.io/core/address" - "cosmossdk.io/core/comet" "cosmossdk.io/math" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -48,8 +47,4 @@ type ( SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins } - - Cometinfo interface { - comet.BlockInfoService - } ) diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index ff8c2263fd..397c1ef427 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 2b051170b6..eee31c36bf 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/x/gov/types/v1beta1/codec.go b/x/gov/types/v1beta1/codec.go index 775364ebb1..d5b8b90880 100644 --- a/x/gov/types/v1beta1/codec.go +++ b/x/gov/types/v1beta1/codec.go @@ -6,7 +6,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -33,10 +32,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*Content)(nil), &TextProposal{}, ) - registry.RegisterImplementations( - (*Content)(nil), - &distrtypes.CommunityPoolSpendProposal{}, //nolint: staticcheck // avoid using `CommunityPoolSpendProposal`, might be reomved in future. - ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/nft/go.mod b/x/nft/go.mod index 4de0f1ecf5..2006a85b0d 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/x/nft/go.sum b/x/nft/go.sum index c5ed7f000e..bd1c464273 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index ddc872afb9..df806aca5e 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 2e8bb4595a..056d420514 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -191,8 +191,8 @@ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0 h1:z1aCAqEXi5fzC5tjanWnkP/ cosmossdk.io/api v0.7.1-0.20230820170544-1bd37053e0c0/go.mod h1:h4YT2OHIBT/YIwWrc5L+4dY05ZIqvo89zs6m7j4/RSk= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 43c9b04c4f..66ba3c2fe2 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec @@ -20,12 +19,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the interfaces types with the Interface Registry. func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &SoftwareUpgradeProposal{}, - &CancelSoftwareUpgradeProposal{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{},