Skip to content

Commit

Permalink
fix(test): test related backport (#214)
Browse files Browse the repository at this point in the history
* nix-action fail in CI

* fix: build test on mac by updating to python3.10 (evmos#1437)

* fix: unstable tx_priority test (evmos#1440)

* fix unstable tx_priority test

* Update tests/integration_tests/test_priority.py

Co-authored-by: yihuang <[email protected]>

* Update tests/integration_tests/test_priority.py

Co-authored-by: yihuang <[email protected]>

Co-authored-by: yihuang <[email protected]>
Co-authored-by: Adi Saravanan <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>

* fix: enable `fixIssue172` flag for non-deterministic keyring test (evmos#1447)

* enable fixIssue172 flag for test

for more info, https://github.com/btcsuite/btcutil/pull/182/files

* fix import

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Adi Saravanan <[email protected]>
Co-authored-by: Freddy Caceres <[email protected]>

* fix(tests): avoid error when run benchmark (evmos#1573)

* avoid error when run benchmark

* fix rest benchmark test

Co-authored-by: Federico Kunze Küllmer <[email protected]>

* fix resolve

---------

Co-authored-by: yihuang <[email protected]>
Co-authored-by: Adi Saravanan <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Freddy Caceres <[email protected]>
  • Loading branch information
5 people authored Mar 7, 2023
1 parent 837d0b0 commit 9b24b9b
Show file tree
Hide file tree
Showing 17 changed files with 989 additions and 682 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v19
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: cachix/cachix-action@v12
with:
name: ethermint
Expand All @@ -73,7 +77,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v19
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: cachix/cachix-action@v12
with:
name: ethermint
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v19
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: cachix/cachix-action@v12
with:
name: ethermint
Expand Down Expand Up @@ -142,7 +146,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v19
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: cachix/cachix-action@v12
with:
name: ethermint
Expand Down
18 changes: 13 additions & 5 deletions crypto/hd/algorithm_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package hd

import (
"os"
"strings"
"testing"

Expand All @@ -10,7 +11,6 @@ import (

hdwallet "github.com/miguelmota/go-ethereum-hdwallet"

"github.com/cosmos/cosmos-sdk/codec"
amino "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand All @@ -20,23 +20,29 @@ import (
ethermint "github.com/evmos/ethermint/types"
)

var TestCodec codec.Codec
var TestCodec amino.Codec

func init() {
cdc := codec.NewLegacyAmino()
cdc := amino.NewLegacyAmino()
cryptocodec.RegisterCrypto(cdc)

interfaceRegistry := types.NewInterfaceRegistry()
TestCodec = amino.NewProtoCodec(interfaceRegistry)
enccodec.RegisterInterfaces(interfaceRegistry)
}

const mnemonic = "picnic rent average infant boat squirrel federal assault mercy purity very motor fossil wheel verify upset box fresh horse vivid copy predict square regret"
const (
mnemonic = "picnic rent average infant boat squirrel federal assault mercy purity very motor fossil wheel verify upset box fresh horse vivid copy predict square regret"

// hdWalletFixEnv defines whether the standard (correct) bip39
// derivation path was used, or if derivation was affected by
// https://github.com/btcsuite/btcutil/issues/172
hdWalletFixEnv = "GO_ETHEREUM_HDWALLET_FIX_ISSUE_179"
)

func TestKeyring(t *testing.T) {
dir := t.TempDir()
mockIn := strings.NewReader("")

kr, err := keyring.New("ethermint", keyring.BackendTest, dir, mockIn, TestCodec, EthSecp256k1Option())
require.NoError(t, err)

Expand Down Expand Up @@ -68,7 +74,9 @@ func TestKeyring(t *testing.T) {
privkey := EthSecp256k1.Generate()(bz)
addr := common.BytesToAddress(privkey.PubKey().Address().Bytes())

os.Setenv(hdWalletFixEnv, "true")
wallet, err := hdwallet.NewFromMnemonic(mnemonic)
os.Setenv(hdWalletFixEnv, "")
require.NoError(t, err)

path := hdwallet.MustParseDerivationPath(hdPath)
Expand Down
2 changes: 1 addition & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import sources.nixpkgs {
dotenv = builtins.path { name = "dotenv"; path = ../scripts/.env; };
};
})
(_: pkgs: { test-env = import ./testenv.nix { inherit pkgs; }; })
(_: pkgs: { test-env = pkgs.callPackage ./testenv.nix { }; })
(_: pkgs: {
cosmovisor = pkgs.buildGo118Module rec {
name = "cosmovisor";
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f904e3562aabca382d12f8471ca2330b3f82899a",
"sha256": "1lsa3sjwp1v3nv2jjpkl5lf9dncplwihmavasalg9fq1217pmzmb",
"rev": "ea2c6a6dda1aa35a80139a512a9dee375b0946e7",
"sha256": "0nd4nn9ryqa80ssw3j2kmr8wa73p2xz1hyxp280cdzqlmdfgw1lm",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/f904e3562aabca382d12f8471ca2330b3f82899a.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/ea2c6a6dda1aa35a80139a512a9dee375b0946e7.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
52 changes: 36 additions & 16 deletions nix/testenv.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
{ pkgs }:
pkgs.poetry2nix.mkPoetryEnv {
{ poetry2nix, lib, python310 }:
poetry2nix.mkPoetryEnv {
projectDir = ../tests/integration_tests;
python = pkgs.python39;
overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: {
eth-bloom = super.eth-bloom.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
'';
};

pystarport = super.pystarport.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.poetry ];
}
);
});
python = python310;
overrides = poetry2nix.overrides.withDefaults (lib.composeManyExtensions [
(self: super:
let
buildSystems = {
eth-bloom = [ "setuptools" ];
pystarport = [ "poetry" ];
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
flake8-black = [ "setuptools" ];
multiaddr = [ "setuptools" ];
};
in
lib.mapAttrs
(attr: systems: super.${attr}.overridePythonAttrs
(old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
}))
buildSystems
)
(self: super: {
eth-bloom = super.eth-bloom.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
'';
};
pyyaml-include = super.pyyaml-include.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace "setup()" "setup(version=\"1.3\")"
'';
};
})
]);
}
Loading

0 comments on commit 9b24b9b

Please sign in to comment.