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

Problem: cosmos-sdk 0.46 is not used #828

Merged
merged 34 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7834930
ugprade dependencies and tidy
yihuang Aug 8, 2022
d213eb2
fix build
yihuang Aug 8, 2022
2e3ddda
fix go lint
yihuang Aug 9, 2022
c9c7578
go test ./x/nft/...
yihuang Aug 9, 2022
6e199b8
make test
yihuang Aug 9, 2022
4ed8dc8
update gomod2nix.toml
yihuang Aug 9, 2022
2b52324
remove build time db_backend
yihuang Aug 9, 2022
e1e921a
fixup! fix go lint
yihuang Aug 9, 2022
567cfa3
fixup! remove build time db_backend
yihuang Aug 9, 2022
aa6e445
fix instrumented binary
yihuang Aug 9, 2022
126228a
fix nix build
yihuang Aug 9, 2022
ae5613e
fix integration tests
yihuang Aug 9, 2022
055edb5
fix gov test, deposit not get burn
yihuang Aug 9, 2022
7729321
fix upgrade integration test
yihuang Aug 9, 2022
93d4346
posthandler scaffolding
yihuang Aug 9, 2022
720c5cd
fix upgrade integration test
yihuang Aug 9, 2022
cf37877
fix cmd in integration test
yihuang Aug 10, 2022
9d3ec19
init cmd of ClusterCLI
yihuang Aug 10, 2022
a7d1c44
fix empty upgrade_info
yihuang Aug 10, 2022
62d73b0
Merge branch 'master' into sdk-46
yihuang Aug 10, 2022
bf99a30
go mod tidy and gomod2nix
yihuang Aug 10, 2022
5c96dab
fix build
yihuang Aug 10, 2022
9e26bbc
fixup! fix empty upgrade_info
yihuang Aug 10, 2022
1651de4
Merge remote-tracking branch 'origin/master' into sdk-46
yihuang Aug 10, 2022
b48e949
fix upgrade integration test
yihuang Aug 10, 2022
f884d9f
Merge branch 'master' into sdk-46
yihuang Aug 11, 2022
d1cf1c5
remove wasmvm build tag
yihuang Aug 11, 2022
4adfb00
fix upgrade failure
yihuang Aug 11, 2022
93dee51
update cosmos-sdk for upgrade fix
yihuang Aug 12, 2022
dd02033
Merge remote-tracking branch 'origin/master' into sdk-46
yihuang Aug 15, 2022
8cf0f04
increase sim build timeout
yihuang Aug 15, 2022
a026553
fix sim test
yihuang Aug 15, 2022
30cbacc
cleanup modules
yihuang Aug 15, 2022
4f0cf37
Merge branch 'master' into sdk-46
yihuang Aug 15, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
flags: integration_tests
- name: Tar debug files
if: failure()
run: tar cfz debug_files.tar.gz -C /tmp/pytest-of-runner .
run: tar cfz debug_files.tar.gz -C "$TMPDIR/pytest-of-runner" .
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
127 changes: 92 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,116 @@ GOLANG_CROSS_VERSION = v1.18


VERSION := $(shell echo $(shell git describe --tags 2>/dev/null ) | sed 's/^v//')
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
COMMIT := $(shell git log -1 --format='%H')
NETWORK ?= mainnet
COVERAGE ?= coverage.txt
BUILDDIR ?= $(CURDIR)/build
LEDGER_ENABLED ?= true
# RocksDB is a native dependency, so we don't assume the library is installed.
# Instead, it must be explicitly enabled and we warn when it is not.
ENABLE_ROCKSDB ?= false

export GO111MODULE = on

build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq (secp,$(findstring secp,$(COSMOS_BUILD_OPTIONS)))
build_tags += libsecp256k1_sdk
endif

