Skip to content

Commit

Permalink
Fix CI jobs (#43)
Browse files Browse the repository at this point in the history
* Resolve CI and test errors (#34)

* Remove depguard from golangci-lint

* Remove cachix/cachix-action step in integration_tests job

* Remove cachix/cachix-action step from gomod2nix

* Remove cachix/cachix-action step from python-lint

* Remove cache upload job

* Trigger ci tests

* Use go 1.20 for iavl v1

* Use go 1.20 in ci

* Fix yaml parsing 1.20

* Resolve lint issues

* Update ibc-go to v6.1.1, [email protected]

Matches kava, suppresses vuln errors

* Exclude .pb.go from lll linter

* Resolve unused lint errors

* Add get-diff-action step to integration tests

* Update integration_tests nix setup

* Add nix-community/cache-nix-action for integration tests

* test: Fix tracing tests mock error

* ci: Remove codecov upload

* Add goleveldb replace directive to fix version not found errors in test-rpc

* Use json string instead of byte array for tests data clarity

* Ignore lint lll error on server.FlagAPISwagger

* Resolve lint errors

* fix: tx trace gasUsed camel case instead of snake

* Prevent modifying trace response if missing fail or non gas error

* Add note for tracing test

* Revert tracing changes with minimum fix

Avoid large diff and keep it the same for now

* gofumpt

* test: Update test_pruned_node expected error integration test

* Handle connection refused error in integration test

* Restore jose2go version in gomod2nix.toml

* Resolve flake8 lint errors on integration tests

* Add -I nixpkgs=./nix to integration Makefile

* Fix integration-tests CI job

* Update ethermint dependency in upgrade-test-package.nix

* Fix golang linter errors

* Fix python linter errors

* Fix gomod2nix CI job

* Temporary disable Dependency Review job

---------

Co-authored-by: drklee3 <[email protected]>
  • Loading branch information
evgeniy-scherbina and drklee3 authored Apr 11, 2024
1 parent 2939a4d commit 81c3333
Show file tree
Hide file tree
Showing 64 changed files with 1,895 additions and 1,708 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.21'
check-latest: true
- uses: technote-space/[email protected]
id: git_diff
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: "Dependency Review"
on: pull_request
on: workflow_dispatch
# Temporary disable Dependency Review job
# on: pull_request

permissions:
contents: read
Expand All @@ -10,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.21'
check-latest: true
- name: "Checkout Repository"
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.21'
check-latest: true
- name: release dry run
run: make release-dry-run
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.21'
check-latest: true
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand Down Expand Up @@ -58,9 +58,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
with:
name: ethermint
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand All @@ -72,11 +69,13 @@ jobs:
name: Check gomod2nix.toml file is up to date
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v26
with:
name: ethermint
nix_path: nixpkgs=channel:nixos-23.11
- uses: cachix/cachix-action@v14
with:
name: crypto-ethermint
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand All @@ -85,4 +84,5 @@ jobs:
run: |
nix run -f ./nix gomod2nix
git diff --no-ext-diff --exit-code
if: env.GIT_DIFF
# Run gomod2nix job every time, until we're sure it's stable
# if: env.GIT_DIFF
54 changes: 21 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.21"
check-latest: true
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand All @@ -34,20 +34,15 @@ jobs:
run: |
make test-unit-cover
if: env.GIT_DIFF
- uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
if: env.GIT_DIFF
# Coverage at ./coverage.txt is not used for now

test-importer:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.21"
check-latest: true
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand All @@ -68,7 +63,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.21"
check-latest: true
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand All @@ -87,23 +82,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
with:
name: ethermint
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.sol
**/**.go
go.mod
go.sum
tests/integration_tests/**
- uses: actions/setup-go@v3
with:
go-version: "1.21"
check-latest: true

- uses: nixbuild/nix-quick-install-action@v26
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
# restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 1073741824

- name: Run integration tests
run: make run-integration-tests
if: env.GIT_DIFF
- name: 'Tar debug files'
- name: "Tar debug files"
if: failure()
run: tar cfz debug_files.tar.gz -C /tmp/pytest-of-runner .
- uses: actions/upload-artifact@v3
Expand All @@ -112,20 +117,3 @@ jobs:
name: debug-files
path: debug_files.tar.gz
if-no-files-found: ignore

upload-cache:
if: github.event_name == 'push'
needs: ["integration_tests"]
strategy:
matrix:
os: [macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
with:
name: ethermint
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: 'instantiate integration test env'
run: nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)"
6 changes: 5 additions & 1 deletion .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 @@ -44,6 +43,11 @@ issues:
- linters:
- lll
source: "https://"
- path: \.pb.go
linters:
- lll
- path: rpc/websockets.go
text: 'G114: Use of net/http serve function that has no support for setting timeouts'
max-same-issues: 50

linters-settings:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ all: build

build-all: tools build lint test vulncheck

.PHONY: distclean clean build-all
.PHONY: distclean clean build build-all

###############################################################################
### Releasing ###
Expand Down Expand Up @@ -335,10 +335,10 @@ test-import:
go test -run TestImporterTestSuite -v --vet=off github.com/evmos/ethermint/tests/importer

test-rpc:
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 5 -m "rpc" -r "true"

run-integration-tests:
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
@nix-shell -I nixpkgs=./nix ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh

.PHONY: run-integration-tests

Expand Down
4 changes: 0 additions & 4 deletions app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"fmt"

errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -40,12 +39,9 @@ import (
evmtypes "github.com/evmos/ethermint/x/evm/types"
)

var ethermintCodec codec.ProtoCodecMarshaler

func init() {
registry := codectypes.NewInterfaceRegistry()
ethermint.RegisterInterfaces(registry)
ethermintCodec = codec.NewProtoCodec(registry)
}

// Deprecated: NewLegacyCosmosAnteHandlerEip712 creates an AnteHandler to process legacy EIP-712
Expand Down
24 changes: 18 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ var (
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
Expand Down Expand Up @@ -447,10 +447,19 @@ func NewEthermintApp(
govConfig.MaxMetadataLen = 10000
*/
govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.AccountKeeper, app.BankKeeper,
stakingKeeper, app.MsgServiceRouter(), govConfig, authAddr,
appCodec,
keys[govtypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
stakingKeeper,
app.MsgServiceRouter(),
govConfig,
authAddr,
)

// Set legacy router for backwards compatibility with gov v1beta1
govKeeper.SetLegacyRouter(govRouter)

app.StakingKeeper = *stakingKeeper

app.GovKeeper = *govKeeper.SetHooks(
Expand Down Expand Up @@ -496,7 +505,10 @@ func NewEthermintApp(
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
slashing.NewAppModule(
appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper,
app.GetSubspace(slashingtypes.ModuleName),
),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
staking.NewAppModule(appCodec, &app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(&app.UpgradeKeeper),
Expand Down Expand Up @@ -856,12 +868,12 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(legacyevmtypes.ParamKeyTable()) //nolint: staticcheck
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(legacyevmtypes.ParamKeyTable())
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())
return paramsKeeper
}
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

func (app *EthermintApp) RegisterUpgradeHandlers() {
planName := "integration-test-upgrade"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
}
8 changes: 7 additions & 1 deletion app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
})

// update total supply
bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
bankGenesis := banktypes.NewGenesisState(
banktypes.DefaultGenesisState().Params,
balances,
totalSupply,
[]banktypes.Metadata{},
[]banktypes.SendEnabled{},
)
genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis)

