Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion baseapp/abci_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
19 changes: 15 additions & 4 deletions baseapp/abci_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -514,18 +517,26 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection()
}),
req: &abci.PrepareProposalRequest{
Txs: [][]byte{txBz, txBz, txBz, txBz, txBz},
MaxTxBytes: 456,
MaxTxBytes: 465,
},
expectedTxs: 0,
},
"large max tx bytes": {
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{
Expand All @@ -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,
},
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions baseapp/testutil/mock/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Loading
Loading