Skip to content

Commit

Permalink
Resolve CI and test errors (#34)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
drklee3 authored Feb 8, 2024
1 parent b439e9b commit 877e8fd
Show file tree
Hide file tree
Showing 53 changed files with 2,052 additions and 1,631 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.20'
check-latest: true
- uses: technote-space/[email protected]
id: git_diff
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'
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.20'
check-latest: true
- name: release dry run
run: make release-dry-run
Expand Down
8 changes: 1 addition & 7 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.20'
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 @@ -74,9 +71,6 @@ jobs:
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
with:
name: ethermint
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand Down
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.20"
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.20"
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.20"
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.20"
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)"
4 changes: 3 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,9 @@ issues:
- linters:
- lll
source: "https://"
- path: \.pb.go
linters:
- lll
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
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.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
}
6 changes: 2 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,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 @@ -258,7 +258,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
13 changes: 7 additions & 6 deletions ethereum/eip712/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx"
Expand Down Expand Up @@ -71,13 +72,13 @@ func ConstructUntypedEIP712Data(
func ComputeTypedDataHash(typedData apitypes.TypedData) ([]byte, error) {
domainSeparator, err := typedData.HashStruct("EIP712Domain", typedData.Domain.Map())
if err != nil {
err = sdkerrors.Wrap(err, "failed to pack and hash typedData EIP712Domain")
err = errorsmod.Wrap(err, "failed to pack and hash typedData EIP712Domain")
return nil, err
}

typedDataHash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message)
if err != nil {
err = sdkerrors.Wrap(err, "failed to pack and hash typedData primary type")
err = errorsmod.Wrap(err, "failed to pack and hash typedData primary type")
return nil, err
}

Expand All @@ -97,7 +98,7 @@ func WrapTxToTypedData(
txData := make(map[string]interface{})

if err := json.Unmarshal(data, &txData); err != nil {
return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "failed to JSON unmarshal data")
return apitypes.TypedData{}, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, "failed to JSON unmarshal data")
}

domain := getTypedDataDomain(chainID)
Expand All @@ -110,7 +111,7 @@ func WrapTxToTypedData(
if feeDelegation != nil {
feeInfo, ok := txData["fee"].(map[string]interface{})
if !ok {
return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "cannot parse fee from tx data")
return apitypes.TypedData{}, errorsmod.Wrap(sdkerrors.ErrInvalidType, "cannot parse fee from tx data")
}

feeInfo["feePayer"] = feeDelegation.FeePayer.String()
Expand Down Expand Up @@ -149,15 +150,15 @@ func extractMsgTypes(msgs []sdk.Msg, params evmtypes.Params) (apitypes.Types, er
// ensure eip712 messages implement legacytx.LegacyMsg
_, ok := msg.(legacytx.LegacyMsg)
if !ok {
err := sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "msg %T must implement legacytx.LegacyMsg", (*legacytx.LegacyMsg)(nil))
err := errorsmod.Wrapf(sdkerrors.ErrInvalidType, "msg %T must implement legacytx.LegacyMsg", (*legacytx.LegacyMsg)(nil))
return apitypes.Types{}, err
}

// get corresponding allowed msg from params
msgType := sdk.MsgTypeURL(msg)
allowedMsg := params.EIP712AllowedMsgFromMsgType(msgType)
if allowedMsg == nil {
err := sdkerrors.Wrapf(
err := errorsmod.Wrapf(
sdkerrors.ErrInvalidType,
"eip712 message type \"%s\" is not permitted",
msgType,
Expand Down
15 changes: 9 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/evmos/ethermint

go 1.19
go 1.20

require (
cosmossdk.io/errors v1.0.0-beta.7
Expand All @@ -12,7 +12,7 @@ require (
github.com/cosmos/cosmos-sdk v0.46.16
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.3
github.com/cosmos/ibc-go/v6 v6.1.0
github.com/cosmos/ibc-go/v6 v6.1.1
github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.10.26
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -56,7 +56,7 @@ require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/aws/aws-sdk-go v1.44.122 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
Expand Down Expand Up @@ -114,7 +114,7 @@ require (
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect
Expand All @@ -125,7 +125,7 @@ require (
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.6.1 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
Expand Down Expand Up @@ -183,7 +183,7 @@ require (
github.com/tidwall/btree v1.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.2 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
Expand Down Expand Up @@ -219,5 +219,8 @@ replace (
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
// use cosmos flavored protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

// Downgraded to avoid bugs in following commits which causes "version does not exist" errors
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/kava-labs/cometbft v0.34.31-kava.2
)
Loading

0 comments on commit 877e8fd

Please sign in to comment.