Skip to content

Commit

Permalink
build(deps): merge upstream main (#32)
Browse files Browse the repository at this point in the history
* feat: onboarding IBC middleware

* fix: recovery test to use ibc/testing

* refactor: package name change v6 -> v7

* docs: module specs

* feat: proto for coinswap module

* feat: swap event emit in ibc callback

* test: convert fail test case added

(cherry picked from commit 4b2176a)

* feat: WIP coinswap module

* refactor: delete migration code

* refactor: coinswap module for Canto

* fix: allowing vesting account

* fix: use ethsecp256k address for Canto address

* fix: emit swap event fix

* test: IBC transfer to a blocked addr

* refactor: remove unnecessary test case

* fix: default params for coinswap and upgrade handler to use the default params

* refactor: package name v7 -> v6

* refactor: remove ibc/testing/simapp

* fix: go mod

* fix: proto for coinswap

* refactor: sort imports and revert unnecessary changes

* fix: package name change v7 -> v6

* fix: bug in AmountOf

* fix: validate params

* remove x/vesting

* remove vesting test in x/recovery

* remove switch case for genesis clawback vesting account

* remove vesting from app.go

* remove vesting from ante

* fix: default max sawp amount

reference github issue: code-423n4/2023-06-canto-findings#36

* fix: swappedAmount in error case

reference github issue: code-423n4/2023-06-canto-findings#71

* remove vesting import from handler_options

* Revert "remove vesting import from handler_options"

This reverts commit 2a152c4.

* remove comment

* remove vesting from ante handler

* remove x/fees and app.go imports

* add decorator to reject msgCreateClawbackVestingAccount in anteHandler

* adding MsgCreateClawbackVestingAccount to authz limiter

* add v6 upgrade handlers

* setup upgrade handler in app.go

* fix: resolve conflicts

* feat: add workflow to build, test, codecov for ci/cd

* fix: seperate antehandler for simulation

* fix: simulation errors

* fix: simulation workflow, update sims.yml, add GOPATH on makefile

* fix: removing unused keeper from handler options

* fix: update simulation target modules, refactor duplicated struct

* remove x/recovery

* remove recovery proto

* remove recovery imports in app.go

* add placeholder for ICS4wrapper in transferKeeper init

* fix: remove recovery from storeKeysPrefixes

* fix: simulation seed randomness was removed to make the ci/cd result deterministic

* chore: add branches rule for workflow

* Merge remote-tracking branch 'origin/canto-main' into onboarding-middleware-conflict-resolve

# Conflicts:
#	app/app.go
#	x/recovery/keeper/ibc_callbacks.go
#	x/recovery/keeper/ibc_callbacks_integration_suite_test.go

(cherry picked from commit 4d45df7)

* Merge remote-tracking branch 'upstream/main' into onboarding-middleware-conflict-resolve

# Conflicts:
#	app/app.go
#	app/app_test.go
#	app/test_helpers.go

(cherry picked from commit ec76588)

* fix: SetupTestingCantoApp

(cherry picked from commit 5ac28de)

* fix: coinswap module is added to simulation manager

(cherry picked from commit ca2307f)

* fix: bug in coinswap module's param change simulation

(cherry picked from commit ba5685f)

* chore: remove deprecated fee, vesting module's proto files

(cherry picked from commit a7c7d17)

* docs: remove deprecated module's on swagger config

* build: fix proto gen, swagger script

(cherry picked from commit f43ce50)

* chore: formatting proto files

* fix: re-generate proto pb.go files

* docs: update swagger, statik

* fix: update swagger for onboarding, coinswap module

* refactor: package version bump v6 -> v7

* refactor: update *.pb.go files

* package version bump from v6 to v7

* chore: apply proto-all after merge

* fix: remove un-used imports and update coinswap sim-op

lstoken can be used as maxToken which is not registered as params. with no-op, we can proceed sim tests.

---------

Co-authored-by: poorphd <bc.park@bharvest.io>
Co-authored-by: T.K. Kwon <tkkwon1998@gmail.com>
Co-authored-by: Byungchul Park <125338011+poorphd@users.noreply.github.com>
Co-authored-by: dongsam <dongsamb@gmail.com>
  • Loading branch information
5 people authored Aug 11, 2023
1 parent d39e530 commit 454af92
Show file tree
Hide file tree
Showing 427 changed files with 20,942 additions and 25,407 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- main
- release/**
- upgrade/**
permissions:
contents: read

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
push:
branches:
- main
- develop

- release/**
- upgrade/**
jobs:
build:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
push:
branches:
- main
- release/**
- upgrade/**
jobs:
cleanup-runs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,7 +36,7 @@ jobs:
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/Canto-Network\/Canto\/v6/g')
filename=$(echo $filename | sed 's/^./github.com\/Canto-Network\/Canto\/v7/g')
echo "Excluding ${filename} from coverage report..."
sed -i "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
Expand Down
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PROJECT := canto
DOCKER_IMAGE := $(NAMESPACE)/$(PROJECT)
COMMIT_HASH := $(shell git rev-parse --short=7 HEAD)
DOCKER_TAG := $(COMMIT_HASH)
REPO=github.com/Canto-Network/Canto/v6
REPO=github.com/Canto-Network/Canto/v7

export GO111MODULE = on

Expand Down Expand Up @@ -94,8 +94,8 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=canto \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION)

testing_ldflags = -X github.com/Canto-Network/Canto/v6/app.enableAdvanceEpoch=true \
-X github.com/Canto-Network/Canto/v6/app.epochPerBlock=5
testing_ldflags = -X github.com/Canto-Network/Canto/v7/app.enableAdvanceEpoch=true \
-X github.com/Canto-Network/Canto/v7/app.epochPerBlock=5

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
Expand Down Expand Up @@ -389,12 +389,12 @@ test-rpc-pending:
test-sim-nondeterminism:
@echo "Running non-determinism test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=20 -BlockSize=100 -Commit=true -Period=1 -v -timeout 10m
-NumBlocks=20 -BlockSize=100 -Commit=true -Seed=42 -Period=1 -v -timeout 10m

test-sim-nondeterminism-long:
@echo "Running non-determinism-long test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=1 -v -timeout 10h
-NumBlocks=100 -BlockSize=200 -Commit=true -Seed=42 -Period=1 -v -timeout 10h

test-sim-custom-genesis-fast:
@echo "Running custom genesis simulation..."
Expand Down Expand Up @@ -493,26 +493,27 @@ containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)

#proto-all: proto-format proto-lint proto-gen
proto-all: proto-format proto-gen
proto-all: proto-format proto-gen proto-swagger-gen update-swagger-docs

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protocgen.sh; fi

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@./scripts/protoc-swagger-gen.sh
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protoc-swagger-gen.sh; fi

proto-format:
@echo "Formatting Protobuf files"
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi

proto-lint:
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
.PHONY: proto-all proto-gen proto-swagger-gen proto-format


TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.15/proto/tendermint
Expand Down
13 changes: 1 addition & 12 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import (
ethante "github.com/evmos/ethermint/app/ante"
evmtypes "github.com/evmos/ethermint/x/evm/types"

cosmosante "github.com/Canto-Network/Canto/v6/app/ante/cosmos"

cosmosante "github.com/Canto-Network/Canto/v7/app/ante/cosmos"
sdkvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"

vestingtypes "github.com/Canto-Network/Canto/v6/x/vesting/types"
)

// HandlerOptions defines the list of module keepers required to run the canto
Expand All @@ -29,7 +26,6 @@ type HandlerOptions struct {
BankKeeper evmtypes.BankKeeper
IBCKeeper *ibckeeper.Keeper
FeeMarketKeeper evmtypes.FeeMarketKeeper
StakingKeeper vestingtypes.StakingKeeper
SlashingKeeper *slashingkeeper.Keeper
EvmKeeper ethante.EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
Expand All @@ -48,9 +44,6 @@ func (options HandlerOptions) Validate() error {
if options.BankKeeper == nil {
return sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.StakingKeeper == nil {
return sdkerrors.Wrap(sdkerrors.ErrLogic, "staking keeper is required for AnteHandler")
}
if options.SlashingKeeper == nil {
return sdkerrors.Wrap(sdkerrors.ErrLogic, "slashing keeper is required for AnteHandler")
}
Expand All @@ -76,7 +69,6 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
ethante.NewEthSigVerificationDecorator(options.EvmKeeper),
ethante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
ethante.NewCanTransferDecorator(options.EvmKeeper),
NewEthVestingTransactionDecorator(options.AccountKeeper),
ethante.NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
ethante.NewEthIncrementSenderSequenceDecorator(options.AccountKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
Expand All @@ -102,7 +94,6 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
NewParamChangeLimitDecorator(options.SlashingKeeper, options.Cdc),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
NewVestingDelegationDecorator(options.AccountKeeper, options.StakingKeeper, options.Cdc),
NewValidatorCommissionDecorator(options.Cdc),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
Expand Down Expand Up @@ -133,7 +124,6 @@ func newCosmosSimulationAnteHandler(options HandlerOptions) sdk.AnteHandler {
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
// NewParamChangeLimitDecorator(options.SlashingKeeper, options.Cdc),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
NewVestingDelegationDecorator(options.AccountKeeper, options.StakingKeeper, options.Cdc),
// NewValidatorCommissionDecorator(options.Cdc),
//ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down Expand Up @@ -162,7 +152,6 @@ func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
NewParamChangeLimitDecorator(options.SlashingKeeper, options.Cdc),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
NewVestingDelegationDecorator(options.AccountKeeper, options.StakingKeeper, options.Cdc),
NewValidatorCommissionDecorator(options.Cdc),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
Expand Down
2 changes: 1 addition & 1 deletion app/ante/param_change_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"time"

"github.com/Canto-Network/Canto/v6/types"
"github.com/Canto-Network/Canto/v7/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down
4 changes: 2 additions & 2 deletions app/ante/param_change_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ante_test
import (
"strconv"

"github.com/Canto-Network/Canto/v6/app/ante"
"github.com/Canto-Network/Canto/v6/types"
"github.com/Canto-Network/Canto/v7/app/ante"
"github.com/Canto-Network/Canto/v7/types"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
Expand Down
2 changes: 1 addition & 1 deletion app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/Canto-Network/Canto/v6/app"
"github.com/Canto-Network/Canto/v7/app"
client "github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
176 changes: 0 additions & 176 deletions app/ante/vesting.go

This file was deleted.

Loading

0 comments on commit 454af92

Please sign in to comment.