Skip to content

Commit

Permalink
test: Fix integration tests (#17)
Browse files Browse the repository at this point in the history
* test: Fix integration tests

* test: Enable upgrade integration tests, Fix lint

* test: Fix pruning integration test

* test: Update poetry.lock

* test: Comment out govulncheck

* test: Fix lint

* test: update nix

* test: Fix nix tests
  • Loading branch information
dudong2 authored Sep 20, 2024
1 parent 79be3ff commit d0d1df0
Show file tree
Hide file tree
Showing 44 changed files with 2,259 additions and 1,591 deletions.
5 changes: 5 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# default: go, gomod2nix
# rocksdb: go, gomod2nix, librocksdb
# full: go, gomod2nix, librocksdb, python env
use flake .#full
TMPDIR=/tmp
8 changes: 5 additions & 3 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- name: "Dependency Review"
uses: actions/dependency-review-action@v3
if: env.GIT_DIFF
- name: "Go vulnerability check"
run: make vulncheck
if: env.GIT_DIFF
# Comment out
# There is no option for skipping cosmos-sdk, go-ethereum, etc. in govulncheck
# - name: "Go vulnerability check"
# run: make vulncheck
# if: env.GIT_DIFF
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
pull_request:
push:
branches:
- '*'
- '*/*'
- main
- release/**

jobs:
cleanup-runs:
Expand Down Expand Up @@ -88,8 +88,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
# tests: [unmarked, upgrade, filter]
tests: [unmarked, filter]
tests: [unmarked, upgrade, filter]
env:
TESTS_TO_RUN: ${{ matrix.tests }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion app/ante/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewAuthzLimiterDecorator(disabledMsgTypes []string) AuthzLimiterDecorator {

func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 0); err != nil {
return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error())
return ctx, errorsmod.Wrap(errortypes.ErrUnauthorized, err.Error())
}
return next(ctx, tx, simulate)
}
Expand Down
4 changes: 2 additions & 2 deletions app/ante/fee_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.FeeTx) (sdk.Coi

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
glDec := sdkmath.LegacyNewDec(int64(gas))
glDec := sdkmath.LegacyNewDec(int64(gas)) //#nosec G115

for i, gp := range minGasPrices {
fee := gp.Amount.Mul(glDec)
Expand All @@ -136,7 +136,7 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.FeeTx) (sdk.Coi
}
}

priority := getTxPriority(feeCoins, int64(gas))
priority := getTxPriority(feeCoins, int64(gas)) //#nosec G115
return feeCoins, priority, nil
}

Expand Down
12 changes: 9 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
Expand Down Expand Up @@ -746,7 +748,7 @@ func NewEthermintApp(

// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
// Make sure it's called after `app.mm` and `app.configurator` are set.
app.RegisterUpgradeHandlers(app.appCodec, app.IBCKeeper.ClientKeeper, app.ConsensusParamsKeeper, app.ParamsKeeper)
app.RegisterUpgradeHandlers(app.appCodec, app.IBCKeeper.ClientKeeper, app.ConsensusParamsKeeper)

autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules))

Expand Down Expand Up @@ -1085,8 +1087,12 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint: staticcheck
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName) // TODO(dudong2): withkeytable
paramsKeeper.Subspace(ibctransfertypes.ModuleName)

keyTable := ibcclienttypes.ParamKeyTable()
keyTable.RegisterParamSet(&ibcconnectiontypes.Params{})
paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())

// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())
Expand Down
10 changes: 0 additions & 10 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations"
Expand All @@ -51,7 +49,6 @@ func (app *EthermintApp) RegisterUpgradeHandlers(
cdc codec.BinaryCodec,
clientKeeper clientkeeper.Keeper,
consensusParamsKeeper consensusparamskeeper.Keeper,
paramsKeeper paramskeeper.Keeper,
) {
planName := "integration-test-upgrade"
// Set param key table for params module migration
Expand All @@ -74,8 +71,6 @@ func (app *EthermintApp) RegisterUpgradeHandlers(
keyTable = govv1.ParamKeyTable() //nolint:staticcheck
case crisistypes.ModuleName:
keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck
case ibctransfertypes.ModuleName:
keyTable = ibctransfertypes.ParamKeyTable()
case evmtypes.ModuleName:
keyTable = evmtypes.ParamKeyTable() //nolint:staticcheck
case feemarkettypes.ModuleName:
Expand Down Expand Up @@ -104,11 +99,6 @@ func (app *EthermintApp) RegisterUpgradeHandlers(
return fromVM, err
}

legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
if err := baseapp.MigrateParams(sdkCtx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore); err != nil {
return fromVM, err
}

// ibc v7.1
// explicitly update the IBC 02-client params, adding the localhost client type
params := clientKeeper.GetParams(sdkCtx)
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
, rev ? "dirty"
}:
let
version = "v0.20.0-rc2";
version = "v0.22.0-sdk50-1";
pname = "ethermintd";
tags = [ "netgo" ];
tags = [ "ledger" "netgo" ];
ldflags = lib.concatStringsSep "\n" ([
"-X github.com/cosmos/cosmos-sdk/version.Name=ethermint"
"-X github.com/cosmos/cosmos-sdk/version.AppName=${pname}"
Expand Down
2 changes: 1 addition & 1 deletion ethereum/eip712/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func createEIP712Domain(chainID uint64) apitypes.TypedDataDomain {
domain := apitypes.TypedDataDomain{
Name: "Cosmos Web3",
Version: "1.0.0",
ChainId: math.NewHexOrDecimal256(int64(chainID)), // #nosec G701
ChainId: math.NewHexOrDecimal256(int64(chainID)), // #nosec G701 G115
VerifyingContract: "cosmos",
Salt: "0",
}
Expand Down
2 changes: 1 addition & 1 deletion ethereum/eip712/eip712_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func LegacyWrapTxToTypedData(
domain := apitypes.TypedDataDomain{
Name: "Cosmos Web3",
Version: "1.0.0",
ChainId: math.NewHexOrDecimal256(int64(chainID)),
ChainId: math.NewHexOrDecimal256(int64(chainID)), //#nosec G115
VerifyingContract: "cosmos",
Salt: "0",
}
Expand Down
168 changes: 168 additions & 0 deletions flake.lock

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

Loading

0 comments on commit d0d1df0

Please sign in to comment.