ifeq ($(ENABLE_ROCKSDB),true)
BUILD_TAGS += rocksdb_build
test_tags += rocksdb_build
else
$(warning RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true)
endif

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
build_tags += gcc
endif
ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=badgerdb
BUILD_TAGS := $(BUILD_TAGS),badgerdb
BUILD_TAGS += badgerdb
endif
# handle rocksdb
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
$(info ################################################################)
$(info To use rocksdb, you need to install rocksdb first)
$(info Please follow this guide https://github.com/rockset/rocksdb-cloud/blob/master/INSTALL.md)
$(info ################################################################)
ifneq ($(ENABLE_ROCKSDB),true)
$(error Cannot use RocksDB backend unless ENABLE_ROCKSDB=true)
endif
CGO_ENABLED=1
BUILD_TAGS := $(BUILD_TAGS),rocksdb
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb
BUILD_TAGS += rocksdb
endif
# handle boltdb
ifeq (boltdb,$(findstring boltdb,$(COSMOS_BUILD_OPTIONS)))
BUILD_TAGS := $(BUILD_TAGS),boltdb
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=boltdb
BUILD_TAGS += boltdb
endif

ifeq ($(NETWORK),testnet)
BUILD_TAGS += testnet
test_tags += testnet
endif

ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=crypto-org-chain-chain \
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=crypto-org-chain-chain \
-X github.com/cosmos/cosmos-sdk/version.AppName=chain-maind \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"

BUILD_FLAGS := -ldflags '$(ldflags)'
TESTNET_FLAGS ?=
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
ldflags += -w -s
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

ledger ?= HID
ifeq ($(LEDGER_ENABLED),true)
BUILD_TAGS := -tags $(BUILD_TAGS),cgo,ledger,!test_ledger_mock,!ledger_mock
ifeq ($(ledger), ZEMU)
BUILD_TAGS := $(BUILD_TAGS),ledger_zemu
else
BUILD_TAGS := $(BUILD_TAGS),!ledger_zemu
endif
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif

ifeq ($(NETWORK),testnet)
BUILD_TAGS := $(BUILD_TAGS),testnet
TEST_TAGS := "--tags=testnet"
# Check for debug option
ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -gcflags "all=-N -l"
endif

TEST_FLAGS := -tags "$(test_tags)"

TESTNET_FLAGS ?=

SIMAPP = github.com/crypto-org-chain/chain-main/v4/app
BINDIR ?= ~/go/bin

Expand All @@ -68,13 +125,13 @@ download:
git submodule update --init --recursive

install: check-network go.sum
go install -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) ./cmd/chain-maind
go install -mod=readonly $(BUILD_FLAGS) ./cmd/chain-maind

build: check-network go.sum
go build -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) -o $(BUILDDIR)/chain-maind ./cmd/chain-maind
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/chain-maind ./cmd/chain-maind

buildwindows: check-network go.sum
go build -buildmode=exe -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) -o $(BUILDDIR)/chain-maind ./cmd/chain-maind
go build -buildmode=exe -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/chain-maind ./cmd/chain-maind


.PHONY: build
Expand All @@ -98,7 +155,7 @@ go.sum: go.mod
GO111MODULE=on go mod verify

test: check-network
@go test $(TEST_TAGS) -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic
@go test $(TEST_FLAGS) -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic
.PHONY: test

# look into .golangci.yml for enabling / disabling linters
Expand All @@ -117,22 +174,22 @@ lint-ci:

test-sim-nondeterminism: check-network
@echo "Running non-determinism test..."
@go test $(TEST_TAGS) -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
@go test $(TEST_FLAGS) -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h

test-sim-custom-genesis-fast: check-network
@echo "Running custom genesis simulation..."
@echo "By default, ${HOME}/.chain-maind/config/genesis.json will be used."
@go test $(TEST_TAGS) -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h
@go test $(TEST_FLAGS) -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h -ExitOnFail

test-sim-import-export:
@echo "Running Chain import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppImportExport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 25 5 TestAppImportExport

test-sim-after-import:
@echo "Running application simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 5 TestAppSimulationAfterImport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport

###############################################################################
### Localnet ###
Expand Down
11 changes: 5 additions & 6 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
"github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante"
"github.com/cosmos/ibc-go/v5/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down Expand Up @@ -34,20 +34,19 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
Loading