Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cosmos SDK v47 integration (backport: #1782) #278

Merged
merged 78 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
a1d60e4
integrate with sdk V47 & ibc-go V7
JayT106 Feb 24, 2023
95f3be6
update proto-gen and proto files
JayT106 Feb 24, 2023
f783e5f
fix e2e tests
JayT106 Feb 24, 2023
b99bf1e
tmp
JayT106 Feb 24, 2023
27aa7cb
working tmp
JayT106 Feb 24, 2023
3d99e64
fix rebase conflict
JayT106 Feb 25, 2023
5b6a3db
fix merge conflict
JayT106 Feb 25, 2023
e3f2974
fix test
JayT106 Feb 25, 2023
70e6557
recover makefile changes
JayT106 Feb 27, 2023
e5d1a63
fix lint
JayT106 Feb 27, 2023
285353d
fix protoc-gen-tool script
JayT106 Feb 27, 2023
1cc8df7
update tendermint dependency
JayT106 Feb 28, 2023
1290d89
update btcsuite/btcutil path
JayT106 Mar 1, 2023
b2d5b8b
update gomod2nix
JayT106 Mar 1, 2023
7947fa4
fix Makefile,regen proto files and remove third_party proto
JayT106 Mar 3, 2023
bce7c75
update gomod2nix
JayT106 Mar 3, 2023
1a5af18
fix lint
JayT106 Mar 3, 2023
a35f950
update nix
mmsqe Jun 5, 2023
543ed5e
Merge branch 'sdk-v47-ibc-v7'
mmsqe Jun 5, 2023
39fa7eb
replace cometbft tm-db
mmsqe Jun 5, 2023
270cf86
algo -> key-type
mmsqe Jun 5, 2023
ba22e6d
set mempool
mmsqe Jun 5, 2023
d579f73
set chainId
mmsqe Jun 5, 2023
2a5fefb
update protobuf
mmsqe Jun 5, 2023
fddafc0
fix import
mmsqe Jun 5, 2023
5d170e4
fix test
mmsqe Jun 5, 2023
419d1c0
debug test
mmsqe Jun 5, 2023
94c6694
update nix
mmsqe Jun 5, 2023
a223267
fix btcsuite
mmsqe Jun 5, 2023
a9dbbfe
make proto-gen follow by UPGRADING.md
mmsqe Jun 6, 2023
4dd3e1d
fix sync issue with latest blk
mmsqe Jun 6, 2023
937a3e1
disable depguard
mmsqe Jun 6, 2023
77aaa58
gogo/protobuf -> cosmos/gogoproto
mmsqe Jun 6, 2023
a6ba5d4
no pass chain_id after setup
mmsqe Jun 6, 2023
067c390
fix lint
mmsqe Jun 6, 2023
24d8c2e
fix err msg due to empty version check fix
mmsqe Jun 6, 2023
4722e01
add the crisis store in store upgrades
mmsqe Jun 6, 2023
54aac17
fix lint
mmsqe Jun 6, 2023
9be2499
add consensus upgrade
mmsqe Jun 6, 2023
b90016f
migrate consensus parameters
mmsqe Jun 6, 2023
bc3fbfd
fix lint
mmsqe Jun 7, 2023
e41e077
allow flag overwrite chainId
mmsqe Jun 7, 2023
b739244
fix ConsensusParams
mmsqe Jun 7, 2023
c0371da
fix lint
mmsqe Jun 7, 2023
4c612a3
add paramKeyTable
mmsqe Jun 8, 2023
7227022
add change log
mmsqe Jun 8, 2023
99c004b
err code change due to nested msg check
mmsqe Jun 8, 2023
a0487ff
fix lint
mmsqe Jun 9, 2023
856c815
cleanup mod
mmsqe Jun 8, 2023
30980bb
add nil check for consParams.Block
mmsqe Jun 9, 2023
ad23f7a
Revert "fix ConsensusParams"
mmsqe Jun 9, 2023
aed8238
sdk to v0.47.3 and ibc-go to v7.1.0
mmsqe Jun 9, 2023
d09961e
point to logger fix
mmsqe Jun 9, 2023
2c58a53
get consParams from keeper if not in ctx
mmsqe Jun 15, 2023
331a437
point back cometbft
mmsqe Jun 15, 2023
bcde07c
fix broadcast mode
mmsqe Jun 14, 2023
6222d09
Merge branch 'sdk_v47' into develop
mmsqe Jun 15, 2023
119caa7
fix lint
mmsqe Jun 15, 2023
59b2a0d
Merge branch 'develop' into backport-1782
mmsqe Jun 15, 2023
32d9aef
update default params for test
mmsqe Jun 15, 2023
1426287
cleanup deps
mmsqe Jun 28, 2023
120dde5
fix ibc client route in gov router
mmsqe Jun 28, 2023
09058f8
fix broadcast mode
mmsqe Jun 28, 2023
7597dac
Merge remote-tracking branch 'origin/develop' into backport-1782
mmsqe Jul 11, 2023
d3da450
fix ibctm
mmsqe Jul 26, 2023
7600741
point to sdk cp fix
mmsqe Jun 13, 2023
2d64b85
Update rpc/backend/utils.go
mmsqe Jul 26, 2023
ff04b84
Update rpc/types/utils.go
mmsqe Jul 26, 2023
3dd402f
fix build
mmsqe Jul 26, 2023
949c059
revert get params by consensusparamkeeper
mmsqe Jul 26, 2023
d62ea3f
Merge remote-tracking branch 'origin/develop' into backport-1782
mmsqe Jul 26, 2023
20253ce
keep validator err msg
mmsqe Jul 26, 2023
7d47f70
Revert "keep validator err msg"
mmsqe Jul 27, 2023
766b724
test with more retries
mmsqe Jul 27, 2023
6226643
add expect_cb
mmsqe Jul 27, 2023
2e1ffaa
fix hooks
mmsqe Jul 31, 2023
2f297f9
rm RandomizedParams ProposalContents
mmsqe Jul 31, 2023
a08af41
prune expire state
mmsqe Jul 31, 2023
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
13 changes: 6 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ run:
linters:
enable:
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
Expand Down Expand Up @@ -67,9 +66,9 @@ linters-settings:
gomodguard:
blocked:
versions: # List of blocked module version constraints
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#1741](https://github.com/evmos/ethermint/pull/1741) Add authz ante handler
- (eip712) [#1746](https://github.com/evmos/ethermint/pull/1746) Add EIP712 support for multiple messages and schemas
- (feemarket) [#1790](https://github.com/evmos/ethermint/pull/1790) Raise error when get invalid consensus params
- (deps) [#1782](https://github.com/evmos/ethermint/pull/1782) Bump Cosmos-SDK to v0.47.3 and ibc-go to v7.1.0.

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ build, in which case we can fall back on `go mod tidy -v`.

## Protobuf

We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/gogo/protobuf) to generate code for use in Ethermint.
We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/cosmos/gogoproto) to generate code for use in Ethermint.

For determinstic behavior around Protobuf tooling, everything is containerized using Docker. Make sure to have Docker installed on your machine, or head to [Docker's website](https://docs.docker.com/get-docker/) to install it.

Expand Down
56 changes: 16 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION ?= $(shell echo $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`) | sed 's/^v//')
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
TMVERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
Expand Down Expand Up @@ -255,7 +255,7 @@ endif

ifeq (, $(shell which protoc-gen-go))
@echo "Installing protoc-gen-go..."
@go get github.com/fjl/gencodec github.com/golang/protobuf/protoc-gen-go
@go get github.com/fjl/gencodec google.golang.org/protobuf/cmd/protoc-gen-go
else
@echo "protoc-gen-go already installed; skipping..."
endif
Expand Down Expand Up @@ -392,30 +392,10 @@ format-fix:
### Protobuf ###
###############################################################################

# ------
# NOTE: Link to the tendermintdev/sdk-proto-gen docker images:
# https://hub.docker.com/r/tendermintdev/sdk-proto-gen/tags
#
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
protoImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
# ------
# NOTE: cosmos/proto-builder image is needed because clang-format is not installed
# on the tendermintdev/sdk-proto-gen docker image.
# Link to the cosmos/proto-builder docker images:
# https://github.com/cosmos/cosmos-sdk/pkgs/container/proto-builder
#
protoCosmosVer=0.11.2
protoCosmosName=ghcr.io/cosmos/proto-builder:$(protoCosmosVer)
protoCosmosImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoCosmosName)
# ------
# NOTE: Link to the yoheimuta/protolint docker images:
# https://hub.docker.com/r/yoheimuta/protolint/tags
#
protolintVer=0.42.2
protolintName=yoheimuta/protolint:$(protolintVer)
protolintImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protolintName)

protoVer=0.11.6
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

# ------
# NOTE: If you are experiencing problems running these commands, try deleting
Expand All @@ -426,28 +406,24 @@ proto-all: proto-format proto-lint proto-gen
proto-gen:
@echo "Generating Protobuf files"
$(protoImage) sh ./scripts/protocgen.sh


# TODO: Rethink API docs generation
# proto-swagger-gen:
# @echo "Generating Protobuf Swagger"
# $(protoImage) sh ./scripts/protoc-swagger-gen.sh

proto-format:
@echo "Formatting Protobuf files"
$(protoCosmosImage) find ./ -name *.proto -exec clang-format -i {} \;

# NOTE: The linter configuration lives in .protolint.yaml
proto-lint:
@echo "Linting Protobuf files"
$(protolintImage) lint ./proto
@$(protoImage) buf lint --error-format=json

proto-check-breaking:
@echo "Checking Protobuf files for breaking changes"
$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main

# TODO: Rethink API docs generation
proto-swagger-gen:
@echo "Generating Protobuf Swagger"
$(protoImage) sh ./scripts/protoc-swagger-gen.sh

proto-format:
@echo "Formatting Protobuf files"
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

.PHONY: proto-all proto-gen proto-gen-any proto-format proto-lint proto-check-breaking
.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking

###############################################################################
### Localnet ###
Expand Down
2 changes: 1 addition & 1 deletion app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"runtime/debug"

tmlog "github.com/tendermint/tendermint/libs/log"
tmlog "github.com/cometbft/cometbft/libs/log"

errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
Expand Down
4 changes: 2 additions & 2 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"

Expand All @@ -32,6 +31,7 @@ import (
"github.com/evmos/ethermint/tests"
evmtypes "github.com/evmos/ethermint/x/evm/types"

amino "github.com/cosmos/cosmos-sdk/codec"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)
Expand Down Expand Up @@ -1349,7 +1349,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
func (suite *AnteTestSuite) TestConsumeSignatureVerificationGas() {
params := authtypes.DefaultParams()
msg := []byte{1, 2, 3, 4}
cdc := simapp.MakeTestEncodingConfig().Amino
cdc := amino.NewLegacyAmino()

p := authtypes.DefaultParams()
skR1, _ := secp256r1.GenPrivKey()
Expand Down
6 changes: 3 additions & 3 deletions app/ante/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

abci "github.com/tendermint/tendermint/abci/types"
abci "github.com/cometbft/cometbft/abci/types"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -274,7 +274,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
},
),
},
expectedCode: sdkerrors.ErrUnauthorized.ABCICode(),
expectedCode: sdkerrors.ErrUnpackAny.ABCICode(),
},
{
name: "a MsgExec with nested MsgExec messages that has invalid messages is blocked",
Expand All @@ -287,7 +287,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
},
),
},
expectedCode: sdkerrors.ErrUnauthorized.ABCICode(),
expectedCode: sdkerrors.ErrUnpackAny.ABCICode(),
},
{
name: "a MsgExec with more nested MsgExec messages than allowed and with valid messages is blocked",
Expand Down
2 changes: 1 addition & 1 deletion app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"

ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
Expand Down
4 changes: 2 additions & 2 deletions app/ante/fee_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

"github.com/stretchr/testify/require"

"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -15,8 +17,6 @@ import (
ethermint "github.com/evmos/ethermint/types"
"github.com/evmos/ethermint/x/evm/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

var _ DynamicFeeEVMKeeper = MockEVMKeeper{}
Expand Down
4 changes: 2 additions & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"

evmtypes "github.com/evmos/ethermint/x/evm/types"
)
Expand Down
6 changes: 3 additions & 3 deletions app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"

"cosmossdk.io/simapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
Expand All @@ -53,7 +53,7 @@ import (
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
)

type AnteTestSuite struct {
Expand Down Expand Up @@ -421,7 +421,7 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress
proposalMsgs,
sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100))),
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), from.Bytes()),
"Metadata",
"Metadata", "title", "summary",
)

suite.Require().NoError(err)
Expand Down
Loading
Loading