return genesisState
Expand Down
6 changes: 2 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ package keys
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"sort"

"encoding/json"

etherminthd "github.com/evmos/ethermint/crypto/hd"

bip39 "github.com/cosmos/go-bip39"
Expand Down Expand Up @@ -198,8 +197,8 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
// Get bip39 mnemonic
var mnemonic, bip39Passphrase string

recover, _ := cmd.Flags().GetBool(flagRecover)
if recover {
shouldRecover, _ := cmd.Flags().GetBool(flagRecover)
if shouldRecover {
mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf)
if err != nil {
return err
Expand Down Expand Up @@ -260,7 +259,7 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}

// Recover key from seed passphrase
if recover {
if shouldRecover {
// Hide mnemonic from output
showMnemonic = false
mnemonic = ""
Expand Down
12 changes: 10 additions & 2 deletions client/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func initGenFiles(
var govGenState govv1.GenesisState
clientCtx.Codec.MustUnmarshalJSON(appGenState[govtypes.ModuleName], &govGenState)

govGenState.DepositParams.MinDeposit[0].Denom = coinDenom
govGenState.Params.MinDeposit[0].Denom = coinDenom
appGenState[govtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&govGenState)

var mintGenState mintypes.GenesisState
Expand Down Expand Up @@ -491,7 +491,15 @@ func collectGenFiles(
return err
}

nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutiltypes.DefaultMessageValidator)
nodeAppState, err := genutil.GenAppStateFromConfig(
clientCtx.Codec,
clientCtx.TxConfig,
nodeConfig,
initCfg,
*genDoc,
genBalIterator,
genutiltypes.DefaultMessageValidator,
)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 81c3333

Please sign in to comment.