diff --git a/CHANGELOG.md b/CHANGELOG.md index cc58a63dfa45..4eac38bdc486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] * (baseapp) [#21979](https://github.com/cosmos/cosmos-sdk/pull/21979) Create CheckTxHandler to allow extending the logic of CheckTx. +* (baseapp) [#24074](https://github.com/cosmos/cosmos-sdk/pull/24074) Use CometBFT's ComputeProtoSizeForTxs in defaultTxSelector.SelectTxForProposal for consistency. ## [v0.50.13](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.13) - 2025-03-12 diff --git a/Makefile b/Makefile index 181de584d26e..7a81e0aefdf8 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ HTTPS_GIT := https://github.com/cosmos/cosmos-sdk.git DOCKER := $(shell which docker) PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git) +# Subdirectories for tagging +SUBDIR_PREFIXES := api core errors store x/circuit x/evidence x/feegrant x/nft x/tx x/upgrade + # process build tags build_tags = netgo ifeq ($(LEDGER_ENABLED),true) @@ -481,3 +484,44 @@ localnet-start: localnet-stop localnet-build-env localnet-build-nodes localnet-debug: localnet-stop localnet-build-dlv localnet-build-nodes .PHONY: localnet-start localnet-stop localnet-debug localnet-build-env localnet-build-dlv localnet-build-nodes + +############################################################################### +### Tagging ### +############################################################################### + +# tag-client creates and pushes the special client tag with v2.0.0- prefix +# Usage: make tag-client TAG=v1.2.3 (creates client/v2.0.0-v1.2.3) +tag-client: +ifndef TAG + $(error TAG is required. Usage: make tag-client TAG=v1.2.3) +endif + @echo "Fetching latest tags from origin..." + @git fetch origin --tags + @echo "Creating client tag for $(TAG)..." + @client_tag="client/v2.0.0-$(TAG)"; \ + echo "Creating tag: $$client_tag"; \ + git tag "$$client_tag" $(TAG); \ + echo "Pushing tag: $$client_tag"; \ + git push origin "$$client_tag" + @echo "Successfully created and pushed client tag for $(TAG)" + +# tag-subdirs creates and pushes tags with subdir prefixes for a given tag +# Usage: make tag-subdirs TAG=v1.2.3 +# NOTE: This also automatically creates the special client tag +tag-subdirs: tag-client +ifndef TAG + $(error TAG is required. Usage: make tag-subdirs TAG=v1.2.3) +endif + @echo "Fetching latest tags from origin..." + @git fetch origin --tags + @echo "Creating and pushing subdir tags for $(TAG)..." + @for prefix in $(SUBDIR_PREFIXES); do \ + new_tag="$$prefix/$(TAG)"; \ + echo "Creating tag: $$new_tag"; \ + git tag "$$new_tag" $(TAG); \ + echo "Pushing tag: $$new_tag"; \ + git push origin "$$new_tag"; \ + done + @echo "Successfully created and pushed all subdir tags for $(TAG)" + +.PHONY: tag-subdirs tag-client diff --git a/baseapp/abci_utils.go b/baseapp/abci_utils.go index 943506812120..d0a548ba0abc 100644 --- a/baseapp/abci_utils.go +++ b/baseapp/abci_utils.go @@ -11,6 +11,7 @@ import ( cmtprotocrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cryptoenc "github.com/cometbft/cometbft/crypto/encoding" + cmttypes "github.com/cometbft/cometbft/types" protoio "github.com/cosmos/gogoproto/io" "github.com/cosmos/gogoproto/proto" //nolint: gci // ignore this line for this linter @@ -488,7 +489,7 @@ func (ts *defaultTxSelector) Clear() { } func (ts *defaultTxSelector) SelectTxForProposal(_ context.Context, maxTxBytes, maxBlockGas uint64, memTx sdk.Tx, txBz []byte) bool { - txSize := uint64(len(txBz)) + txSize := uint64(cmttypes.ComputeProtoSizeForTxs([]cmttypes.Tx{txBz})) var txGasLimit uint64 if memTx != nil { diff --git a/baseapp/abci_utils_test.go b/baseapp/abci_utils_test.go index 324900024234..567cf9444d59 100644 --- a/baseapp/abci_utils_test.go +++ b/baseapp/abci_utils_test.go @@ -493,6 +493,9 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() s.Require().NoError(err) s.Require().Len(txBz, 152) + txDataSize := int(cmttypes.ComputeProtoSizeForTxs([]cmttypes.Tx{txBz})) + s.Require().Equal(txDataSize, 155) + testCases := map[string]struct { ctx sdk.Context req *abci.PrepareProposalRequest @@ -514,7 +517,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() }), req: &abci.PrepareProposalRequest{ Txs: [][]byte{txBz, txBz, txBz, txBz, txBz}, - MaxTxBytes: 456, + MaxTxBytes: 465, }, expectedTxs: 0, }, @@ -522,10 +525,18 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() ctx: s.ctx, req: &abci.PrepareProposalRequest{ Txs: [][]byte{txBz, txBz, txBz, txBz, txBz}, - MaxTxBytes: 456, + MaxTxBytes: 465, }, expectedTxs: 3, }, + "large max tx bytes len calculation": { + ctx: s.ctx, + req: &abci.PrepareProposalRequest{ + Txs: [][]byte{txBz, txBz, txBz, txBz, txBz}, + MaxTxBytes: 456, + }, + expectedTxs: 2, + }, "max gas and tx bytes": { ctx: s.ctx.WithConsensusParams(cmtproto.ConsensusParams{ Block: &cmtproto.BlockParams{ @@ -534,7 +545,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() }), req: &abci.PrepareProposalRequest{ Txs: [][]byte{txBz, txBz, txBz, txBz, txBz}, - MaxTxBytes: 456, + MaxTxBytes: 465, }, expectedTxs: 2, }, @@ -543,7 +554,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() for name, tc := range testCases { s.Run(name, func() { // iterate multiple times to ensure the tx selector is cleared each time - for i := 0; i < 5; i++ { + for i := 0; i < 6; i++ { resp, err := handler(tc.ctx, tc.req) s.Require().NoError(err) s.Require().Len(resp.Txs, tc.expectedTxs) diff --git a/baseapp/testutil/mock/mocks.go b/baseapp/testutil/mock/mocks.go index 8ebbf3b77562..b7ec8a5bd96a 100644 --- a/baseapp/testutil/mock/mocks.go +++ b/baseapp/testutil/mock/mocks.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" + v1 "github.com/cometbft/cometbft/api/cometbft/crypto/v1" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" ) @@ -37,10 +37,10 @@ func (m *MockValidatorStore) EXPECT() *MockValidatorStoreMockRecorder { } // GetPubKeyByConsAddr mocks base method. -func (m *MockValidatorStore) GetPubKeyByConsAddr(arg0 context.Context, arg1 types.ConsAddress) (crypto.PublicKey, error) { +func (m *MockValidatorStore) GetPubKeyByConsAddr(arg0 context.Context, arg1 types.ConsAddress) (v1.PublicKey, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPubKeyByConsAddr", arg0, arg1) - ret0, _ := ret[0].(crypto.PublicKey) + ret0, _ := ret[0].(v1.PublicKey) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/errors/errors.go b/errors/errors.go index 2e5140d72828..4b388e371bd8 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -81,6 +81,27 @@ func ABCIError(codespace string, code uint32, log string) error { return Wrap(&Error{codespace: codespace, code: code, desc: "unknown"}, log) } +// AllRegisteredErrors returns a deep copy of all registered errors. +// The returned map contains error IDs as keys (formatted as "codespace:code") +// and their corresponding Error instances as values. +// +// This function returns a deep copy to prevent external modification of the +// original error registry, ensuring the integrity of registered errors. +func AllRegisteredErrors() map[string]*Error { + // Create a deep copy to prevent external modification of registered errors + copy := make(map[string]*Error, len(usedCodes)) + for key, err := range usedCodes { + // Create a new Error instance with the same values + copy[key] = &Error{ + codespace: err.codespace, + code: err.code, + desc: err.desc, + grpcCode: err.grpcCode, + } + } + return copy +} + // Error represents a root error. // // Weave framework is using root error to categorize issues. Each instance diff --git a/go.mod b/go.mod index a6c3b689f851..78d7f06790ab 100644 --- a/go.mod +++ b/go.mod @@ -213,8 +213,8 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 diff --git a/go.sum b/go.sum index 289e5d63cc63..96c2fb64f744 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/server/start.go b/server/start.go index c081bbb59cbc..b8f50c12858d 100644 --- a/server/start.go +++ b/server/start.go @@ -14,11 +14,14 @@ import ( "strings" "time" + sdkmath "cosmossdk.io/math" + "github.com/cometbft/cometbft/abci/server" cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" cmtcfg "github.com/cometbft/cometbft/config" + tmcrypto "github.com/cometbft/cometbft/crypto" cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/node" "github.com/cometbft/cometbft/p2p" @@ -39,18 +42,24 @@ import ( pruningtypes "cosmossdk.io/store/pruning/types" + tmcryptoed25519 "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdked25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server/api" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" servercmtlog "github.com/cosmos/cosmos-sdk/server/log" "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/telemetry" + sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" "github.com/cosmos/cosmos-sdk/version" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) const ( @@ -109,8 +118,19 @@ const ( KeyNewValAddr = "new-validator-addr" KeyUserPubKey = "user-pub-key" KeyTriggerTestnetUpgrade = "trigger-testnet-upgrade" + + defaultNewChainID = "injective-devnetify-1389" ) +type ExtendedValidator struct { + Validator stakingtypes.Validator + PrivKey tmcrypto.PrivKey +} + +func (v *ExtendedValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + return v.Validator.UnpackInterfaces(unpacker) +} + // StartCmdOptions defines options that can be customized in `StartCmdWithOptions`, type StartCmdOptions struct { // DBOpener can be used to customize db opening, for example customize db options or support different db backends, @@ -646,7 +666,12 @@ func startApp(svrCtx *Context, appCreator types.AppCreator, opts StartCmdOptions } if isTestnet, ok := svrCtx.Viper.Get(KeyIsTestnet).(bool); ok && isTestnet { - app, err = Testnetify(svrCtx, appCreator, db, traceWriter) + validators, err := MockTestnetifyExtendedValidators(svrCtx.Config) + if err != nil { + return app, traceCleanupFn, err + } + + app, err = Testnetify(svrCtx, appCreator, db, traceWriter, validators) if err != nil { return app, traceCleanupFn, err } @@ -763,26 +788,19 @@ you want to test the upgrade handler itself. // Testnetify modifies both state and blockStore, allowing the provided operator address and local validator key to control the network // that the state in the data folder represents. The chainID of the local genesis file is modified to match the provided chainID. -func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, traceWriter io.WriteCloser) (types.Application, error) { - config := ctx.Config +func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, traceWriter io.WriteCloser, validators []ExtendedValidator) (types.Application, error) { + config := ctx.Config newChainID, ok := ctx.Viper.Get(KeyNewChainID).(string) if !ok { return nil, fmt.Errorf("expected string for key %s", KeyNewChainID) } - - // Modify app genesis chain ID and save to genesis file. - genFilePath := config.GenesisFile() - appGen, err := genutiltypes.AppGenesisFromFile(genFilePath) - if err != nil { - return nil, err - } - appGen.ChainID = newChainID - if err := appGen.ValidateAndComplete(); err != nil { - return nil, err + if newChainID == "" { + newChainID = defaultNewChainID } - if err := appGen.SaveAs(genFilePath); err != nil { - return nil, err + + if len(validators) == 0 { + return nil, fmt.Errorf("no validators provided") } // Regenerate addrbook.json to prevent peers on old network from causing error logs. @@ -814,17 +832,6 @@ func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra defer blockStore.Close() defer stateDB.Close() - privValidator, err := pvm.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile(), nil) - if err != nil { - return nil, err - } - - userPubKey, err := privValidator.GetPubKey() - if err != nil { - return nil, err - } - validatorAddress := userPubKey.Address() - stateStore := sm.NewStore(stateDB, sm.StoreOptions{ DiscardABCIResponses: config.Storage.DiscardABCIResponses, }) @@ -834,8 +841,6 @@ func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra return nil, err } - ctx.Viper.Set(KeyNewValAddr, validatorAddress) - ctx.Viper.Set(KeyUserPubKey, userPubKey) testnetApp := testnetAppCreator(ctx.Logger, db, traceWriter, ctx.Viper) // We need to create a temporary proxyApp to get the initial state of the application. @@ -888,6 +893,9 @@ func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra // If there is any other state, we just load the block block, _ = blockStore.LoadBlock(blockStore.Height()) } + if block == nil { + return nil, fmt.Errorf("no block found at height %d", blockStore.Height()) + } block.ChainID = newChainID state.ChainID = newChainID @@ -895,63 +903,124 @@ func Testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra block.LastBlockID = state.LastBlockID block.LastCommit.BlockID = state.LastBlockID + block.LastCommit.Height = blockStore.Height() - // Create a vote from our validator - vote := cmttypes.Vote{ - Type: cmtproto.PrecommitType, - Height: state.LastBlockHeight, - Round: 0, - BlockID: state.LastBlockID, - Timestamp: time.Now(), - ValidatorAddress: validatorAddress, - ValidatorIndex: 0, - Signature: []byte{}, - } - - // Sign the vote, and copy the proto changes from the act of signing to the vote itself - voteProto := vote.ToProto() - err = privValidator.SignVote(newChainID, voteProto, false) - if err != nil { - return nil, err - } - vote.Signature = voteProto.Signature - vote.Timestamp = voteProto.Timestamp + newValSet := &cmttypes.ValidatorSet{Validators: []*cmttypes.Validator{}} - // Modify the block's lastCommit to be signed only by our validator - block.LastCommit.Signatures[0].ValidatorAddress = validatorAddress - block.LastCommit.Signatures[0].Signature = vote.Signature - block.LastCommit.Signatures = []cmttypes.CommitSig{block.LastCommit.Signatures[0]} + totalValidators := len(validators) // e.g. 60 + powerReduction := sdkmath.NewInt(1_000_000_000_000_000_000) // 10^18 + totalVotingPower := int64(10000) + votingPowerPerValidator := totalVotingPower / int64(totalValidators) + var commitSigs []cmttypes.CommitSig + var seenCommitsSigs []cmttypes.CommitSig - // Load the seenCommit of the lastBlockHeight and modify it to be signed from our validator - seenCommit := blockStore.LoadSeenCommit(state.LastBlockHeight) - seenCommit.BlockID = state.LastBlockID - seenCommit.Round = vote.Round - seenCommit.Signatures[0].BlockIDFlag = cmttypes.BlockIDFlagCommit // in case validator 0 vote was absent in this commit - seenCommit.Signatures[0].Signature = vote.Signature - seenCommit.Signatures[0].ValidatorAddress = validatorAddress - seenCommit.Signatures[0].Timestamp = vote.Timestamp - seenCommit.Signatures = []cmttypes.CommitSig{seenCommit.Signatures[0]} - err = blockStore.SaveSeenCommit(state.LastBlockHeight, seenCommit) - if err != nil { - return nil, err - } + for i, extVal := range validators { + // Get the tendermint pubkey from the validator + pubKey, err := GetTmPubKeyFromExtendedValidator(extVal) + if err != nil { + return nil, fmt.Errorf("failed to get validator pubkey for validator[%d]: %w", i, err) + } - // Create ValidatorSet struct containing just our valdiator. - newVal := &cmttypes.Validator{ - Address: validatorAddress, - PubKey: userPubKey, - VotingPower: 900000000000000, - } - newValSet := &cmttypes.ValidatorSet{ - Validators: []*cmttypes.Validator{newVal}, - Proposer: newVal, + valAddress := pubKey.Address() + ctx.Logger.Info("Setting up validator", + "index", i, + "address", fmt.Sprintf("%X", valAddress), + "pubkey", fmt.Sprintf("%X", pubKey.Bytes()), + ) + + // Create a vote from our validator + vote := cmttypes.Vote{ + Type: cmtproto.PrecommitType, + Height: state.LastBlockHeight, + Round: 0, + BlockID: state.LastBlockID, + Timestamp: time.Now(), + ValidatorAddress: valAddress, + ValidatorIndex: int32(i), + Signature: []byte{}, + } + + // Sign the vote, and copy the proto changes from the act of signing to the vote itself + voteProto := vote.ToProto() + signBytes := cmttypes.VoteSignBytes(state.ChainID, voteProto) + // Safety check for missing keys + if extVal.PrivKey == nil { + return nil, fmt.Errorf("PrivKey is nil for validator[%d]: %s", i, extVal.Validator.OperatorAddress) + } + + sig, err := extVal.PrivKey.Sign(signBytes) + if err != nil { + return nil, err + } + voteProto.Signature = sig + vote.Signature = voteProto.Signature + vote.Timestamp = voteProto.Timestamp + + // Modify the block's lastCommit to be signed only by our validator + // Instead of trying to extend existing signatures, just create a fresh signature array + commitSig := cmttypes.CommitSig{ + BlockIDFlag: cmttypes.BlockIDFlagCommit, + ValidatorAddress: valAddress, + Signature: vote.Signature, + Timestamp: vote.Timestamp, + } + commitSigs = append(commitSigs, commitSig) + + // Just create a fresh signature array with one signature + seenCommitSig := cmttypes.CommitSig{ + BlockIDFlag: cmttypes.BlockIDFlagCommit, + ValidatorAddress: valAddress, + Signature: vote.Signature, + Timestamp: vote.Timestamp, + } + seenCommitsSigs = append(seenCommitsSigs, seenCommitSig) + + // To ensure Tokens field aligns with staking module (i.e., Tokens = VotingPower * PowerReduction) + tokensPerValidator := sdkmath.NewInt(votingPowerPerValidator).Mul(powerReduction) + extVal.Validator.Tokens = tokensPerValidator + + newVal := &cmttypes.Validator{ + Address: valAddress, + PubKey: pubKey, + VotingPower: votingPowerPerValidator, + } + + newValSet.Validators = append(newValSet.Validators, newVal) } + newValSet.Proposer = newValSet.Validators[0] // Replace all valSets in state to be the valSet with just our validator. state.Validators = newValSet state.LastValidators = newValSet state.NextValidators = newValSet state.LastHeightValidatorsChanged = blockStore.Height() + block.LastCommit.Signatures = commitSigs + // Load the seenCommit of the lastBlockHeight and modify it to be signed from our validator + seenCommit := blockStore.LoadSeenCommit(state.LastBlockHeight) + if seenCommit == nil { + // If there's no seen commit, we can't proceed with this validator + return nil, fmt.Errorf("no seen commit found for height %d", state.LastBlockHeight) + } + + seenCommit.BlockID = state.LastBlockID + seenCommit.Round = 0 + seenCommit.Signatures = seenCommitsSigs + seenCommit.Height = block.Height + // Fake last seen commit since we are starting from arbitrary height, This ensures the consensus engine doesn’t fail during the handshake or proposal step + err = blockStore.SaveSeenCommit(state.LastBlockHeight, seenCommit) + if err != nil { + return nil, fmt.Errorf("failed to save seen commit: %w", err) + } + + // We need to ensure that priv_validator_state.json is set to first round, this prevent cometbft from crashing + // In cases when we are copying a state from a previous network, that is alrady on round > 0 + pv := pvm.LoadFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile()) + pv.LastSignState.Height = state.LastBlockHeight - 1 + pv.LastSignState.Round = 0 + pv.LastSignState.Step = 0 + pv.LastSignState.Signature = nil + pv.LastSignState.SignBytes = nil + pv.Save() err = stateStore.Save(state) if err != nil { @@ -1056,3 +1125,81 @@ func addStartNodeFlags(cmd *cobra.Command, opts StartCmdOptions) { opts.AddFlags(cmd) } } + +func GetTmPubKeyFromExtendedValidator(ev ExtendedValidator) (tmcrypto.PubKey, error) { + // Use the private key directly if available (most reliable) + if ev.PrivKey != nil { + if edPrivKey, ok := ev.PrivKey.(tmcryptoed25519.PrivKey); ok { + return edPrivKey.PubKey(), nil + } + } + + // If we have a ConsensusPubkey, try to extract it + if ev.Validator.ConsensusPubkey != nil { + // First try to unpack the key using the SDK codec + var pubKeyI cryptotypes.PubKey + registry := codectypes.NewInterfaceRegistry() + registry.RegisterInterface("cosmos.crypto.PubKey", (*cryptotypes.PubKey)(nil)) + registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &sdked25519.PubKey{}) + cdc := codec.NewProtoCodec(registry) + + err := cdc.UnpackAny(ev.Validator.ConsensusPubkey, &pubKeyI) + if err == nil { + if pubKey, ok := pubKeyI.(*sdked25519.PubKey); ok { + // Convert SDK PubKey to Tendermint PubKey + return tmcryptoed25519.PubKey(pubKey.Key), nil + } + } + + // If unpacking fails, check if it's a raw ed25519 key (32 bytes) + anyValue := ev.Validator.ConsensusPubkey.Value + if len(anyValue) == 32 { + return tmcryptoed25519.PubKey(anyValue), nil + } + } + + return nil, fmt.Errorf("could not extract public key from validator") +} + +func MockTestnetifyExtendedValidators(cfg *cmtcfg.Config) ([]ExtendedValidator, error) { + // Load local node's priv validator key + privValidator := pvm.LoadFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()) + pubKey, err := privValidator.GetPubKey() + if err != nil { + return nil, fmt.Errorf("failed to get pubkey from priv validator: %w", err) + } + pubKeySdk := &sdked25519.PubKey{Key: pubKey.Bytes()} + validatorAddress := pubKey.Address().Bytes() + pubkeyAny, err := codectypes.NewAnyWithValue(pubKeySdk) + if err != nil { + return nil, err + } + + validator := stakingtypes.Validator{ + OperatorAddress: sdktypes.ValAddress(validatorAddress).String(), + ConsensusPubkey: pubkeyAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: sdkmath.NewInt(9000000000000000000), + DelegatorShares: sdkmath.LegacyMustNewDecFromStr("100000000000000000000000000000000000"), + Description: stakingtypes.Description{ + Moniker: "Devnet Validator", + }, + Commission: stakingtypes.Commission{ + CommissionRates: stakingtypes.CommissionRates{ + Rate: sdkmath.LegacyMustNewDecFromStr("0.05"), + MaxRate: sdkmath.LegacyMustNewDecFromStr("0.1"), + MaxChangeRate: sdkmath.LegacyMustNewDecFromStr("0.05"), + }, + }, + MinSelfDelegation: sdkmath.OneInt(), + } + + validators := []ExtendedValidator{ + { + Validator: validator, + PrivKey: privValidator.Key.PrivKey, + }, + } + return validators, nil +} diff --git a/simapp/go.mod b/simapp/go.mod index 995fb5275c0c..959e076abfa2 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -251,6 +251,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/simapp/go.sum b/simapp/go.sum index 117c61efb7a1..e4fbe55ace16 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -229,8 +229,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -721,8 +723,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/store/go.mod b/store/go.mod index a0cd6141c9fb..17c37d6bbf14 100644 --- a/store/go.mod +++ b/store/go.mod @@ -80,6 +80,6 @@ require ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/store/go.sum b/store/go.sum index 5dd79bdb1420..d8d9507a3919 100644 --- a/store/go.sum +++ b/store/go.sum @@ -7,8 +7,10 @@ cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -134,8 +136,6 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= diff --git a/tests/go.mod b/tests/go.mod index 81d93229c769..ce66017e5db7 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -247,6 +247,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/tests/go.sum b/tests/go.sum index aebb7570eb26..58db55fc83c9 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -227,8 +227,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -718,8 +720,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 04774bb01826..93b68f51d163 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -942,12 +942,14 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) { }, }, { - name: "happy path (non-staking token)", + name: "invalid coins (non-staking token)", msg: &distrtypes.MsgDepositValidatorRewardsPool{ Depositor: addr.String(), ValidatorAddress: valAddr1.String(), Amount: amt, }, + expErr: true, + expErrMsg: "invalid coins", }, { name: "invalid validator", diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 39d9faef6e26..2e048226018f 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -202,6 +202,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/x/circuit/go.sum b/x/circuit/go.sum index f93cf44fbacb..8c6138c71be5 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -45,8 +45,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -442,8 +444,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 1f4c64e0eb3f..246660371ae4 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -174,6 +174,17 @@ func (k msgServer) DepositValidatorRewardsPool(ctx context.Context, msg *types.M return nil, err } + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, errors.Wrapf(err, "failed to get bond denom") + } + + for _, coin := range msg.Amount { + if coin.Denom != bondDenom { + return nil, errors.Wrapf(sdkerrors.ErrInvalidCoins, "not a bond token denom: %s", coin.Denom) + } + } + // deposit coins from depositor's account to the distribution module if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, msg.Amount); err != nil { return nil, err diff --git a/x/distribution/testutil/expected_keepers_mocks.go b/x/distribution/testutil/expected_keepers_mocks.go index c8d22259d623..c0d339169657 100644 --- a/x/distribution/testutil/expected_keepers_mocks.go +++ b/x/distribution/testutil/expected_keepers_mocks.go @@ -235,6 +235,21 @@ func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { return m.recorder } +// BondDenom mocks base method. +func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BondDenom", ctx) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BondDenom indicates an expected call of BondDenom. +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) +} + // ConsensusAddressCodec mocks base method. func (m *MockStakingKeeper) ConsensusAddressCodec() address.Codec { m.ctrl.T.Helper() diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index 4237bb6691c9..b60a8c37f67f 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -53,6 +53,8 @@ type StakingKeeper interface { GetAllSDKDelegations(ctx context.Context) ([]stakingtypes.Delegation, error) GetAllValidators(ctx context.Context) ([]stakingtypes.Validator, error) GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]stakingtypes.Delegation, error) + + BondDenom(ctx context.Context) (string, error) } // StakingHooks event hooks for staking validator object (noalias) diff --git a/x/evidence/go.mod b/x/evidence/go.mod index b2d3a6c9791e..56831b8224df 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -203,6 +203,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/x/evidence/go.sum b/x/evidence/go.sum index f93cf44fbacb..8c6138c71be5 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -45,8 +45,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -442,8 +444,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 07c94c316622..8c51ce305763 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -200,6 +200,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 3968ea9d2c1d..1eea82f440c5 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -45,8 +45,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -446,8 +448,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/x/nft/go.mod b/x/nft/go.mod index cfaf9270ee7d..930bcbc4b3b2 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -197,6 +197,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/x/nft/go.sum b/x/nft/go.sum index 9d623d47379e..99490f332528 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -16,8 +16,6 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= -cosmossdk.io/x/tx v0.13.7 h1:8WSk6B/OHJLYjiZeMKhq7DK7lHDMyK0UfDbBMxVmeOI= -cosmossdk.io/x/tx v0.13.7/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -49,8 +47,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -446,8 +446,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/x/staking/testutil/expected_keepers_mocks.go b/x/staking/testutil/expected_keepers_mocks.go index e5c5708f3b20..9f49ea6ef195 100644 --- a/x/staking/testutil/expected_keepers_mocks.go +++ b/x/staking/testutil/expected_keepers_mocks.go @@ -10,7 +10,7 @@ import ( address "cosmossdk.io/core/address" math "cosmossdk.io/math" - crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" + v1 "github.com/cometbft/cometbft/api/cometbft/crypto/v1" types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/staking/types" gomock "github.com/golang/mock/gomock" @@ -307,10 +307,10 @@ func (mr *MockValidatorSetMockRecorder) Delegation(arg0, arg1, arg2 interface{}) } // GetPubKeyByConsAddr mocks base method. -func (m *MockValidatorSet) GetPubKeyByConsAddr(arg0 context.Context, arg1 types.ConsAddress) (crypto.PublicKey, error) { +func (m *MockValidatorSet) GetPubKeyByConsAddr(arg0 context.Context, arg1 types.ConsAddress) (v1.PublicKey, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPubKeyByConsAddr", arg0, arg1) - ret0, _ := ret[0].(crypto.PublicKey) + ret0, _ := ret[0].(v1.PublicKey) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/x/tx/internal/testpb/signers.proto b/x/tx/internal/testpb/signers.proto index 63eb38cba43b..8be7c842d3b0 100644 --- a/x/tx/internal/testpb/signers.proto +++ b/x/tx/internal/testpb/signers.proto @@ -92,7 +92,7 @@ message DeeplyNestedRepeatedSigner { message BadSigner { option (cosmos.msg.v1.signer) = "signer"; - bytes signer = 1; + float signer = 1; } message NoSignerOption { diff --git a/x/tx/internal/testpb/signers.pulsar.go b/x/tx/internal/testpb/signers.pulsar.go index f6e3a3d081c1..0f2111d5c5ff 100644 --- a/x/tx/internal/testpb/signers.pulsar.go +++ b/x/tx/internal/testpb/signers.pulsar.go @@ -3,6 +3,7 @@ package testpb import ( _ "cosmossdk.io/api/cosmos/msg/v1" + binary "encoding/binary" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -10,6 +11,7 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" io "io" + math "math" reflect "reflect" sync "sync" ) @@ -7900,8 +7902,8 @@ func (x *fastReflection_BadSigner) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_BadSigner) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Signer) != 0 { - value := protoreflect.ValueOfBytes(x.Signer) + if x.Signer != float32(0) || math.Signbit(float64(x.Signer)) { + value := protoreflect.ValueOfFloat32(x.Signer) if !f(fd_BadSigner_signer, value) { return } @@ -7922,7 +7924,7 @@ func (x *fastReflection_BadSigner) Range(f func(protoreflect.FieldDescriptor, pr func (x *fastReflection_BadSigner) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "BadSigner.signer": - return len(x.Signer) != 0 + return x.Signer != float32(0) || math.Signbit(float64(x.Signer)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: BadSigner")) @@ -7940,7 +7942,7 @@ func (x *fastReflection_BadSigner) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_BadSigner) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "BadSigner.signer": - x.Signer = nil + x.Signer = float32(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: BadSigner")) @@ -7959,7 +7961,7 @@ func (x *fastReflection_BadSigner) Get(descriptor protoreflect.FieldDescriptor) switch descriptor.FullName() { case "BadSigner.signer": value := x.Signer - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfFloat32(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: BadSigner")) @@ -7981,7 +7983,7 @@ func (x *fastReflection_BadSigner) Get(descriptor protoreflect.FieldDescriptor) func (x *fastReflection_BadSigner) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "BadSigner.signer": - x.Signer = value.Bytes() + x.Signer = float32(value.Float()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: BadSigner")) @@ -8018,7 +8020,7 @@ func (x *fastReflection_BadSigner) Mutable(fd protoreflect.FieldDescriptor) prot func (x *fastReflection_BadSigner) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "BadSigner.signer": - return protoreflect.ValueOfBytes(nil) + return protoreflect.ValueOfFloat32(float32(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: BadSigner")) @@ -8088,9 +8090,8 @@ func (x *fastReflection_BadSigner) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Signer) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if x.Signer != 0 || math.Signbit(float64(x.Signer)) { + n += 5 } if x.unknownFields != nil { n += len(x.unknownFields) @@ -8121,12 +8122,11 @@ func (x *fastReflection_BadSigner) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Signer) > 0 { - i -= len(x.Signer) - copy(dAtA[i:], x.Signer) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) + if x.Signer != 0 || math.Signbit(float64(x.Signer)) { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(x.Signer)))) i-- - dAtA[i] = 0xa + dAtA[i] = 0xd } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -8178,39 +8178,16 @@ func (x *fastReflection_BadSigner) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 5 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { + var v uint32 + if (iNdEx + 4) > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Signer = append(x.Signer[:0], dAtA[iNdEx:postIndex]...) - if x.Signer == nil { - x.Signer = []byte{} - } - iNdEx = postIndex + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + x.Signer = float32(math.Float32frombits(v)) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -9386,7 +9363,7 @@ type BadSigner struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Signer []byte `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Signer float32 `protobuf:"fixed32,1,opt,name=signer,proto3" json:"signer,omitempty"` } func (x *BadSigner) Reset() { @@ -9409,11 +9386,11 @@ func (*BadSigner) Descriptor() ([]byte, []int) { return file_signers_proto_rawDescGZIP(), []int{8} } -func (x *BadSigner) GetSigner() []byte { +func (x *BadSigner) GetSigner() float32 { if x != nil { return x.Signer } - return nil + return 0 } type NoSignerOption struct { @@ -9885,7 +9862,7 @@ var file_signers_proto_rawDesc = []byte{ 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x09, 0x42, 0x61, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x69, 0x67, + 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x28, 0x0a, 0x0e, 0x4e, 0x6f, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 8bf01653475a..1043f0941d73 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -231,6 +231,6 @@ replace ( replace ( // Use CometBFT v1.0.1 with Mempool lanes and DOG - github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj - github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 + github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 + github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 ) diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 0a6ac5610bc4..8fdf979120ad 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -227,8 +227,10 @@ github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjv github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/InjectiveLabs/cometbft v1.0.1-inj h1:RWOknL0elsUNrYSk8tJ1UKCe0CCeOMQ80u25hucvpIs= -github.com/InjectiveLabs/cometbft v1.0.1-inj/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2 h1:Dyx74SGOk/RGzwr7oAiAZgKjcGA0Q5fbxQOFlqC0I5w= +github.com/InjectiveLabs/cometbft v1.0.1-inj.2/go.mod h1:RgHHndb7wdtm9etmVj4tDn1NynC9YKIEJW9UUI3FCn4= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 h1:uXsmBVeBickTjZ2GqPNYXShoboRw1m2Cq1bKv4QCe0o= +github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/InjectiveLabs/metrics v0.0.10 h1:BoOwXnCtRRIPmq06jcI20pXZYE758eusaCI5jDOoN4U= github.com/InjectiveLabs/metrics v0.0.10/go.mod h1:eYu++0DVUjk/jjV9WgvCo8gQU+16Yoyhp1iu+ghKNME= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= @@ -716,8 +718,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9 h1:CF4i7hDq39uQaRDBChTiYfGSFGz3KxH5EhJbG9zsOOI= -github.com/injectivelabs/cometbft/api v1.0.1-0.20250315062455-e9e4c8a0ecb9/go.mod h1:Ivh6nSCTJPQOyfQo8dgnyu/T88it092sEqSrZSmTQN8= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=