upgrade to ethermint v0.21.0 #99

Closed
0xmuralik wants to merge 384 commits from murali/update-fork into main
35 changed files with 29987 additions and 1 deletions
Showing only changes of commit fd0e62a067 - Show all commits

View File

@ -102,6 +102,28 @@ jobs:
make test-integration make test-integration
if: env.GIT_DIFF if: env.GIT_DIFF
integration_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v15
- uses: cachix/cachix-action@v10
with:
name: ethermint
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: Run integration tests
run: make run-integration-tests
if: env.GIT_DIFF
- name: 'Tar debug files'
if: failure()
run: tar cfz debug_files.tar.gz -C /tmp/pytest-of-runner .
- uses: actions/upload-artifact@v2
if: failure()
with:
name: debug-files
path: debug_files.tar.gz
if-no-files-found: ignore
test-sim-nondeterminism: test-sim-nondeterminism:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 25 timeout-minutes: 25

3
.gitignore vendored
View File

@ -72,3 +72,6 @@ dependency-graph.png
# Node.js # Node.js
tests/**/node_modules/* tests/**/node_modules/*
tests-solidity/**/node_modules/* tests-solidity/**/node_modules/*
# Nix
/result

View File

@ -320,6 +320,12 @@ test-rpc:
test-integration: test-integration:
./scripts/integration-test-all.sh -t "integration" -q 1 -z 1 -s 2 -m "integration" -r "true" ./scripts/integration-test-all.sh -t "integration" -q 1 -z 1 -s 2 -m "integration" -r "true"
run-integration-tests:
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
.PHONY: run-integration-tests
test-rpc-pending: test-rpc-pending:
./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true" ./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true"

47
default.nix Normal file
View File

@ -0,0 +1,47 @@
{ lib
, buildGoApplication
, nix-gitignore
, rev ? "dirty"
}:
let
version = "v0.17.1";
pname = "ethermintd";
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}"
"-X github.com/cosmos/cosmos-sdk/version.Version=${version}"
"-X github.com/cosmos/cosmos-sdk/version.BuildTags=${lib.concatStringsSep "," tags}"
"-X github.com/cosmos/cosmos-sdk/version.Commit=${rev}"
]);
in
buildGoApplication rec {
inherit pname version tags ldflags;
src = (nix-gitignore.gitignoreSourcePure [
"../*" # ignore all, then add whitelists
"!../x/"
"!../app/"
"!../cmd/"
"!../client/"
"!../server/"
"!../crypto/"
"!../rpc/"
"!../types/"
"!../encoding/"
"!../go.mod"
"!../go.sum"
"!../gomod2nix.toml"
] ./.);
modules = ./gomod2nix.toml;
doCheck = false;
pwd = src; # needed to support replace
subPackages = [ "cmd/ethermintd" ];
CGO_ENABLED = "1";
meta = with lib; {
description = "Ethermint is a scalable and interoperable Ethereum library, built on Proof-of-Stake with fast-finality using the Cosmos SDK which runs on top of Tendermint Core consensus engine.";
homepage = "https://github.com/evmos/ethermint";
license = licenses.asl20;
mainProgram = "ethermintd";
};
}

441
gomod2nix.toml Normal file
View File

@ -0,0 +1,441 @@
schema = 3
[mod]
[mod."filippo.io/edwards25519"]
version = "v1.0.0-beta.2"
hash = "sha256-pcbcYR1Kiarajit0b6f4/SDHap8jkLXmkiblMLWuZrs="
[mod."github.com/99designs/keyring"]
version = "v1.1.7-0.20210622111912-ef00f8ac3d76"
hash = "sha256-oCalyOZWegRgKHZ1GvYHNkrMKh51j8cOE/K4yBPM5Oc="
replaced = "github.com/cosmos/keyring"
[mod."github.com/ChainSafe/go-schnorrkel"]
version = "v0.0.0-20200405005733-88cbf1b4c40d"
hash = "sha256-i8RXZemJGlSjBT35oPm0SawFiBoIU5Pkq5xp4n/rzCY="
[mod."github.com/DataDog/zstd"]
version = "v1.4.5"
hash = "sha256-WFHcU2EFRIIc1wSc0jN2VPeJzBMcZTIN5LFNBFk+NAY="
[mod."github.com/StackExchange/wmi"]
version = "v0.0.0-20180116203802-5d049714c4a6"
hash = "sha256-0yUxhZB3v3ZE3QY36zHs2cJ1S4GXptXIhyAi6sI2nOo="
[mod."github.com/VictoriaMetrics/fastcache"]
version = "v1.6.0"
hash = "sha256-u1dkRJ2Y5+hnYlkyMPm14HxKkAv999bjN622nZDjaBo="
[mod."github.com/Workiva/go-datastructures"]
version = "v1.0.53"
hash = "sha256-W6qOvqu8sokMlZrpOF1SWG138H0/BotywKNLlDF8Zug="
[mod."github.com/armon/go-metrics"]
version = "v0.4.0"
hash = "sha256-mB6EFtn8BZ0u9TcJ6QTYw2SNAr4CnTVOMpiRKaoNH7k="
[mod."github.com/beorn7/perks"]
version = "v1.0.1"
hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4="
[mod."github.com/bgentry/speakeasy"]
version = "v0.1.0"
hash = "sha256-Gt1vj6CFovLnO6wX5u2O4UfecY9V2J9WGw1ez4HMrgk="
[mod."github.com/btcsuite/btcd"]
version = "v0.22.1"
hash = "sha256-hBU+roIELcmbW2Gz7eGZzL9qNA1bakq5wNxqCgs4TKc="
[mod."github.com/btcsuite/btcd/btcec/v2"]
version = "v2.2.0"
hash = "sha256-cwoIqi0SiAaGEBtuQKip9OVirKIeJw5fUoWo7x/xfOc="
[mod."github.com/btcsuite/btcd/chaincfg/chainhash"]
version = "v1.0.1"
hash = "sha256-vix0j/KGNvoKjhlKgVeSLY6un2FHeIEoZWMC4z3yvZ4="
[mod."github.com/btcsuite/btcutil"]
version = "v1.0.3-0.20201208143702-a53e38424cce"
hash = "sha256-4kasJReFcj25JRHx9dJMct3yDkHqVoHGUx5cu45Msfo="
[mod."github.com/cenkalti/backoff/v4"]
version = "v4.1.1"
hash = "sha256-35Dk9c8Om+NSVKGwu8MwJkB8ig8mDLRviCIYbIRAgiE="
[mod."github.com/cespare/xxhash"]
version = "v1.1.0"
hash = "sha256-nVDTtXH9PC3yJ0THaQZEN243UP9xgLi/clt5xRqj3+M="
[mod."github.com/cespare/xxhash/v2"]
version = "v2.1.2"
hash = "sha256-YV9SmXDtmmgQylQUfrUgQLAPfqYexcHxegMBT+IX9qM="
[mod."github.com/coinbase/rosetta-sdk-go"]
version = "v0.7.0"
hash = "sha256-W4cY7vr/+f6zjmO16WxF7XQBhW5mVrEfpYTNcu+y8yo="
[mod."github.com/confio/ics23/go"]
version = "v0.7.0"
hash = "sha256-FjUQfDKtX+/13+UjJzbYPAkgM4GPZ0vk+dKz7/iRetw="
[mod."github.com/cosmos/btcutil"]
version = "v1.0.4"
hash = "sha256-JvcBXBdjdmnaW/nyf/tw/uaOAGn1b78yxrtl2/Rs3kA="
[mod."github.com/cosmos/cosmos-sdk"]
version = "v0.45.6"
hash = "sha256-dImgFIXEL4gDOF0gV7zqZLV7Di5rIpeRYgRpc9sY7k8="
[mod."github.com/cosmos/go-bip39"]
version = "v1.0.0"
hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA="
[mod."github.com/cosmos/gorocksdb"]
version = "v1.2.0"
hash = "sha256-209TcVuXc5s/TcOvNlaQ1HEJAUDTEK3nxPhs+d8TEcY="
[mod."github.com/cosmos/iavl"]
version = "v0.17.3"
hash = "sha256-gRWMH/ijkw569JSYsAVnZljH3Q6ywTTc6P8DdyJKKAk="
[mod."github.com/cosmos/ibc-go/v4"]
version = "v4.0.0-rc0"
hash = "sha256-jH0wAQTWnknL05/CLhnpdFYb4wjEatVMgJttsTqtdJg="
[mod."github.com/cosmos/ledger-cosmos-go"]
version = "v0.11.1"
hash = "sha256-yli+VvVtZmHo2LPvCY6lYVUfcCDn3sBLDL+a8KIlqDA="
[mod."github.com/cosmos/ledger-go"]
version = "v0.9.2"
hash = "sha256-0YI+0A6wFBjiebBwzWOQjkgXkTakCrf7Gjg2xEaQdoM="
[mod."github.com/danieljoos/wincred"]
version = "v1.0.2"
hash = "sha256-jBLslm3UA6IDKlzgW6jIOnqxzOE5JjVx4Hm4LJ+vqPo="
[mod."github.com/davecgh/go-spew"]
version = "v1.1.1"
hash = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI="
[mod."github.com/deckarep/golang-set"]
version = "v1.8.0"
hash = "sha256-ELJKphksU9AOYwV3BtjvwPtUpbZvX9YMmo7eIiauQSc="
[mod."github.com/decred/dcrd/dcrec/secp256k1/v4"]
version = "v4.0.1"
hash = "sha256-JBVRp40dDj0puapoQloV13H6TMjgJiypzYojcDRE2jI="
[mod."github.com/desertbit/timer"]
version = "v0.0.0-20180107155436-c41aec40b27f"
hash = "sha256-abLOtEcomAqCWLphd2X6WkD/ED764w6sa6unox4BXss="
[mod."github.com/dgraph-io/badger/v2"]
version = "v2.2007.2"
hash = "sha256-qd12+k05ooJG+eaD3UN/UK/bUyH8KZQ4GfTnNR/Xw4U="
[mod."github.com/dgraph-io/ristretto"]
version = "v0.0.3"
hash = "sha256-z2vtpbiCNNfaysPEdOCgcyuPVM8jds1bcfegDJaRSew="
[mod."github.com/dgryski/go-farm"]
version = "v0.0.0-20200201041132-a6ae2369ad13"
hash = "sha256-aOMlPwFY36bLiiIx4HonbCYRAhagk5N6HAWN7Ygif+E="
[mod."github.com/dlclark/regexp2"]
version = "v1.4.1-0.20201116162257-a2a8dda75c91"
hash = "sha256-VNNMZIc7NkDg3DVLnqeJNM/KZqkkaZu2/HTLBL8X2xE="
[mod."github.com/dop251/goja"]
version = "v0.0.0-20220405120441-9037c2b61cbf"
hash = "sha256-ueVIwPRUwxzd9+NybuFv1Pvp5tbwl9gGEgXB6cwqzEc="
[mod."github.com/dustin/go-humanize"]
version = "v1.0.0"
hash = "sha256-gy4G1PnHD9iw2MitHX6y1y93qr3C9IncmXL7ttUMDs8="
[mod."github.com/dvsekhvalnov/jose2go"]
version = "v0.0.0-20200901110807-248326c1351b"
hash = "sha256-+ogb8WGT1LQbXmzhpiGd0gWg4x4Wyn5Rt7Soa5Il8hs="
[mod."github.com/edsrzf/mmap-go"]
version = "v1.0.0"
hash = "sha256-k1DYvCqO3BKNcGEve/nMW0RxzMkK2tGfXbUbycqcVSo="
[mod."github.com/ethereum/go-ethereum"]
version = "v1.10.19"
hash = "sha256-7FPnTGcCb8Xd1QVR+6PmGTaHdTY1mm/8osFTW1JLuG8="
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.1"
hash = "sha256-TNXnnC/ZGNY9lInAcES1cBGqIdEljKuh5LH/khVFjVk="
[mod."github.com/fsnotify/fsnotify"]
version = "v1.5.4"
hash = "sha256-iPuInpDAJvDeSTr6to713J/fTOWdQIWlLXWAuWIs2Bw="
[mod."github.com/gballet/go-libpcsclite"]
version = "v0.0.0-20190607065134-2772fd86a8ff"
hash = "sha256-Nr5ocU9s1F2Lhx/Zq6/nIo+KkKEqMjDYOEs3yWRC48g="
[mod."github.com/go-kit/kit"]
version = "v0.12.0"
hash = "sha256-5RkXo6s0oye8etgD5qy+AvkkkNsQ6jc0kWJj6flA4GM="
[mod."github.com/go-kit/log"]
version = "v0.2.1"
hash = "sha256-puLJ+up45X2j9E3lXvBPKqHPKOA/sFAhfCqGxsITW/Y="
[mod."github.com/go-logfmt/logfmt"]
version = "v0.5.1"
hash = "sha256-t50m9ffvW8PiGvO+2svnLI+N/XaWaBS+ZlhwrEQn2gU="
[mod."github.com/go-ole/go-ole"]
version = "v1.2.1"
hash = "sha256-N2SnVxn4YH+jk2aT4/RWLKZMUaoOHTMPP1cS2E5HkIQ="
[mod."github.com/go-sourcemap/sourcemap"]
version = "v2.1.3+incompatible"
hash = "sha256-eXhXPPLnAy/rmt/zDgeqni2G3o58UtnHjR8vHLXvISI="
[mod."github.com/go-stack/stack"]
version = "v1.8.0"
hash = "sha256-26RlTEcAkbewMUtmirKrDGQ1WJlNousp69v7HMopYnI="
[mod."github.com/godbus/dbus"]
version = "v0.0.0-20190726142602-4481cbc300e2"
hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY="
[mod."github.com/gogo/gateway"]
version = "v1.1.0"
hash = "sha256-OHcA3fEGZt4uYn6V5BAaDc47DkH7z0Al+v7MpkfeR8o="
[mod."github.com/gogo/protobuf"]
version = "v1.3.3-alpha.regen.1"
hash = "sha256-TKa//aFXpWH+yK/cN1oaaqhipZpPUovekP6oA9vLIHY="
replaced = "github.com/regen-network/protobuf"
[mod."github.com/golang/protobuf"]
version = "v1.5.2"
hash = "sha256-IVwooaIo46iq7euSSVWTBAdKd+2DUaJ67MtBao1DpBI="
[mod."github.com/golang/snappy"]
version = "v0.0.4"
hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA="
[mod."github.com/google/btree"]
version = "v1.0.0"
hash = "sha256-5gr0RMnlvrzCke3kwpkf92WvW3x5nnKZesoulyoYRC0="
[mod."github.com/google/orderedcode"]
version = "v0.0.1"
hash = "sha256-KrExYovtUQrHGI1mPQf57jGw8soz7eWOC2xqEaV0uGk="
[mod."github.com/google/uuid"]
version = "v1.3.0"
hash = "sha256-QoR55eBtA94T2tBszyxfDtO7/pjZZSGb5vm7U0Xhs0Y="
[mod."github.com/gorilla/handlers"]
version = "v1.5.1"
hash = "sha256-GnBAARgOx1E+hDMQ63SI17hdhGtLQxb31lZOmn5j/pU="
[mod."github.com/gorilla/mux"]
version = "v1.8.0"
hash = "sha256-s905hpzMH9bOLue09E2JmzPXfIS4HhAlgT7g13HCwKE="
[mod."github.com/gorilla/websocket"]
version = "v1.5.0"
hash = "sha256-EYVgkSEMo4HaVrsWKqnsYRp8SSS8gNf7t+Elva02Ofc="
[mod."github.com/grpc-ecosystem/go-grpc-middleware"]
version = "v1.3.0"
hash = "sha256-seaTQMNz/lWzpR3ex2gSM1Yo2yD2q6bJQZvB1L3CONk="
[mod."github.com/grpc-ecosystem/grpc-gateway"]
version = "v1.16.0"
hash = "sha256-wLymGic7wZ6fSiBYDAaGqnQ9Ste1fUWeqXeolZXCHvI="
[mod."github.com/gsterjov/go-libsecret"]
version = "v0.0.0-20161001094733-a6f4afe4910c"
hash = "sha256-Z5upjItPU9onq5t7VzhdQFp13lMJrSiE3gNRapuK6ic="
[mod."github.com/gtank/merlin"]
version = "v0.1.1"
hash = "sha256-tfP9DFdPIfAt29pCta6dObAABCbZt4y3ZActH6ERkr0="
[mod."github.com/gtank/ristretto255"]
version = "v0.1.2"
hash = "sha256-fAoVTP1s5+f7/YtnzI+gaEz1MS+FuCgy3sT19ZHIxE4="
[mod."github.com/hashicorp/go-immutable-radix"]
version = "v1.3.1"
hash = "sha256-65+A2HiVfS/GV9G+6/TkXXjzXhI/V98e6RlJWjxy+mg="
[mod."github.com/hashicorp/golang-lru"]
version = "v0.5.5-0.20210104140557-80c98217689d"
hash = "sha256-w5utLMR7p5pF9xX+mI3N9NyfQ8ixNXNTgfXDu8fudmc="
[mod."github.com/hashicorp/hcl"]
version = "v1.0.0"
hash = "sha256-xsRCmYyBfglMxeWUvTZqkaRLSW+V2FvNodEDjTGg1WA="
[mod."github.com/hdevalence/ed25519consensus"]
version = "v0.0.0-20210204194344-59a8610d2b87"
hash = "sha256-QgOyyg2phYmreWbMzuSgDVY/unUUZhmbFsqvShCKgFs="
[mod."github.com/holiman/bloomfilter/v2"]
version = "v2.0.3"
hash = "sha256-5VsJMQzJSNd4F7yAl3iF/q6JodWOlE4dUvTQ0UGPe+k="
[mod."github.com/holiman/uint256"]
version = "v1.2.0"
hash = "sha256-5CG+o1Q7hpis9Wpp1EFs7nmR1LlDuTK3bf6zsn+JID4="
[mod."github.com/huin/goupnp"]
version = "v1.0.3"
hash = "sha256-EMGmTdoQhP2bVbCPX37hes5krqXn6NFexfnKr9E5u8I="
[mod."github.com/improbable-eng/grpc-web"]
version = "v0.15.0"
hash = "sha256-9oqKb5Y3hjleOFE2BczbEzLH6q2Jg7kUTP/M8Yk4Ne4="
[mod."github.com/inconshreveable/mousetrap"]
version = "v1.0.0"
hash = "sha256-ogTuLrV40FwS4ueo4hh6hi1wPywOI+LyIqfNjsibwNY="
[mod."github.com/jackpal/go-nat-pmp"]
version = "v1.0.2"
hash = "sha256-L1D4Yoxnzihs795GZ+Q3AZsFP5c4iqyjTeyrudzPXtw="
[mod."github.com/jmhodges/levigo"]
version = "v1.0.0"
hash = "sha256-xEd0mDBeq3eR/GYeXjoTVb2sPs8sTCosn5ayWkcgENI="
[mod."github.com/keybase/go-keychain"]
version = "v0.0.0-20190712205309-48d3d31d256d"
hash = "sha256-bn04wkDnhQ0tb/YzmPf7MNJlApOl+z6+EAbUqH7Ti5Q="
[mod."github.com/klauspost/compress"]
version = "v1.13.6"
hash = "sha256-aUTfsB3IfJXil8SPgtAmU1t+l6Dxs03UBB9Pa6StuqM="
[mod."github.com/lib/pq"]
version = "v1.10.6"
hash = "sha256-8EhFwY/9YH5L/fd6l2beOnC3VvpegRAmCCsnDVJBqBM="
[mod."github.com/libp2p/go-buffer-pool"]
version = "v0.0.2"
hash = "sha256-dcgL4tAHDJsevnvwIAXZmtKqB9h4986go/Yn3IlfPAY="
[mod."github.com/magiconair/properties"]
version = "v1.8.6"
hash = "sha256-xToSfpuePctkTdhJtsuKIEkXwfMZbnkFT98ahIfd4wY="
[mod."github.com/mattn/go-isatty"]
version = "v0.0.14"
hash = "sha256-e8zn5eCVh/B1HOP1PGXeXH0bGkIV0vKYP9KLwZni5as="
[mod."github.com/mattn/go-runewidth"]
version = "v0.0.9"
hash = "sha256-dK/kIPe1tcxEubwI4CWfov/HWRBgD/fqlPC3d5i30CY="
[mod."github.com/matttproud/golang_protobuf_extensions"]
version = "v1.0.1"
hash = "sha256-ystDNStxR90j4CK+AMcEQ5oyYFRgWoGdvWlS0XQMDLQ="
[mod."github.com/miguelmota/go-ethereum-hdwallet"]
version = "v0.1.1"
hash = "sha256-SoKy4Mwkbm0J2yQLDcIcBbo/J6auTNdlZslTvJrSknM="
[mod."github.com/mimoo/StrobeGo"]
version = "v0.0.0-20181016162300-f8f6d4d2b643"
hash = "sha256-ih5WfC48IniPuAHUpC6upOabZA1/DssTAcxhZe6A/dE="
[mod."github.com/minio/highwayhash"]
version = "v1.0.2"
hash = "sha256-UeHeepKtToyA5e/w3KdmpbCn+4medesZG0cAcU6P2cY="
[mod."github.com/mitchellh/mapstructure"]
version = "v1.5.0"
hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE="
[mod."github.com/mtibben/percent"]
version = "v0.2.1"
hash = "sha256-Zj1lpCP6mKQ0UUTMs2By4LC414ou+iJzKkK+eBHfEcc="
[mod."github.com/olekukonko/tablewriter"]
version = "v0.0.5"
hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4="
[mod."github.com/onsi/ginkgo/v2"]
version = "v2.1.4"
hash = "sha256-b/5ByIRFvmRp++0oGZCYcHhAFbk4Cborj2BmvmvVzV0="
[mod."github.com/onsi/gomega"]
version = "v1.19.0"
hash = "sha256-0bCCq8v8m2VqUM1zmS0NfXSjMXS39GXB1mTqkyaHVyQ="
[mod."github.com/pelletier/go-toml"]
version = "v1.9.5"
hash = "sha256-RJ9K1BTId0Mled7S66iGgxHkZ5JKEIsrrNaEfM8aImc="
[mod."github.com/pelletier/go-toml/v2"]
version = "v2.0.1"
hash = "sha256-GUj6zkM1ToK4v9pSkdXp07TTGwpnWoj+lPxpg9beSzQ="
[mod."github.com/petermattis/goid"]
version = "v0.0.0-20180202154549-b0b1615b78e5"
hash = "sha256-TCyVuP7rAtrvlterVCapFtbf6UmIf72FXQvkQoDtDj4="
[mod."github.com/pkg/errors"]
version = "v0.9.1"
hash = "sha256-mNfQtcrQmu3sNg/7IwiieKWOgFQOVVe2yXgKBpe/wZw="
[mod."github.com/pmezard/go-difflib"]
version = "v1.0.0"
hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA="
[mod."github.com/prometheus/client_golang"]
version = "v1.12.2"
hash = "sha256-d8xHyML/FImuPmFOy7UGW/y85NPLzJYL6IFhR3s7XzE="
[mod."github.com/prometheus/client_model"]
version = "v0.2.0"
hash = "sha256-LTHxYPRgoggl+v89ly2/RkyPIuJlmZRdGs6ZRtK3zkk="
[mod."github.com/prometheus/common"]
version = "v0.32.1"
hash = "sha256-LdgJBz4EcjrBaZVr2CjDjM0hTwRFQIJE2yACEG631bQ="
[mod."github.com/prometheus/procfs"]
version = "v0.7.3"
hash = "sha256-ik0WpnpSjMwifPYfQTfu/eb5ilNj+eLJF0d5Dftp8A8="
[mod."github.com/prometheus/tsdb"]
version = "v0.7.1"
hash = "sha256-BPz7YJbfMZgeR+u9YaeWeipVzHIS73EdgXD7VSJSLbA="
[mod."github.com/rakyll/statik"]
version = "v0.1.7"
hash = "sha256-/bfnXHBmN8vviPL7D85IzcEVXCaWyjbPPNyauzEcQ8Q="
[mod."github.com/rcrowley/go-metrics"]
version = "v0.0.0-20200313005456-10cdbea86bc0"
hash = "sha256-xHqWWd4/RyAxqb80zjnrqHnHtWPfVTyByE+vDfbT52E="
[mod."github.com/regen-network/cosmos-proto"]
version = "v0.3.1"
hash = "sha256-Bchbq/Hg72EA7Hevs8+PNuENuQaZAzk3qeVjMqFMUxc="
[mod."github.com/rjeczalik/notify"]
version = "v0.9.1"
hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c="
[mod."github.com/rs/cors"]
version = "v1.8.2"
hash = "sha256-FxBbQVb8zIoDGGaAJKfsYV0+POkh1tyX7P6A/Lk5Vsc="
[mod."github.com/rs/zerolog"]
version = "v1.23.0"
hash = "sha256-YxxKu0yJhnx1I9UKR6qd3PKfVWe3hGbFhx0esop46bM="
[mod."github.com/sasha-s/go-deadlock"]
version = "v0.2.1-0.20190427202633-1595213edefa"
hash = "sha256-BBOohTR+ktgJHAoYWh39/ui8MczcJECloc7tvxVBE50="
[mod."github.com/shirou/gopsutil"]
version = "v3.21.4-0.20210419000835-c7a38de76ee5+incompatible"
hash = "sha256-oqIqyFquWabIE6DID6uTEc8oFEmM1rVu2ATn3toiCEg="
[mod."github.com/spf13/afero"]
version = "v1.8.2"
hash = "sha256-ERuG4GK1LOn72DRbT9URpo1QoVIm2A3mPtlf+xSPgx8="
[mod."github.com/spf13/cast"]
version = "v1.5.0"
hash = "sha256-Pdp+wC5FWqyJKzyYHb7JCcV9BoJk/sxQw6nLyuLJvuQ="
[mod."github.com/spf13/cobra"]
version = "v1.5.0"
hash = "sha256-rcyHWrxshA5DVpxrSba5X4NjppqOGrJ64QkUKKnfW2E="
[mod."github.com/spf13/jwalterweatherman"]
version = "v1.1.0"
hash = "sha256-62BQtqTLF/eVrTOr7pUXE7AiHRjOVC8jQs3/Ehmflfs="
[mod."github.com/spf13/pflag"]
version = "v1.0.5"
hash = "sha256-w9LLYzxxP74WHT4ouBspH/iQZXjuAh2WQCHsuvyEjAw="
[mod."github.com/spf13/viper"]
version = "v1.12.0"
hash = "sha256-51kkvy5tGqdyNgQgZWG5WRYnjgCwwGyuIGZsIdPB2n0="
[mod."github.com/status-im/keycard-go"]
version = "v0.0.0-20200402102358-957c09536969"
hash = "sha256-yddXXuu6mEFEO2/K6c1tWymeBKzOcvLQnNsFGRjtfXk="
[mod."github.com/stretchr/testify"]
version = "v1.8.0"
hash = "sha256-LDxBAebK+A06y4vbH7cd1sVBOameIY81Xm8/9OPZh7o="
[mod."github.com/subosito/gotenv"]
version = "v1.3.0"
hash = "sha256-8AjkGo9t2W/VCr1bD6JJXRYUkRFyIOR5ipiAxhHnAEs="
[mod."github.com/syndtr/goleveldb"]
version = "v1.0.1-0.20210819022825-2ae1ddf74ef7"
hash = "sha256-36a4hgVQfwtS2zhylKpQuFhrjdc/Y8pF0dxc26jcZIU="
[mod."github.com/tendermint/btcd"]
version = "v0.1.1"
hash = "sha256-QQl2GWZaKQtd+LQrgx2unkTLI1qye57fCWwJcmCXT/0="
[mod."github.com/tendermint/crypto"]
version = "v0.0.0-20191022145703-50d29ede1e15"
hash = "sha256-NkoZ3hKWZt5Hca49I+1g81x1m6aQGELZ/QGLdb3uHm4="
[mod."github.com/tendermint/go-amino"]
version = "v0.16.0"
hash = "sha256-JW4zO/0vMzf1dXLePOqaMtiLUZgNbuIseh9GV+jQlf0="
[mod."github.com/tendermint/tendermint"]
version = "v0.34.20-0.20220517115723-e6f071164839"
hash = "sha256-9hcZo4gjO92klL5vTIyraYZaKIdNRcoxW/PCdA2m/4s="
[mod."github.com/tendermint/tm-db"]
version = "v0.6.7"
hash = "sha256-hl/3RrBrpkk2zA6dmrNlIYKs1/GfqegSscDSkA5Pjlo="
[mod."github.com/tklauser/go-sysconf"]
version = "v0.3.5"
hash = "sha256-QMf8CPGWnO6LoHtJPBIaY3ebDHmLDJaCAUWwNPtNCoU="
[mod."github.com/tklauser/numcpus"]
version = "v0.2.2"
hash = "sha256-nCxE51VHS97zkLu7Nd6QAWPrMiLQF3eNjqibdhkK1vk="
[mod."github.com/tyler-smith/go-bip39"]
version = "v1.1.0"
hash = "sha256-3YhWBtSwRLGwm7vNwqumphZG3uLBW1vwT9QkQ8JuSjU="
[mod."github.com/zondax/hid"]
version = "v0.9.0"
hash = "sha256-PvXtxXo/3C+DS9ZeGBlr4zXbIpaYNtMqLzxYhusFXNY="
[mod."go.etcd.io/bbolt"]
version = "v1.3.6"
hash = "sha256-DenVAmyN22xUiivk6fdJp4C9ZnUJXCMDUf8E0goRRV4="
[mod."golang.org/x/crypto"]
version = "v0.0.0-20220622213112-05595931fe9d"
hash = "sha256-2c4wvwiQ0DJSJsApfmNoxCxx1siRCiJvW9hhrGlcvds="
[mod."golang.org/x/net"]
version = "v0.0.0-20220520000938-2e3eb7b945c2"
hash = "sha256-uCMgd3uUlLREUdD9CYRbYlbJgRQyOts0jC1Okjk8Al8="
[mod."golang.org/x/sync"]
version = "v0.0.0-20220513210516-0976fa681c29"
hash = "sha256-26T9yWx1pkXjXzBn0yj+trVpXPX6rTtly9pPzwVgAyg="
[mod."golang.org/x/sys"]
version = "v0.0.0-20220520151302-bc2c85ada10a"
hash = "sha256-3xm4LbLhZjjeb8scaNFRa9zYb8z2fZj+/JBcoyXGPR8="
[mod."golang.org/x/term"]
version = "v0.0.0-20210927222741-03fcf44c2211"
hash = "sha256-DsX2xay7Y/0/bikp4vU8ArF0B6KHyqEc37PwgvmjhSs="
[mod."golang.org/x/text"]
version = "v0.3.7"
hash = "sha256-XH2pUzzQx95O0rak00grQvfACfL+EmZiV7ZzJBkX+XY="
[mod."google.golang.org/genproto"]
version = "v0.0.0-20220628213854-d9e0b6570c03"
hash = "sha256-sM4ik5KAdxxNYqhinnE/baQzjKgzrZ8fJURhZarcDO8="
[mod."google.golang.org/grpc"]
version = "v1.33.2"
hash = "sha256-0vOeuHDvRviofJmr4dOzUh4Y1y2X6ujGCcLcICVnQ0Q="
replaced = "google.golang.org/grpc"
[mod."google.golang.org/protobuf"]
version = "v1.28.0"
hash = "sha256-p1cVM3OeEErh1WeNRAg4n3zYm/0qPTPmIiWNjRmJiMQ="
[mod."gopkg.in/ini.v1"]
version = "v1.66.4"
hash = "sha256-PZ5vwf47Pjv7lzaUlm/mIdkIfnwEpmSNYG1UIfGh3M4="
[mod."gopkg.in/natefinch/npipe.v2"]
version = "v2.0.0-20160621034901-c1b8fa8bdcce"
hash = "sha256-ytqeVZqn4kd2uc65HvEjPlpPA2VnBmPfu5DsFlO0o+g="
[mod."gopkg.in/yaml.v2"]
version = "v2.4.0"
hash = "sha256-uVEGglIedjOIGZzHW4YwN1VoRSTK8o0eGZqzd+TNdd0="
[mod."gopkg.in/yaml.v3"]
version = "v3.0.1"
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU="
[mod."nhooyr.io/websocket"]
version = "v1.8.6"
hash = "sha256-DyaiCc/1iELrl6JSpz6WYMtFwUiSCOSoNF8IhSyP1ag="

43
nix/default.nix Normal file
View File

@ -0,0 +1,43 @@
{ sources ? import ./sources.nix, system ? builtins.currentSystem, ... }:
import sources.nixpkgs {
overlays = [
(_: pkgs: {
go = pkgs.go_1_18;
go-ethereum = pkgs.callPackage ./go-ethereum.nix {
inherit (pkgs.darwin) libobjc;
inherit (pkgs.darwin.apple_sdk.frameworks) IOKit;
buildGoModule = pkgs.buildGo118Module;
};
}) # update to a version that supports eip-1559
# https://github.com/NixOS/nixpkgs/pull/179622
(import ./go_1_18_overlay.nix)
(final: prev:
(import "${sources.gomod2nix}/overlay.nix")
(final // {
inherit (final.darwin.apple_sdk_11_0) callPackage;
})
prev)
(pkgs: _:
import ./scripts.nix {
inherit pkgs;
config = {
ethermint-config = ../scripts/ethermint-devnet.yaml;
geth-genesis = ../scripts/geth-genesis.json;
dotenv = builtins.path { name = "dotenv"; path = ../scripts/.env; };
};
})
(_: pkgs: { test-env = import ./testenv.nix { inherit pkgs; }; })
(_: pkgs: {
cosmovisor = pkgs.buildGo118Module rec {
name = "cosmovisor";
src = sources.cosmos-sdk + "/cosmovisor";
subPackages = [ "./cmd/cosmovisor" ];
vendorSha256 = "sha256-b5WxrM1L2e/J6ZrOKwzmi85YuoRw/bPor20zNIenYS8=";
doCheck = false;
};
})
];
config = { };
inherit system;
}

60
nix/go-ethereum.nix Normal file
View File

@ -0,0 +1,60 @@
{ lib, stdenv, buildGoModule, fetchFromGitHub, libobjc, IOKit }:
let
# A list of binaries to put into separate outputs
bins = [
"geth"
"clef"
];
in
buildGoModule rec {
pname = "go-ethereum";
version = "1.10.19";
src = fetchFromGitHub {
owner = "ethereum";
repo = pname;
rev = "v${version}";
sha256 = "0f6n9rg42ph47mvykc9f0lf99yzwqy4jm7mlzyks4l6i6fl1g3q1";
};
vendorSha256 = "1s5yfpk2yn7f3zwjl2fdrh6c63ki2b8rlmnlss27yxibsidaj0yd";
doCheck = false;
outputs = [ "out" ] ++ bins;
# Move binaries to separate outputs and symlink them back to $out
postInstall = lib.concatStringsSep "\n" (
builtins.map (bin: "mkdir -p \$${bin}/bin && mv $out/bin/${bin} \$${bin}/bin/ && ln -s \$${bin}/bin/${bin} $out/bin/") bins
);
subPackages = [
"cmd/abidump"
"cmd/abigen"
"cmd/bootnode"
"cmd/checkpoint-admin"
"cmd/clef"
"cmd/devp2p"
"cmd/ethkey"
"cmd/evm"
"cmd/faucet"
"cmd/geth"
"cmd/p2psim"
"cmd/puppeth"
"cmd/rlpdump"
"cmd/utils"
];
# Fix for usb-related segmentation faults on darwin
propagatedBuildInputs =
lib.optionals stdenv.isDarwin [ libobjc IOKit ];
meta = with lib; {
homepage = "https://geth.ethereum.org/";
description = "Official golang implementation of the Ethereum protocol";
license = with licenses; [ lgpl3Plus gpl3Plus ];
maintainers = with maintainers; [ adisbladis lionello RaghavSood ];
};
}

10
nix/go_1_18_overlay.nix Normal file
View File

@ -0,0 +1,10 @@
final: prev: {
go_1_18 = prev.go_1_18.override ({
inherit (final.darwin.apple_sdk_11_0.frameworks) Security Foundation;
xcbuild = prev.xcbuild.override {
inherit (final.darwin.apple_sdk_11_0) stdenv;
};
} // final.lib.optionalAttrs final.stdenv.isDarwin {
inherit (final.darwin.apple_sdk_11_0) stdenv;
});
}

19
nix/scripts.nix Normal file
View File

@ -0,0 +1,19 @@
{ pkgs
, config
, ethermint ? (import ../. { inherit pkgs; })
}: rec {
start-ethermint = pkgs.writeShellScriptBin "start-ethermint" ''
# rely on environment to provide ethermintd
export PATH=${pkgs.test-env}/bin:$PATH
${../scripts/start-ethermint.sh} ${config.ethermint-config} ${config.dotenv} $@
'';
start-geth = pkgs.writeShellScriptBin "start-geth" ''
export PATH=${pkgs.test-env}/bin:${pkgs.go-ethereum}/bin:$PATH
source ${config.dotenv}
${../scripts/start-geth.sh} ${config.geth-genesis} $@
'';
start-scripts = pkgs.symlinkJoin {
name = "start-scripts";
paths = [ start-ethermint start-geth ];
};
}

50
nix/sources.json Normal file
View File

@ -0,0 +1,50 @@
{
"cosmos-sdk": {
"branch": "main",
"description": ":chains: A Framework for Building High Value Public Blockchains :sparkles:",
"homepage": "https://cosmos.network/",
"owner": "cosmos",
"repo": "cosmos-sdk",
"rev": "7c43d52b2b6f19f9aa89a5374f1db217421b4204",
"sha256": "0fvn5ix8m0vgwpx20a7ngbhlhv96biqyxwznrpkf5cf0zg0kmhhi",
"type": "tarball",
"url": "https://github.com/cosmos/cosmos-sdk/archive/7c43d52b2b6f19f9aa89a5374f1db217421b4204.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"gomod2nix": {
"branch": "master",
"description": "Convert applications using Go modules to Nix expressions",
"homepage": null,
"owner": "tweag",
"repo": "gomod2nix",
"rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58",
"sha256": "0li17ynbg2wg0xqy655m5rmcw905sbv7d4ir35z7s5pg1yhhzxkp",
"type": "tarball",
"url": "https://github.com/tweag/gomod2nix/archive/40d32f82fc60d66402eb0972e6e368aeab3faf58.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "master",
"description": "Nix Packages collection",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f904e3562aabca382d12f8471ca2330b3f82899a",
"sha256": "1lsa3sjwp1v3nv2jjpkl5lf9dncplwihmavasalg9fq1217pmzmb",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/f904e3562aabca382d12f8471ca2330b3f82899a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

174
nix/sources.nix Normal file
View File

@ -0,0 +1,174 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

18
nix/testenv.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs }:
pkgs.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 ];
}
);
});
}

6
scripts/.env Executable file
View File

@ -0,0 +1,6 @@
export PASSWORD='123456'
export VALIDATOR1_MNEMONIC="visit craft resemble online window solution west chuckle music diesel vital settle comic tribe project blame bulb armed flower region sausage mercy arrive release"
export VALIDATOR2_MNEMONIC="direct travel shrug hand twice agent sail sell jump phone velvet pilot mango charge usual multiply orient garment bleak virtual action mention panda vast"
export COMMUNITY_MNEMONIC="notable error gospel wave pair ugly measure elite toddler cost various fly make eye ketchup despair slab throw tribe swarm word fruit into inmate"
export SIGNER1_MNEMONIC="shed crumble dismiss loyal latin million oblige gesture shrug still oxygen custom remove ribbon disorder palace addict again blanket sad flock consider obey popular"
export SIGNER2_MNEMONIC="night renew tonight dinner shaft scheme domain oppose echo summer broccoli agent face guitar surface belt veteran siren poem alcohol menu custom crunch index"

0
scripts/contract-test.sh Normal file → Executable file
View File

56
scripts/ethermint-devnet.yaml Executable file
View File

@ -0,0 +1,56 @@
dotenv: .env
ethermint_9000-1:
cmd: ethermintd
start-flags: "--trace"
app-config:
minimum-gas-prices: 0aphoton
index-events:
- ethereum_tx.ethereumTxHash
json-rpc:
address: "0.0.0.0:{EVMRPC_PORT}"
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
api: "eth,net,web3,debug"
validators:
- coins: 1000000000000000000stake,10000000000000000000000aphoton
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR1_MNEMONIC}
- coins: 1000000000000000000stake,10000000000000000000000aphoton
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR2_MNEMONIC}
accounts:
- name: community
coins: 10000000000000000000000aphoton
mnemonic: ${COMMUNITY_MNEMONIC}
- name: signer1
coins: 20000000000000000000000aphoton
mnemonic: ${SIGNER1_MNEMONIC}
- name: signer2
coins: 30000000000000000000000aphoton
mnemonic: ${SIGNER2_MNEMONIC}
genesis:
consensus_params:
block:
max_bytes: "1048576"
max_gas: "81500000"
app_state:
evm:
params:
evm_denom: aphoton
gov:
voting_params:
voting_period: "10s"
deposit_params:
max_deposit_period: "10s"
min_deposit:
- denom: "aphoton"
amount: "1"
transfer:
params:
receive_enabled: true
send_enabled: true
feemarket:
params:
no_base_fee: false
base_fee: "100000000000"
min_gas_multiplier: "0"

41
scripts/geth-genesis.json Executable file
View File

@ -0,0 +1,41 @@
{
"config": {
"chainId": 9000,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"yoloV3Block": 0,
"londonBlock": 0,
"clique": {
"period": 2,
"epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x60ed6d23",
"extraData": "0x000000000000000000000000000000000000000000000000000000000000000057f96e6b86cdefdb3d412547816a82e3e0ebf9d20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x4db9760",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"57f96e6b86cdefdb3d412547816a82e3e0ebf9d2": {
"balance": "0x21e19e0c9bab2400000"
},
"378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec": {
"balance": "0x21e19e0c9bab2400000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": "100000000000"
}

View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
# explicitly set a short TMPDIR to prevent path too long issue on macosx
export TMPDIR=/tmp
echo "build test contracts"
cd ../tests/integration_tests/contracts
HUSKY_SKIP_INSTALL=1 npm install
npm run typechain
cd ..
nix-shell --run "pytest -vv -s"

31
scripts/start-ethermint.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
CONFIG=$1
if [ -z "$CONFIG" ]; then
echo "No config file supplied"
exit 1
fi
shift
DOTENV=$1
if [ -z "$DOTENV" ]; then
echo "No dotenv file supplied"
exit 1
fi
shift
DATA=$1
if [ -z "$DATA" ]; then
echo "No data directory supplied"
exit 1
fi
shift
echo 'pystarport:'
echo ' config: '$CONFIG
echo ' dotenv: '$DOTENV
echo ' data: '$DATA
pystarport init --config $CONFIG --dotenv $DOTENV --data $DATA $@
supervisord -c $DATA/tasks.ini

58
scripts/start-geth.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/sh
set -e
CONFIG=$1
if [ -z $CONFIG ]; then
echo "No config file supplied"
exit 1
fi
shift
DATA=$1
if [ -z $DATA ]; then
echo "No data directory supplied"
exit 1
fi
shift
geth --datadir $DATA init $CONFIG
pwdfile=$(mktemp /tmp/password.XXXXXX)
tmpfile=$(mktemp /tmp/validator-key.XXXXXX)
cat > $pwdfile << EOF
$PASSWORD
EOF
# import validator key
validator_key=$(python -c """
from eth_account import Account
Account.enable_unaudited_hdwallet_features()
print(Account.from_mnemonic('$VALIDATOR1_MNEMONIC').key.hex().replace('0x',''))
""")
cat > $tmpfile << EOF
$validator_key
EOF
geth --datadir $DATA account import $tmpfile --password $pwdfile
# import community key
community_key=$(python -c """
from eth_account import Account
Account.enable_unaudited_hdwallet_features()
print(Account.from_mnemonic('$COMMUNITY_MNEMONIC').key.hex().replace('0x',''))
""")
cat > $tmpfile << EOF
$community_key
EOF
geth --datadir $DATA account import $tmpfile --password $pwdfile
rm $tmpfile
# start up
geth --networkid 9000 --datadir $DATA --http --http.addr localhost --http.api 'personal,eth,net,web3,txpool,miner' \
-unlock '0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2' --password $pwdfile \
--mine --allow-insecure-unlock \
$@
rm $pwdfile

View File

View File

@ -0,0 +1,82 @@
{
dotenv: '../../../scripts/.env',
'ethermintd_777-1': {
cmd: 'ethermintd',
'start-flags': '--trace',
'app-config': {
'minimum-gas-prices': '0aphoton',
'index-events': ['ethereum_tx.ethereumTxHash'],
'json-rpc': {
address: '0.0.0.0:{EVMRPC_PORT}',
'ws-address': '0.0.0.0:{EVMRPC_PORT_WS}',
api: 'eth,net,web3,debug',
'feehistory-cap': 100,
'block-range-cap': 10000,
'logs-cap': 10000,
},
},
validators: [{
coins: '1000000000000000000stake,10000000000000000000000aphoton',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR1_MNEMONIC}',
}, {
coins: '1000000000000000000stake,10000000000000000000000aphoton',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR2_MNEMONIC}',
}],
accounts: [{
name: 'community',
coins: '10000000000000000000000aphoton',
mnemonic: '${COMMUNITY_MNEMONIC}',
}, {
name: 'signer1',
coins: '20000000000000000000000aphoton',
mnemonic: '${SIGNER1_MNEMONIC}',
}, {
name: 'signer2',
coins: '30000000000000000000000aphoton',
mnemonic: '${SIGNER2_MNEMONIC}',
}],
genesis: {
consensus_params: {
block: {
max_bytes: '1048576',
max_gas: '81500000',
},
},
app_state: {
evm: {
params: {
evm_denom: 'aphoton',
},
},
gov: {
voting_params: {
voting_period: '10s',
},
deposit_params: {
max_deposit_period: '10s',
min_deposit: [
{
denom: 'aphoton',
amount: '1',
},
],
},
},
transfer: {
params: {
receive_enabled: true,
send_enabled: true,
},
},
feemarket: {
params: {
no_base_fee: false,
base_fee: '100000000000',
},
},
},
},
},
}

View File

@ -0,0 +1,32 @@
import pytest
from .network import setup_ethermint, setup_geth
@pytest.fixture(scope="session")
def ethermint(tmp_path_factory):
path = tmp_path_factory.mktemp("ethermint")
yield from setup_ethermint(path, 26650)
@pytest.fixture(scope="session")
def geth(tmp_path_factory):
path = tmp_path_factory.mktemp("geth")
yield from setup_geth(path, 8545)
@pytest.fixture(scope="session", params=["ethermint", "geth", "ethermint-ws"])
def cluster(request, ethermint, geth):
"""
run on both ethermint and geth
"""
provider = request.param
if provider == "ethermint":
yield ethermint
elif provider == "geth":
yield geth
elif provider == "ethermint-ws":
ethermint_ws = ethermint.copy()
ethermint_ws.use_websocket()
yield ethermint_ws
else:
raise NotImplementedError

View File

@ -0,0 +1,11 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types
#Hardhat files
cache
artifacts

View File

@ -0,0 +1,13 @@
# Sample Hardhat Project
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
```shell
npx hardhat help
npx hardhat test
GAS_REPORT=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.js
```

View File

@ -0,0 +1,9 @@
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestERC20A is ERC20 {
constructor() public ERC20("TestERC20", "Test") {
_mint(msg.sender, 100000000000000000000000000);
}
}

View File

@ -0,0 +1,23 @@
import { HardhatUserConfig } from "hardhat/config";
import "hardhat-typechain";
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.10",
settings: {
optimizer: {
enabled: true
}
}
},
],
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
};
export default config;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
{
"name": "contracts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"typechain": "npx hardhat typechain"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@openzeppelin/contracts": "^4.7.0",
"@typechain/ethers-v5": "^5.0.0",
"hardhat": "^2.10.1",
"hardhat-typechain": "^0.3.5",
"ts-generator": "^0.1.1",
"typechain": "^4.0.3"
},
"devDependencies": {
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
}
}

View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}

View File

@ -0,0 +1,123 @@
import json
import os
import signal
import subprocess
from pathlib import Path
import tomlkit
import web3
from pystarport import ports
from web3.middleware import geth_poa_middleware
from .utils import wait_for_port
class Ethermint:
def __init__(self, base_dir):
self._w3 = None
self.base_dir = base_dir
self.config = json.loads((base_dir / "config.json").read_text())
self.enable_auto_deployment = False
self._use_websockets = False
def copy(self):
return Ethermint(self.base_dir)
@property
def w3_http_endpoint(self, i=0):
port = ports.evmrpc_port(self.base_port(i))
return f"http://localhost:{port}"
@property
def w3_ws_endpoint(self, i=0):
port = ports.evmrpc_ws_port(self.base_port(i))
return f"ws://localhost:{port}"
@property
def w3(self, i=0):
if self._w3 is None:
if self._use_websockets:
self._w3 = web3.Web3(
web3.providers.WebsocketProvider(self.w3_ws_endpoint)
)
else:
self._w3 = web3.Web3(web3.providers.HTTPProvider(self.w3_http_endpoint))
return self._w3
def base_port(self, i):
return self.config["validators"][i]["base_port"]
def node_rpc(self, i):
return "tcp://127.0.0.1:%d" % ports.rpc_port(self.base_port(i))
def use_websocket(self, use=True):
self._w3 = None
self._use_websockets = use
class Geth:
def __init__(self, w3):
self.w3 = w3
def setup_ethermint(path, base_port):
cfg = Path(__file__).parent / "../../scripts/ethermint-devnet.yaml"
yield from setup_custom_ethermint(path, base_port, cfg)
def setup_geth(path, base_port):
with (path / "geth.log").open("w") as logfile:
cmd = [
"start-geth",
path,
"--http.port",
str(base_port),
"--port",
str(base_port + 1),
]
print(*cmd)
proc = subprocess.Popen(
cmd,
preexec_fn=os.setsid,
stdout=logfile,
stderr=subprocess.STDOUT,
)
try:
wait_for_port(base_port)
w3 = web3.Web3(web3.providers.HTTPProvider(f"http://127.0.0.1:{base_port}"))
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
yield Geth(w3)
finally:
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
# proc.terminate()
proc.wait()
def setup_custom_ethermint(path, base_port, config, post_init=None, chain_binary=None):
cmd = [
"pystarport",
"init",
"--config",
config,
"--data",
path,
"--base_port",
str(base_port),
"--no_remove",
]
if chain_binary is not None:
cmd = cmd[:1] + ["--cmd", chain_binary] + cmd[1:]
print(*cmd)
subprocess.run(cmd, check=True)
if post_init is not None:
post_init(path, base_port, config)
proc = subprocess.Popen(
["pystarport", "start", "--data", path, "--quiet"],
preexec_fn=os.setsid,
)
try:
wait_for_port(ports.evmrpc_port(base_port))
wait_for_port(ports.evmrpc_ws_port(base_port))
yield Ethermint(path / "ethermint_9000-1")
finally:
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
proc.wait()

1898
tests/integration_tests/poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
[tool.poetry]
name = "integration_tests"
version = "0.1.0"
description = ""
authors = ["chain-dev <chain@crypto.com>"]
[tool.poetry.dependencies]
python = "^3.8"
pytest = "^7.0.1"
pytest-github-actions-annotate-failures = "^0.1.1"
flake8 = "^4.0.1"
black = "^22.3.0"
flake8-black = "^0.3.2"
flake8-isort = "^4.1.1"
pep8-naming = "^0.11.1"
protobuf = "^3.13.0"
grpcio = "^1.33.2"
PyYAML = "^5.3.1"
python-dateutil = "^2.8.1"
web3 = "^5.20.1"
eth-bloom = "^1.0.4"
python-dotenv = "^0.19.2"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
websockets = "^9.1"
toml = "^0.10.2"
pysha3 = "^1.0.2"
jsonnet = "^0.18.0"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

View File

@ -0,0 +1,12 @@
{ system ? builtins.currentSystem, pkgs ? import ../../nix { inherit system; } }:
pkgs.mkShell {
buildInputs = [
pkgs.jq
(pkgs.callPackage ../../. { }) # ethermintd
pkgs.start-scripts
pkgs.go-ethereum
pkgs.cosmovisor
pkgs.nodejs
pkgs.test-env
];
}

View File

@ -0,0 +1,3 @@
def test_basic(cluster):
w3 = cluster.w3
assert w3.eth.chain_id == 9000

View File

@ -0,0 +1,16 @@
import socket
import time
def wait_for_port(port, host="127.0.0.1", timeout=40.0):
start_time = time.perf_counter()
while True:
try:
with socket.create_connection((host, port), timeout=timeout):
break
except OSError as ex:
time.sleep(0.1)
if time.perf_counter() - start_time >= timeout:
raise TimeoutError(
"Waited too long for the port {} on host {} to start accepting "
"connections.".format(port, host)
) from ex