From f9f2c05625d919b0173939904491f47d9286e38d Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 5 Aug 2024 14:43:00 +0200 Subject: [PATCH 01/26] chore: cleanup Makefile and go.mod --- Makefile | 16 ++-- go.mod | 277 ++++++++++++++++++++++++++----------------------------- 2 files changed, 139 insertions(+), 154 deletions(-) diff --git a/Makefile b/Makefile index 5788975d79..e850115758 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ .PHONY: build +PACKAGE_NAME := github.com/zeta-chain/node VERSION := $(shell ./version.sh) COMMIT := $(shell [ -z "${COMMIT_ID}" ] && git log -1 --format='%H' || echo ${COMMIT_ID} ) BUILDTIME := $(shell date -u +"%Y%m%d.%H%M%S" ) @@ -8,7 +9,9 @@ DOCKER ?= docker # useful for setting profiles DOCKER_COMPOSE ?= $(DOCKER) compose $(COMPOSE_ARGS) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf -GOFLAGS:="" +GOFLAGS := "" +GOLANG_CROSS_VERSION ?= v1.20.7 +GOPATH ?= '$(HOME)/go' ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored \ @@ -23,7 +26,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger -TEST_DIR?="./..." +TEST_DIR ?= "./..." TEST_BUILD_FLAGS := -tags pebbledb,ledger HSM_BUILD_FLAGS := -tags pebbledb,ledger,hsm_test @@ -53,11 +56,11 @@ go.sum: go.mod ### Test commands ### ############################################################################### +test: clean-test-dir run-test + run-test: @go test ${TEST_BUILD_FLAGS} ${TEST_DIR} -test :clean-test-dir run-test - test-hsm: @go test ${HSM_BUILD_FLAGS} ${TEST_DIR} @@ -288,7 +291,6 @@ zetanode-upgrade: zetanode .PHONY: zetanode-upgrade endif - start-upgrade-test: zetanode-upgrade @echo "--> Starting upgrade test" export LOCALNET_MODE=upgrade && \ @@ -301,7 +303,6 @@ start-upgrade-test-light: zetanode-upgrade export UPGRADE_HEIGHT=90 && \ cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d - start-upgrade-test-admin: zetanode-upgrade @echo "--> Starting admin upgrade test" export LOCALNET_MODE=upgrade && \ @@ -321,9 +322,6 @@ start-upgrade-import-mainnet-test: zetanode-upgrade ### GoReleaser ### ############################################################################### -PACKAGE_NAME := github.com/zeta-chain/node -GOLANG_CROSS_VERSION ?= v1.20.7 -GOPATH ?= '$(HOME)/go' release-dry-run: docker run \ --rm \ diff --git a/go.mod b/go.mod index 7f952f66a6..c116ce3118 100644 --- a/go.mod +++ b/go.mod @@ -5,158 +5,95 @@ go 1.22.2 toolchain go1.22.5 require ( + cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.3.0 + cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d + cosmossdk.io/tools/rosetta v0.2.1 + github.com/99designs/keyring v1.2.1 + github.com/btcsuite/btcd v0.23.4 + github.com/btcsuite/btcd/btcec/v2 v2.3.2 + github.com/btcsuite/btcd/btcutil v1.1.3 + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce + github.com/cenkalti/backoff/v4 v4.3.0 + github.com/cockroachdb/errors v1.11.1 + github.com/coinbase/rosetta-sdk-go v0.7.9 + github.com/cometbft/cometbft v0.37.4 + github.com/cometbft/cometbft-db v0.12.0 + github.com/cosmos/btcutil v1.0.5 github.com/cosmos/cosmos-sdk v0.47.10 github.com/cosmos/gogoproto v1.4.10 + github.com/cosmos/ibc-go/v7 v7.4.0 + github.com/davecgh/go-spew v1.1.1 + github.com/emicklei/proto v1.11.1 github.com/ethereum/go-ethereum v1.10.26 + github.com/evmos/ethermint v0.22.0 + github.com/fatih/color v1.13.0 + github.com/frumioj/crypto11 v1.2.5-0.20210823151709-946ce662cc0e github.com/gagliardetto/solana-go v1.10.0 - github.com/gogo/protobuf v1.3.3 // indirect + github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 + github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-getter v1.7.5 + github.com/huandu/skiplist v1.2.0 + github.com/improbable-eng/grpc-web v0.15.0 + github.com/libp2p/go-libp2p v0.27.8 + github.com/libp2p/go-libp2p-kad-dht v0.24.2 github.com/multiformats/go-multiaddr v0.9.0 + github.com/nanmu42/etherscan-api v1.10.0 + github.com/near/borsh-go v0.3.1 + github.com/onrik/ethrpc v1.2.0 + github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.14.0 + github.com/rakyll/statik v0.1.7 + github.com/rs/cors v1.8.3 github.com/rs/zerolog v1.32.0 + github.com/samber/lo v1.46.0 + github.com/spf13/afero v1.11.0 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.9.0 - github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - gitlab.com/thorchain/tss/go-tss v1.6.5 - google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/grpc v1.60.1 - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c -) - -require ( - cosmossdk.io/errors v1.0.1 - cosmossdk.io/math v1.3.0 - github.com/99designs/keyring v1.2.1 - github.com/btcsuite/btcd v0.23.4 - github.com/btcsuite/btcd/btcec/v2 v2.3.2 - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 - github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce - github.com/emicklei/proto v1.11.1 - github.com/evmos/ethermint v0.22.0 - github.com/fatih/color v1.13.0 - github.com/frumioj/crypto11 v1.2.5-0.20210823151709-946ce662cc0e - github.com/pkg/errors v0.9.1 - github.com/rakyll/statik v0.1.7 github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2 github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240418181724-c222fd3ae1f5 + gitlab.com/thorchain/tss/go-tss v1.6.5 + gitlab.com/thorchain/tss/tss-lib v0.2.0 + go.nhat.io/grpcmock v0.25.0 + golang.org/x/crypto v0.23.0 + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb + golang.org/x/net v0.25.0 + golang.org/x/sync v0.7.0 google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/yaml.v2 v2.4.0 -) - -require ( - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect - github.com/mattn/go-sqlite3 v1.14.19 // indirect + gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/sqlite v1.4.4 gorm.io/gorm v1.24.6 ) -require ( - cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d - cosmossdk.io/tools/rosetta v0.2.1 - github.com/btcsuite/btcd/btcutil v1.1.3 - github.com/cockroachdb/errors v1.11.1 - github.com/cometbft/cometbft v0.37.4 - github.com/cometbft/cometbft-db v0.12.0 - github.com/golang/mock v1.6.0 - github.com/huandu/skiplist v1.2.0 - github.com/nanmu42/etherscan-api v1.10.0 - github.com/near/borsh-go v0.3.1 - github.com/onrik/ethrpc v1.2.0 - github.com/samber/lo v1.46.0 - gitlab.com/thorchain/tss/tss-lib v0.2.0 - go.nhat.io/grpcmock v0.25.0 -) - -require ( - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/log v1.3.1 // indirect - github.com/DataDog/zstd v1.5.0 // indirect - github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 // indirect - github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect - github.com/blendle/zapdriver v1.3.1 // indirect - github.com/bool64/shared v0.1.5 // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect - github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 // indirect - github.com/dgraph-io/badger/v4 v4.2.0 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/gagliardetto/binary v0.8.0 // indirect - github.com/gagliardetto/treeout v0.1.4 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/golang/glog v1.1.2 // indirect - github.com/google/flatbuffers v1.12.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect - github.com/iancoleman/orderedmap v0.3.0 // indirect - github.com/ipfs/boxo v0.10.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/libp2p/go-yamux/v4 v4.0.0 // indirect - github.com/linxGnu/grocksdb v1.8.14 // indirect - github.com/logrusorgru/aurora v2.0.3+incompatible // indirect - github.com/miekg/pkcs11 v1.1.1 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect - github.com/onsi/gomega v1.27.7 // indirect - github.com/prometheus/tsdb v0.7.1 // indirect - github.com/rjeczalik/notify v0.9.1 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sergi/go-diff v1.3.1 // indirect - github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect - github.com/swaggest/assertjson v1.9.0 // indirect - github.com/tendermint/btcd v0.1.1 // indirect - github.com/thales-e-security/pool v0.0.2 // indirect - github.com/tidwall/gjson v1.14.4 // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect - github.com/tidwall/sjson v1.2.5 // indirect - github.com/yudai/gojsondiff v1.0.0 // indirect - github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect - go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect - go.mongodb.org/mongo-driver v1.11.0 // indirect - go.nhat.io/matcher/v2 v2.0.0 // indirect - go.nhat.io/wait v0.1.0 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect - go.uber.org/dig v1.17.0 // indirect - go.uber.org/fx v1.19.2 // indirect - go.uber.org/ratelimit v0.2.0 // indirect - golang.org/x/time v0.5.0 // indirect - gonum.org/v1/gonum v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect - pgregory.net/rapid v1.1.0 // indirect -) - require ( cloud.google.com/go v0.111.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.35.1 // indirect + cosmossdk.io/api v0.3.1 // indirect + cosmossdk.io/core v0.5.1 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/log v1.3.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/DataDog/zstd v1.5.0 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 // indirect + github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.203 // indirect github.com/benbjohnson/clock v1.3.5 // indirect @@ -164,67 +101,85 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/blang/semver v3.5.1+incompatible // indirect + github.com/blendle/zapdriver v1.3.1 // indirect + github.com/bool64/shared v0.1.5 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/cosmos/btcutil v1.0.5 github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.1 // indirect - github.com/cosmos/ibc-go/v7 v7.4.0 + github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect + github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/deckarep/golang-set v1.8.0 // indirect + github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect + github.com/dgraph-io/badger/v4 v4.2.0 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/elastic/gosigar v0.14.2 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gagliardetto/binary v0.8.0 // indirect + github.com/gagliardetto/treeout v0.1.4 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.3 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect + github.com/google/flatbuffers v1.12.1 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d @@ -233,8 +188,9 @@ require ( github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.2 // indirect github.com/huin/goupnp v1.2.0 // indirect - github.com/improbable-eng/grpc-web v0.15.0 + github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/ipfs/boxo v0.10.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect @@ -243,7 +199,11 @@ require ( github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect @@ -253,23 +213,26 @@ require ( github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.27.8 github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect - github.com/libp2p/go-libp2p-kad-dht v0.24.2 github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect github.com/libp2p/go-libp2p-record v0.2.0 // indirect github.com/libp2p/go-msgio v0.3.0 // indirect github.com/libp2p/go-nat v0.1.0 // indirect github.com/libp2p/go-netroute v0.2.1 // indirect github.com/libp2p/go-reuseport v0.3.0 // indirect + github.com/libp2p/go-yamux/v4 v4.0.0 // indirect + github.com/linxGnu/grocksdb v1.8.14 // indirect + github.com/logrusorgru/aurora v2.0.3+incompatible // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-sqlite3 v1.14.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/miekg/dns v1.1.54 // indirect + github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect @@ -278,6 +241,9 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect @@ -290,6 +256,7 @@ require ( github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/onsi/gomega v1.27.7 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/otiai10/primes v0.0.0-20180210170552-f6d2a1ba97c4 // indirect @@ -301,50 +268,71 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rs/cors v1.8.3 + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sergi/go-diff v1.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.11.0 github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.16.0 github.com/status-im/keycard-go v0.2.0 // indirect + github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect + github.com/swaggest/assertjson v1.9.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/go-amino v0.16.0 // indirect + github.com/thales-e-security/pool v0.0.2 // indirect github.com/tidwall/btree v1.6.0 // indirect + github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/numcpus v0.4.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect + github.com/yudai/gojsondiff v1.0.0 // indirect + github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect + go.mongodb.org/mongo-driver v1.11.0 // indirect + go.nhat.io/matcher/v2 v2.0.0 // indirect + go.nhat.io/wait v0.1.0 // indirect go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/atomic v1.11.0 // indirect + go.uber.org/dig v1.17.0 // indirect + go.uber.org/fx v1.19.2 // indirect go.uber.org/multierr v1.11.0 // indirect + go.uber.org/ratelimit v0.2.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.23.0 - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.7.0 golang.org/x/sys v0.20.0 // indirect golang.org/x/term v0.20.0 // indirect golang.org/x/text v0.16.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + gonum.org/v1/gonum v0.13.0 // indirect google.golang.org/api v0.152.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.32.0 + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v3 v3.0.1 lukechampine.com/blake3 v1.2.1 // indirect nhooyr.io/websocket v1.8.7 // indirect + pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) @@ -352,9 +340,7 @@ replace ( github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43 github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/rjeczalik/notify => github.com/rjeczalik/notify v0.9.3 // replace broken goleveldb @@ -362,8 +348,9 @@ replace ( github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) -replace github.com/evmos/ethermint => github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 - -replace github.com/libp2p/go-libp2p => github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 - -replace gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20240729195411-9f5ae8189449 +// ZetaChain maintained forks. +replace ( + github.com/evmos/ethermint => github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 + github.com/libp2p/go-libp2p => github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 + gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20240729195411-9f5ae8189449 +) From e449a1b7e10c04c84f7d9be0cbf96d6f3e8eb2ff Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 5 Aug 2024 15:37:01 +0200 Subject: [PATCH 02/26] feat: introduce stateful precompiles initial support --- app/ante/ante.go | 2 +- app/ante/fees.go | 4 +- app/ante/handler_options.go | 8 +- app/ante/interfaces.go | 11 +- app/app.go | 36 ++++-- app/encoding.go | 2 +- app/init_genesis.go | 4 +- app/prefix.go | 2 +- cmd/zetacored/add_observer_list.go | 4 +- cmd/zetacored/config/config.go | 2 +- cmd/zetacored/genaccounts.go | 4 +- cmd/zetacored/parse_genesis.go | 4 +- cmd/zetacored/root.go | 4 +- e2e/contracts/contextapp/bindings.go | 2 +- e2e/txserver/zeta_tx_server.go | 6 +- go.mod | 4 +- go.sum | 88 ++++--------- pkg/mempool/custom_proposal_handler_test.go | 2 +- pkg/mempool/mempool_test.go | 2 +- pkg/mempool/senders_with_nonce.go | 2 +- readme.md | 17 +-- rpc/apis.go | 2 +- rpc/backend/account_info.go | 4 +- rpc/backend/account_info_test.go | 4 +- rpc/backend/backend.go | 6 +- rpc/backend/backend_suite_test.go | 14 +-- rpc/backend/blocks.go | 4 +- rpc/backend/blocks_test.go | 4 +- rpc/backend/call_tx.go | 8 +- rpc/backend/call_tx_test.go | 4 +- rpc/backend/chain_info.go | 8 +- rpc/backend/chain_info_test.go | 6 +- rpc/backend/client_test.go | 2 +- rpc/backend/evm_query_client_test.go | 4 +- rpc/backend/feemarket_query_client_test.go | 2 +- rpc/backend/filters.go | 2 +- rpc/backend/filters_test.go | 2 +- rpc/backend/mocks/evm_query_client.go | 2 +- rpc/backend/mocks/feemarket_query_client.go | 2 +- rpc/backend/node_info.go | 10 +- rpc/backend/node_info_test.go | 4 +- rpc/backend/sign_tx.go | 4 +- rpc/backend/sign_tx_test.go | 8 +- rpc/backend/tracing.go | 4 +- rpc/backend/tracing_test.go | 6 +- rpc/backend/tx_info.go | 6 +- rpc/backend/tx_info_test.go | 6 +- rpc/backend/utils.go | 4 +- rpc/ethereum/pubsub/pubsub.go | 2 +- rpc/namespaces/ethereum/debug/api.go | 4 +- rpc/namespaces/ethereum/debug/utils.go | 2 +- rpc/namespaces/ethereum/eth/api.go | 6 +- rpc/namespaces/ethereum/eth/filters/api.go | 4 +- .../ethereum/eth/filters/filter_system.go | 4 +- .../ethereum/eth/filters/filters.go | 2 +- .../ethereum/eth/filters/subscription.go | 2 +- rpc/namespaces/ethereum/eth/filters/utils.go | 2 +- rpc/namespaces/ethereum/miner/api.go | 2 +- rpc/namespaces/ethereum/miner/unsupported.go | 2 +- rpc/namespaces/ethereum/net/api.go | 4 +- rpc/namespaces/ethereum/personal/api.go | 8 +- rpc/namespaces/ethereum/txpool/api.go | 4 +- rpc/namespaces/ethereum/web3/api.go | 2 +- rpc/types/addrlock.go | 2 +- rpc/types/block.go | 4 +- rpc/types/events.go | 8 +- rpc/types/events_test.go | 2 +- rpc/types/query_client.go | 6 +- rpc/types/types.go | 2 +- rpc/types/utils.go | 6 +- rpc/websockets.go | 4 +- scripts/protoc-gen-openapi.sh | 2 +- server/config/config.go | 2 +- server/config/toml.go | 2 +- server/flags/flags.go | 2 +- server/indexer_cmd.go | 4 +- server/indexer_service.go | 4 +- server/json_rpc.go | 4 +- server/start.go | 6 +- server/util.go | 2 +- testutil/keeper/codec.go | 4 +- testutil/keeper/crosschain.go | 2 +- testutil/keeper/fungible.go | 4 +- testutil/keeper/keeper.go | 118 ++++++++++++++++-- testutil/keeper/mocks/crosschain/fungible.go | 2 +- testutil/keeper/mocks/fungible/evm.go | 4 +- testutil/network/genesis_state.go | 2 +- x/crosschain/client/querytests/suite.go | 2 +- ...ctx_orchestrator_validate_outbound_test.go | 2 +- x/crosschain/keeper/evm_deposit.go | 2 +- x/crosschain/keeper/evm_deposit_test.go | 2 +- x/crosschain/keeper/evm_hooks.go | 2 +- .../keeper/msg_server_vote_inbound_tx_test.go | 2 +- x/crosschain/keeper/utils_test.go | 2 +- x/crosschain/types/expected_keepers.go | 2 +- x/fungible/keeper/deposits.go | 2 +- x/fungible/keeper/evm.go | 2 +- x/fungible/keeper/evm_hooks.go | 2 +- x/fungible/keeper/evm_test.go | 2 +- x/fungible/keeper/gas_coin_and_pool_test.go | 4 +- .../msg_server_deploy_system_contract_test.go | 2 +- ...sg_server_update_contract_bytecode_test.go | 2 +- .../msg_server_update_system_contract_test.go | 2 +- ...g_server_update_zrc20_withdraw_fee_test.go | 2 +- .../keeper/zevm_message_passing_test.go | 2 +- x/fungible/keeper/zevm_msg_passing.go | 2 +- x/fungible/types/evm.go | 2 +- x/fungible/types/evm_test.go | 2 +- x/fungible/types/expected_keepers.go | 4 +- x/observer/client/querytests/suite.go | 2 +- zetaclient/zetacore/broadcast_test.go | 2 +- zetaclient/zetacore/client.go | 2 +- zetaclient/zetacore/client_query_ethermint.go | 2 +- zetaclient/zetacore/client_query_test.go | 2 +- 114 files changed, 358 insertions(+), 290 deletions(-) diff --git a/app/ante/ante.go b/app/ante/ante.go index eee2dd27ec..7c7be0604c 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package ante import ( diff --git a/app/ante/fees.go b/app/ante/fees.go index 054cca7c4f..20c30bcea6 100644 --- a/app/ante/fees.go +++ b/app/ante/fees.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE // Copyright 2023 ZetaChain // modified to exclude gentx transaction type from the min gas price check @@ -26,7 +26,7 @@ import ( errortypes "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) var ( diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 71d77de243..8af3a82593 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package ante @@ -29,9 +29,9 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ethante "github.com/evmos/ethermint/app/ante" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + ethante "github.com/zeta-chain/ethermint/app/ante" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" ) diff --git a/app/ante/interfaces.go b/app/ante/interfaces.go index af423e6592..ffe1090121 100644 --- a/app/ante/interfaces.go +++ b/app/ante/interfaces.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package ante @@ -24,10 +24,9 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" - "github.com/evmos/ethermint/x/evm/statedb" - evmtypes "github.com/evmos/ethermint/x/evm/types" - evm "github.com/evmos/ethermint/x/evm/vm" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + "github.com/zeta-chain/ethermint/x/evm/statedb" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" ) // DynamicFeeEVMKeeper is a subset of EVMKeeper interface that supports dynamic fee checker @@ -42,7 +41,7 @@ type EVMKeeper interface { statedb.Keeper DynamicFeeEVMKeeper - NewEVM(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) evm.EVM + NewEVM(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) *vm.EVM DeductTxCostsFromUserBalance(ctx sdk.Context, fees sdk.Coins, from common.Address) error GetBalance(ctx sdk.Context, addr common.Address) *big.Int ResetTransientGasUsed(ctx sdk.Context) diff --git a/app/app.go b/app/app.go index 99bca14347..cd44626657 100644 --- a/app/app.go +++ b/app/app.go @@ -78,18 +78,17 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - evmante "github.com/evmos/ethermint/app/ante" - ethermint "github.com/evmos/ethermint/types" - "github.com/evmos/ethermint/x/evm" - evmkeeper "github.com/evmos/ethermint/x/evm/keeper" - evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/evmos/ethermint/x/evm/vm/geth" - "github.com/evmos/ethermint/x/feemarket" - feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" + evmante "github.com/zeta-chain/ethermint/app/ante" + ethermint "github.com/zeta-chain/ethermint/types" + "github.com/zeta-chain/ethermint/x/evm" + evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/x/feemarket" + feemarketkeeper "github.com/zeta-chain/ethermint/x/feemarket/keeper" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "github.com/zeta-chain/zetacore/app/ante" "github.com/zeta-chain/zetacore/docs/openapi" @@ -561,6 +560,21 @@ func New( app.ConsensusParamsKeeper, ) evmSs := app.GetSubspace(evmtypes.ModuleName) + + + allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tkeys)+len(memKeys)) + for k, v := range keys { + allKeys[k] = v + } + for k, v := range tkeys { + allKeys[k] = v + } + for k, v := range memKeys { + allKeys[k] = v + } + + //gasConfig := storetypes.TransientGasConfig() + app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], @@ -570,11 +584,11 @@ func New( app.BankKeeper, app.StakingKeeper, &app.FeeMarketKeeper, - nil, - geth.NewEVM, tracer, evmSs, + []evmkeeper.CustomContractFn{}, app.ConsensusParamsKeeper, + allKeys, ) app.FungibleKeeper = *fungiblekeeper.NewKeeper( diff --git a/app/encoding.go b/app/encoding.go index 5d4e7f5305..d02479502b 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -2,7 +2,7 @@ package app import ( "cosmossdk.io/simapp/params" - evmenc "github.com/evmos/ethermint/encoding" + evmenc "github.com/zeta-chain/ethermint/encoding" ) // MakeEncodingConfig creates an EncodingConfig for testing diff --git a/app/init_genesis.go b/app/init_genesis.go index 9f82daefa4..a8765c28d7 100644 --- a/app/init_genesis.go +++ b/app/init_genesis.go @@ -16,8 +16,8 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" diff --git a/app/prefix.go b/app/prefix.go index 7a96bc6292..a0b3cb1936 100644 --- a/app/prefix.go +++ b/app/prefix.go @@ -2,7 +2,7 @@ package app import ( sdk "github.com/cosmos/cosmos-sdk/types" - ethcfg "github.com/evmos/ethermint/cmd/config" + ethcfg "github.com/zeta-chain/ethermint/cmd/config" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" ) diff --git a/cmd/zetacored/add_observer_list.go b/cmd/zetacored/add_observer_list.go index e2dd16a5b5..2faf122cc2 100644 --- a/cmd/zetacored/add_observer_list.go +++ b/cmd/zetacored/add_observer_list.go @@ -18,9 +18,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ethcommon "github.com/ethereum/go-ethereum/common" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/spf13/cobra" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/cmd/zetacored/config/config.go b/cmd/zetacored/config/config.go index 4036a7cd72..09c62182da 100644 --- a/cmd/zetacored/config/config.go +++ b/cmd/zetacored/config/config.go @@ -2,7 +2,7 @@ package config import ( sdk "github.com/cosmos/cosmos-sdk/types" - ethermint "github.com/evmos/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) // SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings. diff --git a/cmd/zetacored/genaccounts.go b/cmd/zetacored/genaccounts.go index f97ac4d17a..f8d22c3be8 100644 --- a/cmd/zetacored/genaccounts.go +++ b/cmd/zetacored/genaccounts.go @@ -15,9 +15,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/ethereum/go-ethereum/common" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/spf13/cobra" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) const ( diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index b671519d11..1920f29752 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -25,9 +25,9 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/spf13/cobra" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "github.com/zeta-chain/zetacore/app" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" diff --git a/cmd/zetacored/root.go b/cmd/zetacored/root.go index bcdcc16694..24ef04f61b 100644 --- a/cmd/zetacored/root.go +++ b/cmd/zetacored/root.go @@ -28,10 +28,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - ethermintclient "github.com/evmos/ethermint/client" - "github.com/evmos/ethermint/crypto/hd" "github.com/spf13/cast" "github.com/spf13/cobra" + ethermintclient "github.com/zeta-chain/ethermint/client" + "github.com/zeta-chain/ethermint/crypto/hd" "github.com/zeta-chain/zetacore/app" zetacoredconfig "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/e2e/contracts/contextapp/bindings.go b/e2e/contracts/contextapp/bindings.go index 6b077d4020..cc7c3f8940 100644 --- a/e2e/contracts/contextapp/bindings.go +++ b/e2e/contracts/contextapp/bindings.go @@ -12,7 +12,7 @@ import ( "encoding/json" "github.com/ethereum/go-ethereum/accounts/abi" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) type CompiledContract struct { diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index 8ec4496539..928c4c0382 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -33,9 +33,9 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/evmos/ethermint/crypto/hd" - etherminttypes "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/crypto/hd" + etherminttypes "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/go.mod b/go.mod index c116ce3118..4d81ffda01 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,6 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/emicklei/proto v1.11.1 github.com/ethereum/go-ethereum v1.10.26 - github.com/evmos/ethermint v0.22.0 github.com/fatih/color v1.13.0 github.com/frumioj/crypto11 v1.2.5-0.20210823151709-946ce662cc0e github.com/gagliardetto/solana-go v1.10.0 @@ -57,6 +56,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.9.0 + github.com/zeta-chain/ethermint v0.0.0-20240729121328-43bf9ddbf82f github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2 github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240418181724-c222fd3ae1f5 gitlab.com/thorchain/tss/go-tss v1.6.5 @@ -350,7 +350,7 @@ replace ( // ZetaChain maintained forks. replace ( - github.com/evmos/ethermint => github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 + github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.10.26-spc github.com/libp2p/go-libp2p => github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20240729195411-9f5ae8189449 ) diff --git a/go.sum b/go.sum index 36e3a288c5..ad829c39bc 100644 --- a/go.sum +++ b/go.sum @@ -219,25 +219,13 @@ github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo8 github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI= github.com/AlekSi/pointer v1.1.0/go.mod h1:y7BvfRI3wXPWKXEBhU71nbnIEEZX0QTSB2Bj48UJIZE= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= @@ -259,7 +247,6 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= @@ -286,7 +273,6 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -296,7 +282,6 @@ github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= @@ -340,8 +325,8 @@ github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs= github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= @@ -396,7 +381,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -490,6 +474,7 @@ github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFg github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= @@ -507,7 +492,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= @@ -538,21 +522,19 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7 h1:kgvzE5wLsLa7XKfV85VZl40QXaMCaeFtHpPwJ8fhotY= github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= @@ -564,12 +546,10 @@ github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+m github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= @@ -589,14 +569,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= -github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= @@ -604,7 +579,7 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= @@ -628,6 +603,7 @@ github.com/gagliardetto/solana-go v1.10.0 h1:lDuHGC+XLxw9j8fCHBZM9tv4trI0PVhev1m github.com/gagliardetto/solana-go v1.10.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2Ns6dajZxe2irF7Jg= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= @@ -682,7 +658,6 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -759,7 +734,6 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -861,12 +835,10 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -940,7 +912,6 @@ github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7H github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk= github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= @@ -951,7 +922,7 @@ github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -966,7 +937,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= @@ -995,7 +965,6 @@ github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc= @@ -1038,12 +1007,10 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -1081,6 +1048,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -1141,18 +1109,14 @@ github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8 github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -1285,14 +1249,13 @@ github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtb github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onrik/ethrpc v1.2.0 h1:BBcr1iWxW1RBP/eyZfzvSKtGgeqexq5qS0yyf4pmKbc= github.com/onrik/ethrpc v1.2.0/go.mod h1:uvyqpn8+WbsTgBYfouImgEfpIMb0hR8fWGjwdgPHtFU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -1343,7 +1306,6 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -1417,7 +1379,6 @@ github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1441,11 +1402,9 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo= @@ -1470,7 +1429,6 @@ github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfP github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= @@ -1526,8 +1484,6 @@ github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1Fof github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1548,6 +1504,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -1556,6 +1513,7 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ= github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -1642,7 +1600,6 @@ github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvS github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= @@ -1664,9 +1621,12 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 h1:M54ljayJvy+WlEVdUmX8pgo1nA+XguB3mLhm3wi2z9o= -github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94/go.mod h1:s1zA6OpXv3Tb5I0M6M6j5fo/AssaZL/pgkc7G0W2kN8= +github.com/zeta-chain/ethermint v0.0.0-20240729121328-43bf9ddbf82f h1:M3CQ2Ogbdw0FERKRrHDAUKnWOAjva6Dn5Jmad4UnYC4= +github.com/zeta-chain/ethermint v0.0.0-20240729121328-43bf9ddbf82f/go.mod h1:NeQEwcKBpKAUxIsii2F+jfyOD94jN/3fzPMv/1kVF9M= +github.com/zeta-chain/go-ethereum v1.10.26-spc h1:NvY4rR9yw52wfxWt7YoFsWbaIwVMyOtTsWKqGAXk+sE= +github.com/zeta-chain/go-ethereum v1.10.26-spc/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 h1:FmO3HfVdZ7LzxBUfg6sVzV7ilKElQU2DZm8PxJ7KcYI= github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4/go.mod h1:TBv5NY/CqWYIfUstXO1fDWrt4bDoqgCw79yihqBspg8= github.com/zeta-chain/go-tss v0.0.0-20240729195411-9f5ae8189449 h1:4U+4g2QQjbrmeLU1ZdCDU6CYsE5kbwMOKZ/PACR/vN8= @@ -1792,7 +1752,6 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= @@ -1801,6 +1760,7 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -1820,17 +1780,17 @@ golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= @@ -2010,7 +1970,6 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2041,7 +2000,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2128,12 +2086,12 @@ golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -2167,6 +2125,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= @@ -2448,11 +2407,9 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -2474,7 +2431,6 @@ gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= gorm.io/gorm v1.24.6 h1:wy98aq9oFEetsc4CAbKD2SoBCdMzsbSIvSUUFJuHi5s= gorm.io/gorm v1.24.6/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/mempool/custom_proposal_handler_test.go b/pkg/mempool/custom_proposal_handler_test.go index bec2f08a7d..d98d162a09 100644 --- a/pkg/mempool/custom_proposal_handler_test.go +++ b/pkg/mempool/custom_proposal_handler_test.go @@ -23,10 +23,10 @@ import ( signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" zetamempool "github.com/zeta-chain/zetacore/pkg/mempool" ) diff --git a/pkg/mempool/mempool_test.go b/pkg/mempool/mempool_test.go index 95f709d30e..d7d7a6e55a 100644 --- a/pkg/mempool/mempool_test.go +++ b/pkg/mempool/mempool_test.go @@ -13,9 +13,9 @@ import ( authante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // testPubKey is a dummy implementation of PubKey used for testing. diff --git a/pkg/mempool/senders_with_nonce.go b/pkg/mempool/senders_with_nonce.go index 178071a3c8..e9e28cf46f 100644 --- a/pkg/mempool/senders_with_nonce.go +++ b/pkg/mempool/senders_with_nonce.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // GetSendersWithNonce is used to extract sender and nonce information txs diff --git a/readme.md b/readme.md index 3f00b4b7f5..c411a52674 100644 --- a/readme.md +++ b/readme.md @@ -16,7 +16,7 @@ smart contracts and messaging between any blockchain. ZetaChain is built with [Cosmos SDK](https://github.com/cosmos/cosmos-sdk), a modular framework for building blockchain and -[Ethermint](https://github.com/evmos/ethermint), a module that implements +[Ethermint](https://github.com/zeta-chain/ethermint), a module that implements EVM-compatibility. - [zeta-node](https://github.com/zeta-chain/zeta-node) (this repository) @@ -29,15 +29,18 @@ EVM-compatibility. ## Building the `zetacored`/`zetaclientd` binaries Clone this repository, checkout the latest release tag, and type the following command to build the binaries: + ``` make install ``` -to build. + +to build. This command will install the `zetacored` and `zetaclientd` binaries in your `$GOPATH/bin` directory. -Verify that the version of the binaries match the release tag. +Verify that the version of the binaries match the release tag. + ``` zetacored version zetaclientd version @@ -67,14 +70,12 @@ documentation for all the messages in that module. Find below further documentation for development and running your own ZetaChain node: -* [Run the E2E tests and interact with the localnet](docs/development/LOCAL_TESTING.md) -* [Make a new ZetaChain release](docs/development/RELEASES.md) -* [Deploy your own ZetaChain or Bitcoin node](docs/development/DEPLOY_NODES.md) +- [Run the E2E tests and interact with the localnet](docs/development/LOCAL_TESTING.md) +- [Make a new ZetaChain release](docs/development/RELEASES.md) +- [Deploy your own ZetaChain or Bitcoin node](docs/development/DEPLOY_NODES.md) ## Community [Twitter](https://twitter.com/zetablockchain) | [Discord](https://discord.com/invite/zetachain) | [Telegram](https://t.me/zetachainofficial) | [Website](https://zetachain.com) - - diff --git a/rpc/apis.go b/rpc/apis.go index 2cc5c4b9a9..3f295b7136 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -22,7 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/zetacore/rpc/backend" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/debug" diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 59d6a57520..bb9cf39689 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -27,8 +27,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/account_info_test.go b/rpc/backend/account_info_test.go index 111b6bfb4f..c5937c1425 100644 --- a/rpc/backend/account_info_test.go +++ b/rpc/backend/account_info_test.go @@ -10,8 +10,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 2890cae40b..3749e1d221 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -32,8 +32,8 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/signer/core/apitypes" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" "github.com/zeta-chain/zetacore/server/config" diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index 21744e87e3..c6f5ff20da 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -16,14 +16,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/ethermint/app" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - "github.com/evmos/ethermint/crypto/hd" - "github.com/evmos/ethermint/encoding" - "github.com/evmos/ethermint/indexer" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/suite" + "github.com/zeta-chain/ethermint/app" + "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" + "github.com/zeta-chain/ethermint/crypto/hd" + "github.com/zeta-chain/ethermint/encoding" + "github.com/zeta-chain/ethermint/indexer" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend/mocks" rpctypes "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index a4a9d03063..a902c7b8cb 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -32,8 +32,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/trie" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/rpc/backend/blocks_test.go b/rpc/backend/blocks_test.go index ef8023e448..83fba94cf3 100644 --- a/rpc/backend/blocks_test.go +++ b/rpc/backend/blocks_test.go @@ -14,8 +14,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/trie" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 95bedf5a42..781d8ce7c7 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -29,9 +29,9 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -89,7 +89,7 @@ func (b *Backend) Resend( } for _, tx := range pending { - // FIXME does Resend api possible at all? https://github.com/evmos/ethermint/issues/905 + // FIXME does Resend api possible at all? https://github.com/zeta-chain/ethermint/issues/905 p, err := evmtypes.UnwrapEthereumMsg(tx, common.Hash{}) if err != nil { // not valid ethereum tx diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index a30ef6a941..f1b28e0a97 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -10,8 +10,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rlp" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index c5a06d354a..965f20dcee 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -28,10 +28,10 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/pkg/errors" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/chain_info_test.go b/rpc/backend/chain_info_test.go index c39215d1bf..7259defa4b 100644 --- a/rpc/backend/chain_info_test.go +++ b/rpc/backend/chain_info_test.go @@ -9,9 +9,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common/hexutil" ethrpc "github.com/ethereum/go-ethereum/rpc" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index 952bc215b7..6adf0ea5d0 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -17,9 +17,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" mock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend/mocks" rpc "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/backend/evm_query_client_test.go b/rpc/backend/evm_query_client_test.go index de50ef7ca6..997b6076d6 100644 --- a/rpc/backend/evm_query_client_test.go +++ b/rpc/backend/evm_query_client_test.go @@ -12,10 +12,10 @@ import ( errortypes "github.com/cosmos/cosmos-sdk/types/errors" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/ethereum/go-ethereum/common" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" mock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" diff --git a/rpc/backend/feemarket_query_client_test.go b/rpc/backend/feemarket_query_client_test.go index d24507eae4..e51bb7e7a5 100644 --- a/rpc/backend/feemarket_query_client_test.go +++ b/rpc/backend/feemarket_query_client_test.go @@ -2,7 +2,7 @@ package backend import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "github.com/zeta-chain/zetacore/rpc/backend/mocks" rpc "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/backend/filters.go b/rpc/backend/filters.go index b989d8099b..400828e307 100644 --- a/rpc/backend/filters.go +++ b/rpc/backend/filters.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( diff --git a/rpc/backend/filters_test.go b/rpc/backend/filters_test.go index 486e51ebf2..56bc32ad2d 100644 --- a/rpc/backend/filters_test.go +++ b/rpc/backend/filters_test.go @@ -6,7 +6,7 @@ import ( tmtypes "github.com/cometbft/cometbft/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend/mocks" ethrpc "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/backend/mocks/evm_query_client.go b/rpc/backend/mocks/evm_query_client.go index 231759d1b0..e5a7fa72dd 100644 --- a/rpc/backend/mocks/evm_query_client.go +++ b/rpc/backend/mocks/evm_query_client.go @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - types "github.com/evmos/ethermint/x/evm/types" + types "github.com/zeta-chain/ethermint/x/evm/types" ) // EVMQueryClient is an autogenerated mock type for the EVMQueryClient type diff --git a/rpc/backend/mocks/feemarket_query_client.go b/rpc/backend/mocks/feemarket_query_client.go index 2536699fb0..cf6091a0f1 100644 --- a/rpc/backend/mocks/feemarket_query_client.go +++ b/rpc/backend/mocks/feemarket_query_client.go @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - types "github.com/evmos/ethermint/x/feemarket/types" + types "github.com/zeta-chain/ethermint/x/feemarket/types" ) // FeeMarketQueryClient is an autogenerated mock type for the QueryClient type diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 2b7a99a267..7c661c3fb1 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -34,10 +34,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - "github.com/evmos/ethermint/server/config" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" + "github.com/zeta-chain/ethermint/server/config" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/node_info_test.go b/rpc/backend/node_info_test.go index 7931cf4230..ccfc3fe551 100644 --- a/rpc/backend/node_info_test.go +++ b/rpc/backend/node_info_test.go @@ -12,9 +12,9 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - ethermint "github.com/evmos/ethermint/types" "github.com/spf13/viper" + "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" + ethermint "github.com/zeta-chain/ethermint/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index a5e004dc45..105f161976 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -29,7 +29,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // SendTransaction sends transaction based on received args using Node's key to sign it diff --git a/rpc/backend/sign_tx_test.go b/rpc/backend/sign_tx_test.go index d50f6fb6bd..791befec4c 100644 --- a/rpc/backend/sign_tx_test.go +++ b/rpc/backend/sign_tx_test.go @@ -12,10 +12,10 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" goethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - "github.com/evmos/ethermint/ethereum/eip712" - "github.com/evmos/ethermint/tests" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" + "github.com/zeta-chain/ethermint/ethereum/eip712" + "github.com/zeta-chain/ethermint/tests" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index 84a78dc6c7..df893bde9e 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -22,8 +22,8 @@ import ( tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/tracing_test.go b/rpc/backend/tracing_test.go index 1abae1818b..d03c85ddb1 100644 --- a/rpc/backend/tracing_test.go +++ b/rpc/backend/tracing_test.go @@ -11,9 +11,9 @@ import ( "github.com/cosmos/cosmos-sdk/crypto" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - "github.com/evmos/ethermint/indexer" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" + "github.com/zeta-chain/ethermint/indexer" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend/mocks" ) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index a65c86743f..e195efb49c 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -26,9 +26,9 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index f564494f19..8aa336f57d 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -12,9 +12,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/evmos/ethermint/indexer" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/indexer" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/metadata" "github.com/zeta-chain/zetacore/rpc/backend/mocks" diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 1be9e81b33..21fd67e2df 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package backend import ( @@ -32,7 +32,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/misc" ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/rpc/ethereum/pubsub/pubsub.go b/rpc/ethereum/pubsub/pubsub.go index a8117a8fbb..9238c8a4db 100644 --- a/rpc/ethereum/pubsub/pubsub.go +++ b/rpc/ethereum/pubsub/pubsub.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package pubsub import ( diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 3496da92d8..9a3942e1de 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package debug import ( @@ -34,8 +34,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/rlp" - evmtypes "github.com/evmos/ethermint/x/evm/types" stderrors "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/namespaces/ethereum/debug/utils.go b/rpc/namespaces/ethereum/debug/utils.go index 277c37df56..0b041aba02 100644 --- a/rpc/namespaces/ethereum/debug/utils.go +++ b/rpc/namespaces/ethereum/debug/utils.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package debug import ( diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 2a558109af..25b8c99137 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package eth import ( @@ -23,8 +23,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index a18ba4402e..ffa0611fcf 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package filters import ( @@ -30,7 +30,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/namespaces/ethereum/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go index 35004b0138..1427916df9 100644 --- a/rpc/namespaces/ethereum/eth/filters/filter_system.go +++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package filters import ( @@ -32,8 +32,8 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" ) diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index 59874611db..fe975dcc62 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package filters import ( diff --git a/rpc/namespaces/ethereum/eth/filters/subscription.go b/rpc/namespaces/ethereum/eth/filters/subscription.go index 8566757bd8..7287c44cff 100644 --- a/rpc/namespaces/ethereum/eth/filters/subscription.go +++ b/rpc/namespaces/ethereum/eth/filters/subscription.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package filters import ( diff --git a/rpc/namespaces/ethereum/eth/filters/utils.go b/rpc/namespaces/ethereum/eth/filters/utils.go index 2d4557f568..c8e5013e50 100644 --- a/rpc/namespaces/ethereum/eth/filters/utils.go +++ b/rpc/namespaces/ethereum/eth/filters/utils.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package filters import ( diff --git a/rpc/namespaces/ethereum/miner/api.go b/rpc/namespaces/ethereum/miner/api.go index c1a21f5518..3e4abc9900 100644 --- a/rpc/namespaces/ethereum/miner/api.go +++ b/rpc/namespaces/ethereum/miner/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package miner import ( diff --git a/rpc/namespaces/ethereum/miner/unsupported.go b/rpc/namespaces/ethereum/miner/unsupported.go index d07ac006ac..22e5110555 100644 --- a/rpc/namespaces/ethereum/miner/unsupported.go +++ b/rpc/namespaces/ethereum/miner/unsupported.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package miner import ( diff --git a/rpc/namespaces/ethereum/net/api.go b/rpc/namespaces/ethereum/net/api.go index a04e8066f1..c44e1f42b2 100644 --- a/rpc/namespaces/ethereum/net/api.go +++ b/rpc/namespaces/ethereum/net/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package net import ( @@ -21,7 +21,7 @@ import ( rpcclient "github.com/cometbft/cometbft/rpc/client" "github.com/cosmos/cosmos-sdk/client" - ethermint "github.com/evmos/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) // PublicAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec. diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 71f1aa5271..4420857799 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package personal import ( @@ -28,9 +28,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/crypto/hd" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/crypto/hd" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/backend" ) diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index 521025cf6a..c42c50b725 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package txpool import ( @@ -23,7 +23,7 @@ import ( ) // PublicAPI offers and API for the transaction pool. It only operates on data that is non-confidential. -// NOTE: For more info about the current status of this endpoints see https://github.com/evmos/ethermint/issues/124 +// NOTE: For more info about the current status of this endpoints see https://github.com/zeta-chain/ethermint/issues/124 type PublicAPI struct { logger log.Logger } diff --git a/rpc/namespaces/ethereum/web3/api.go b/rpc/namespaces/ethereum/web3/api.go index 6d3a8f970b..77f01d6bac 100644 --- a/rpc/namespaces/ethereum/web3/api.go +++ b/rpc/namespaces/ethereum/web3/api.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package web3 import ( diff --git a/rpc/types/addrlock.go b/rpc/types/addrlock.go index 0c81cf7af6..2f19e5b634 100644 --- a/rpc/types/addrlock.go +++ b/rpc/types/addrlock.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( diff --git a/rpc/types/block.go b/rpc/types/block.go index 4515e67d8c..cb2c873709 100644 --- a/rpc/types/block.go +++ b/rpc/types/block.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( @@ -27,8 +27,8 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - ethermint "github.com/evmos/ethermint/types" "github.com/spf13/cast" + ethermint "github.com/zeta-chain/ethermint/types" "google.golang.org/grpc/metadata" ) diff --git a/rpc/types/events.go b/rpc/types/events.go index 4650f460a6..886b0e6a87 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( @@ -28,8 +28,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + ethermint "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // EventFormat is the format version of the events. @@ -324,7 +324,7 @@ func (p *ParsedTxs) newTx(attrs []abci.EventAttribute) error { // updateTx updates an exiting tx from events, called during parsing. // In event format 2, we update the tx with the attributes of the second `ethereum_tx` event, -// Due to bug https://github.com/evmos/ethermint/issues/1175, the first `ethereum_tx` event may emit incorrect tx hash, +// Due to bug https://github.com/zeta-chain/ethermint/issues/1175, the first `ethereum_tx` event may emit incorrect tx hash, // so we prefer the second event and override the first one. func (p *ParsedTxs) updateTx(eventIndex int, attrs []abci.EventAttribute) error { tx := NewParsedTx(eventIndex) diff --git a/rpc/types/events_test.go b/rpc/types/events_test.go index 79a6fc5f25..b01bd45850 100644 --- a/rpc/types/events_test.go +++ b/rpc/types/events_test.go @@ -6,8 +6,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) func TestParseTxResult(t *testing.T) { diff --git a/rpc/types/query_client.go b/rpc/types/query_client.go index cda2962f18..46ce2d1244 100644 --- a/rpc/types/query_client.go +++ b/rpc/types/query_client.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( @@ -22,8 +22,8 @@ import ( "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/types/tx" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" ) // QueryClient defines a gRPC Client used for: diff --git a/rpc/types/types.go b/rpc/types/types.go index 907eff4740..0d53851866 100644 --- a/rpc/types/types.go +++ b/rpc/types/types.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( diff --git a/rpc/types/utils.go b/rpc/types/utils.go index 5e93d97ae8..addce9521a 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package types import ( @@ -32,8 +32,8 @@ import ( "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" ) // ExceedBlockGasLimitError defines the error message when tx execution exceeds the block gas limit. diff --git a/rpc/websockets.go b/rpc/websockets.go index b2470e0203..48f357de26 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package rpc import ( @@ -36,10 +36,10 @@ import ( "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/gorilla/mux" "github.com/gorilla/websocket" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" rpcfilters "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters" diff --git a/scripts/protoc-gen-openapi.sh b/scripts/protoc-gen-openapi.sh index 994f107b19..3a4a40e097 100755 --- a/scripts/protoc-gen-openapi.sh +++ b/scripts/protoc-gen-openapi.sh @@ -5,7 +5,7 @@ go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.16. go mod download COSMOS_SDK="github.com/cosmos/cosmos-sdk" -ETHERMINT="github.com/evmos/ethermint" +ETHERMINT="github.com/zeta-chain/ethermint" PROTO_TEMPLATE="proto/buf.openapi.yaml" OUTPUT_DIR="./docs/openapi" MERGED_SWAGGER_FILE="openapi.swagger.yaml" diff --git a/server/config/config.go b/server/config/config.go index e62bdfd74a..1f04a16b14 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package config import ( diff --git a/server/config/toml.go b/server/config/toml.go index a61f110dc7..4c296d1f95 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package config // DefaultConfigTemplate defines the configuration template for the EVM RPC configuration diff --git a/server/flags/flags.go b/server/flags/flags.go index abc3d6dc72..3749b62ef0 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package flags import ( diff --git a/server/indexer_cmd.go b/server/indexer_cmd.go index 65d4d2b9e3..b4c39f4934 100644 --- a/server/indexer_cmd.go +++ b/server/indexer_cmd.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package server import ( @@ -23,8 +23,8 @@ import ( tmstore "github.com/cometbft/cometbft/store" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - "github.com/evmos/ethermint/indexer" "github.com/spf13/cobra" + "github.com/zeta-chain/ethermint/indexer" ) func NewIndexTxCmd() *cobra.Command { diff --git a/server/indexer_service.go b/server/indexer_service.go index d996eac6ba..79115317f5 100644 --- a/server/indexer_service.go +++ b/server/indexer_service.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package server import ( @@ -22,7 +22,7 @@ import ( "github.com/cometbft/cometbft/libs/service" rpcclient "github.com/cometbft/cometbft/rpc/client" "github.com/cometbft/cometbft/types" - ethermint "github.com/evmos/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) const ( diff --git a/server/json_rpc.go b/server/json_rpc.go index 9abe6b9ecc..4b17ccf413 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package server import ( @@ -24,9 +24,9 @@ import ( "github.com/cosmos/cosmos-sdk/server/types" ethlog "github.com/ethereum/go-ethereum/log" ethrpc "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" "github.com/gorilla/mux" "github.com/rs/cors" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/zetacore/rpc" "github.com/zeta-chain/zetacore/server/config" diff --git a/server/start.go b/server/start.go index 64bb1db4e6..d1bd3227a1 100644 --- a/server/start.go +++ b/server/start.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package server import ( @@ -52,9 +52,9 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" ethmetricsexp "github.com/ethereum/go-ethereum/metrics/exp" - "github.com/evmos/ethermint/indexer" - ethermint "github.com/evmos/ethermint/types" "github.com/spf13/cobra" + "github.com/zeta-chain/ethermint/indexer" + ethermint "github.com/zeta-chain/ethermint/types" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/server/util.go b/server/util.go index 94b29cd769..b8a5d5ea63 100644 --- a/server/util.go +++ b/server/util.go @@ -12,7 +12,7 @@ // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE +// along with the Ethermint library. If not, see https://github.com/zeta-chain/ethermint/blob/main/LICENSE package server import ( diff --git a/testutil/keeper/codec.go b/testutil/keeper/codec.go index 90d8ff6e7d..8317ac4449 100644 --- a/testutil/keeper/codec.go +++ b/testutil/keeper/codec.go @@ -13,8 +13,8 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - etherminttypes "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + etherminttypes "github.com/zeta-chain/ethermint/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index 6f350aa5ed..f714475ca8 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -10,9 +10,9 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index 9c25c80294..ca20891117 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -9,10 +9,10 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/evmos/ethermint/x/evm/statedb" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/x/evm/statedb" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" fungiblemocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/fungible" "github.com/zeta-chain/zetacore/testutil/sample" diff --git a/testutil/keeper/keeper.go b/testutil/keeper/keeper.go index 8b3a9d0dfb..b59b90b023 100644 --- a/testutil/keeper/keeper.go +++ b/testutil/keeper/keeper.go @@ -39,14 +39,13 @@ import ( porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ethermint "github.com/evmos/ethermint/types" - evmmodule "github.com/evmos/ethermint/x/evm" - evmkeeper "github.com/evmos/ethermint/x/evm/keeper" - evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/evmos/ethermint/x/evm/vm/geth" - feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/stretchr/testify/require" + ethermint "github.com/zeta-chain/ethermint/types" + evmmodule "github.com/zeta-chain/ethermint/x/evm" + evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarketkeeper "github.com/zeta-chain/ethermint/x/feemarket/keeper" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "github.com/zeta-chain/zetacore/testutil/sample" authoritymodule "github.com/zeta-chain/zetacore/x/authority" @@ -73,7 +72,7 @@ import ( ) // NewContext creates a new sdk.Context for testing purposes with initialized header -func NewContext(stateStore sdk.CommitMultiStore) sdk.Context { +func NewContext(stateStore sdk.MultiStore) sdk.Context { header := tmproto.Header{ Height: 1, ChainID: "test_7000-1", @@ -142,6 +141,12 @@ var moduleAccountPerms = map[string][]string{ ibccrosschaintypes.ModuleName: nil, } +var ( + testStoreKeys = sdk.NewKVStoreKeys(authtypes.StoreKey, banktypes.StoreKey, evmtypes.StoreKey, consensustypes.StoreKey) + testTransientKeys = sdk.NewTransientStoreKeys(evmtypes.TransientKey) + testMemKeys = sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) +) + // ModuleAccountAddrs returns all the app's module account addresses. func ModuleAccountAddrs(maccPerms map[string][]string) map[string]bool { modAccAddrs := make(map[string]bool) @@ -353,6 +358,17 @@ func EVMKeeper( ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) ss.MountStoreWithDB(transientKey, storetypes.StoreTypeTransient, db) + allKeys := make(map[string]storetypes.StoreKey, len(testStoreKeys)+len(testTransientKeys)+len(testMemKeys)) + for k, v := range testStoreKeys { + allKeys[k] = v + } + for k, v := range testTransientKeys { + allKeys[k] = v + } + for k, v := range testMemKeys { + allKeys[k] = v + } + k := evmkeeper.NewKeeper( cdc, storeKey, @@ -362,16 +378,98 @@ func EVMKeeper( bankKeeper, stakingKeeper, feemarketKeeper, - nil, - geth.NewEVM, "", paramKeeper.Subspace(evmtypes.ModuleName), + nil, consensusKeeper, + allKeys, ) return k } +// NewSDKKeepers instantiates regular Cosmos SDK keeper such as staking with local storage for testing purposes +func NewSDKKeepersWithKeys( + cdc codec.Codec, + keys map[string]*storetypes.KVStoreKey, + tKeys map[string]*storetypes.TransientStoreKey, + allKeys map[string]storetypes.StoreKey, +) SDKKeepers { + paramsKeeper := paramskeeper.NewKeeper( + cdc, + fungibletypes.Amino, + keys[paramstypes.StoreKey], + tKeys[paramstypes.TStoreKey], + ) + authKeeper := authkeeper.NewAccountKeeper( + cdc, + keys[authtypes.StoreKey], + ethermint.ProtoAccount, + moduleAccountPerms, + "zeta", + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + blockedAddrs := make(map[string]bool) + bankKeeper := bankkeeper.NewBaseKeeper( + cdc, + keys[banktypes.StoreKey], + authKeeper, + blockedAddrs, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + stakingKeeper := *stakingkeeper.NewKeeper( + cdc, + keys[stakingtypes.StoreKey], + authKeeper, + bankKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + consensusKeeper := consensuskeeper.NewKeeper( + cdc, + keys[consensustypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + feeMarketKeeper := feemarketkeeper.NewKeeper( + cdc, + authtypes.NewModuleAddress(govtypes.ModuleName), + keys[feemarkettypes.StoreKey], + tKeys[feemarkettypes.TransientKey], + paramsKeeper.Subspace(feemarkettypes.ModuleName), + consensusKeeper, + ) + evmKeeper := evmkeeper.NewKeeper( + cdc, + keys[evmtypes.StoreKey], + tKeys[evmtypes.TransientKey], + authtypes.NewModuleAddress(govtypes.ModuleName), + authKeeper, + bankKeeper, + stakingKeeper, + feeMarketKeeper, + "", + paramsKeeper.Subspace(evmtypes.ModuleName), + nil, + consensusKeeper, + allKeys, + ) + slashingKeeper := slashingkeeper.NewKeeper( + cdc, + codec.NewLegacyAmino(), + keys[slashingtypes.StoreKey], + stakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + return SDKKeepers{ + ParamsKeeper: paramsKeeper, + AuthKeeper: authKeeper, + BankKeeper: bankKeeper, + StakingKeeper: stakingKeeper, + FeeMarketKeeper: feeMarketKeeper, + EvmKeeper: evmKeeper, + SlashingKeeper: slashingKeeper, + } +} + // CapabilityKeeper instantiates a capability keeper for testing purposes func CapabilityKeeper( cdc codec.Codec, diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 9eab868481..70f56c1f59 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -8,7 +8,7 @@ import ( common "github.com/ethereum/go-ethereum/common" coin "github.com/zeta-chain/zetacore/pkg/coin" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index 28fd46e25c..79b2cc1985 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -10,11 +10,11 @@ import ( core "github.com/ethereum/go-ethereum/core" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" mock "github.com/stretchr/testify/mock" - statedb "github.com/evmos/ethermint/x/evm/statedb" + statedb "github.com/zeta-chain/ethermint/x/evm/statedb" types "github.com/cosmos/cosmos-sdk/types" diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index e391526328..73220ba9a5 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -9,8 +9,8 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/pkg/chains" diff --git a/x/crosschain/client/querytests/suite.go b/x/crosschain/client/querytests/suite.go index d9354b6d18..9d57b6ce79 100644 --- a/x/crosschain/client/querytests/suite.go +++ b/x/crosschain/client/querytests/suite.go @@ -2,8 +2,8 @@ package querytests import ( sdk "github.com/cosmos/cosmos-sdk/types" - ethcfg "github.com/evmos/ethermint/cmd/config" "github.com/stretchr/testify/suite" + ethcfg "github.com/zeta-chain/ethermint/cmd/config" "github.com/zeta-chain/zetacore/app" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go index f39f0d3af8..1fca5bcc51 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go @@ -7,9 +7,9 @@ import ( "cosmossdk.io/errors" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/evmos/ethermint/x/evm/statedb" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/crosschain/keeper/evm_deposit.go b/x/crosschain/keeper/evm_deposit.go index b1e55e3f6f..5178b0a22a 100644 --- a/x/crosschain/keeper/evm_deposit.go +++ b/x/crosschain/keeper/evm_deposit.go @@ -9,8 +9,8 @@ import ( tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/crosschain/keeper/evm_deposit_test.go b/x/crosschain/keeper/evm_deposit_test.go index 7541c21aa6..121d42f988 100644 --- a/x/crosschain/keeper/evm_deposit_test.go +++ b/x/crosschain/keeper/evm_deposit_test.go @@ -8,9 +8,9 @@ import ( "cosmossdk.io/math" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go index 5df569a6d9..3f50b95f3b 100644 --- a/x/crosschain/keeper/evm_hooks.go +++ b/x/crosschain/keeper/evm_hooks.go @@ -14,7 +14,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" connectorzevm "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zetaconnectorzevm.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index be03a407e5..98eb488d41 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -11,9 +11,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/x/evm/statedb" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/crosschain/keeper/utils_test.go b/x/crosschain/keeper/utils_test.go index ce5aa82447..d62987dfc0 100644 --- a/x/crosschain/keeper/utils_test.go +++ b/x/crosschain/keeper/utils_test.go @@ -8,8 +8,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/ethereum/go-ethereum/common" - evmkeeper "github.com/evmos/ethermint/x/evm/keeper" "github.com/stretchr/testify/require" + evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 1422538b2f..369093e8e6 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go index 4af00de688..42d1dd0f01 100644 --- a/x/fungible/keeper/deposits.go +++ b/x/fungible/keeper/deposits.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index dbbae8294f..ed4ba9ec29 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -19,7 +19,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol" zevmconnectorcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zetaconnectorzevm.sol" diff --git a/x/fungible/keeper/evm_hooks.go b/x/fungible/keeper/evm_hooks.go index a171adb3e4..3c03c8974a 100644 --- a/x/fungible/keeper/evm_hooks.go +++ b/x/fungible/keeper/evm_hooks.go @@ -6,7 +6,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/x/fungible/types" ) diff --git a/x/fungible/keeper/evm_test.go b/x/fungible/keeper/evm_test.go index 2ef0f4dfb9..447cdf9fcc 100644 --- a/x/fungible/keeper/evm_test.go +++ b/x/fungible/keeper/evm_test.go @@ -9,9 +9,9 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" diff --git a/x/fungible/keeper/gas_coin_and_pool_test.go b/x/fungible/keeper/gas_coin_and_pool_test.go index 0d76945c0f..ac0aeae48d 100644 --- a/x/fungible/keeper/gas_coin_and_pool_test.go +++ b/x/fungible/keeper/gas_coin_and_pool_test.go @@ -8,10 +8,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/ethereum/go-ethereum/common" - evmkeeper "github.com/evmos/ethermint/x/evm/keeper" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" uniswapv2router02 "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" diff --git a/x/fungible/keeper/msg_server_deploy_system_contract_test.go b/x/fungible/keeper/msg_server_deploy_system_contract_test.go index 882b8fecf1..4a92926ec0 100644 --- a/x/fungible/keeper/msg_server_deploy_system_contract_test.go +++ b/x/fungible/keeper/msg_server_deploy_system_contract_test.go @@ -6,9 +6,9 @@ import ( "testing" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go index dadb62d145..a1f9cc4ddd 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/evmos/ethermint/x/evm/statedb" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" diff --git a/x/fungible/keeper/msg_server_update_system_contract_test.go b/x/fungible/keeper/msg_server_update_system_contract_test.go index 72b7bac265..eed991365b 100644 --- a/x/fungible/keeper/msg_server_update_system_contract_test.go +++ b/x/fungible/keeper/msg_server_update_system_contract_test.go @@ -6,8 +6,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" diff --git a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go index 160b2cfc46..b1a6fa420d 100644 --- a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go +++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go @@ -6,9 +6,9 @@ import ( "cosmossdk.io/math" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" diff --git a/x/fungible/keeper/zevm_message_passing_test.go b/x/fungible/keeper/zevm_message_passing_test.go index 5a450968be..96a4762583 100644 --- a/x/fungible/keeper/zevm_message_passing_test.go +++ b/x/fungible/keeper/zevm_message_passing_test.go @@ -7,9 +7,9 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/x/evm/statedb" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/testutil/contracts" diff --git a/x/fungible/keeper/zevm_msg_passing.go b/x/fungible/keeper/zevm_msg_passing.go index 258df47209..675118dec5 100644 --- a/x/fungible/keeper/zevm_msg_passing.go +++ b/x/fungible/keeper/zevm_msg_passing.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // ZETADepositAndCallContract deposits native ZETA to the to address if its an account or if the account does not exist yet diff --git a/x/fungible/types/evm.go b/x/fungible/types/evm.go index cf466f137c..d7aa882ce6 100644 --- a/x/fungible/types/evm.go +++ b/x/fungible/types/evm.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/core/vm" - evmtypes "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) // IsRevertError checks if an error is a evm revert error diff --git a/x/fungible/types/evm_test.go b/x/fungible/types/evm_test.go index aa4a402900..b375d0c5ef 100644 --- a/x/fungible/types/evm_test.go +++ b/x/fungible/types/evm_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/ethereum/go-ethereum/core/vm" - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/x/fungible/types" ) diff --git a/x/fungible/types/expected_keepers.go b/x/fungible/types/expected_keepers.go index ad0521ab81..a719bef123 100644 --- a/x/fungible/types/expected_keepers.go +++ b/x/fungible/types/expected_keepers.go @@ -9,8 +9,8 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" - "github.com/evmos/ethermint/x/evm/statedb" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/ethermint/x/evm/statedb" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/pkg/chains" ) diff --git a/x/observer/client/querytests/suite.go b/x/observer/client/querytests/suite.go index c0a0710c5b..87cdac1147 100644 --- a/x/observer/client/querytests/suite.go +++ b/x/observer/client/querytests/suite.go @@ -2,8 +2,8 @@ package querytests import ( sdk "github.com/cosmos/cosmos-sdk/types" - ethcfg "github.com/evmos/ethermint/cmd/config" "github.com/stretchr/testify/suite" + ethcfg "github.com/zeta-chain/ethermint/cmd/config" "github.com/zeta-chain/zetacore/app" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" diff --git a/zetaclient/zetacore/broadcast_test.go b/zetaclient/zetacore/broadcast_test.go index 6acd5c535f..80299c7ba5 100644 --- a/zetaclient/zetacore/broadcast_test.go +++ b/zetaclient/zetacore/broadcast_test.go @@ -9,8 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/stretchr/testify/require" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "go.nhat.io/grpcmock" "go.nhat.io/grpcmock/planner" diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index 0806c709fe..563a7aaf95 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -15,9 +15,9 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/pkg/errors" "github.com/rs/zerolog" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/zetaclient/zetacore/client_query_ethermint.go b/zetaclient/zetacore/client_query_ethermint.go index edb8987360..b9fc5a4a7a 100644 --- a/zetaclient/zetacore/client_query_ethermint.go +++ b/zetaclient/zetacore/client_query_ethermint.go @@ -5,7 +5,7 @@ import ( "fmt" "cosmossdk.io/errors" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" ) // GetBaseGasPrice returns the base gas price diff --git a/zetaclient/zetacore/client_query_test.go b/zetaclient/zetacore/client_query_test.go index ae995b069d..303e9d9b6d 100644 --- a/zetaclient/zetacore/client_query_test.go +++ b/zetaclient/zetacore/client_query_test.go @@ -17,10 +17,10 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/golang/mock/gomock" "github.com/rs/zerolog" "github.com/stretchr/testify/require" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" keyinterfaces "github.com/zeta-chain/zetacore/zetaclient/keys/interfaces" "go.nhat.io/grpcmock" "go.nhat.io/grpcmock/planner" From 4ca59cb11391c6498339242a1b526f664592c9c8 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 5 Aug 2024 16:01:48 +0200 Subject: [PATCH 03/26] chore: remove simapp as a dependency --- app/app.go | 3 +-- app/encoding.go | 4 ++-- cmd/zetacored/root.go | 8 ++++---- go.mod | 1 - go.sum | 2 -- testutil/keeper/codec.go | 4 ++-- zetaclient/zetacore/client.go | 11 +++++------ 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/app/app.go b/app/app.go index cd44626657..98bc427982 100644 --- a/app/app.go +++ b/app/app.go @@ -7,7 +7,6 @@ import ( "time" cosmoserrors "cosmossdk.io/errors" - appparams "cosmossdk.io/simapp/params" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" @@ -314,7 +313,7 @@ func New( skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, - encodingConfig appparams.EncodingConfig, + encodingConfig ethermint.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { diff --git a/app/encoding.go b/app/encoding.go index d02479502b..fed40e3286 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -1,12 +1,12 @@ package app import ( - "cosmossdk.io/simapp/params" evmenc "github.com/zeta-chain/ethermint/encoding" + ethermint "github.com/zeta-chain/ethermint/types" ) // MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() params.EncodingConfig { +func MakeEncodingConfig() ethermint.EncodingConfig { //encodingConfig := params.MakeEncodingConfig() encodingConfig := evmenc.MakeConfig(ModuleBasics) //std.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/cmd/zetacored/root.go b/cmd/zetacored/root.go index 24ef04f61b..eb63b4c9cd 100644 --- a/cmd/zetacored/root.go +++ b/cmd/zetacored/root.go @@ -6,7 +6,6 @@ import ( "io" "os" - appparams "cosmossdk.io/simapp/params" rosettaCmd "cosmossdk.io/tools/rosetta/cmd" dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" @@ -32,6 +31,7 @@ import ( "github.com/spf13/cobra" ethermintclient "github.com/zeta-chain/ethermint/client" "github.com/zeta-chain/ethermint/crypto/hd" + "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/zetacore/app" zetacoredconfig "github.com/zeta-chain/zetacore/cmd/zetacored/config" @@ -45,7 +45,7 @@ const EnvPrefix = "zetacore" // NewRootCmd creates a new root command for wasmd. It is called once in the // main function. -func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { +func NewRootCmd() (*cobra.Command, types.EncodingConfig) { encodingConfig := app.MakeEncodingConfig() cfg := sdk.GetConfig() @@ -119,7 +119,7 @@ func initTmConfig() *tmcfg.Config { return cfg } -func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig types.EncodingConfig) { ac := appCreator{ encCfg: encodingConfig, } @@ -236,7 +236,7 @@ func txCommand() *cobra.Command { } type appCreator struct { - encCfg appparams.EncodingConfig + encCfg types.EncodingConfig } func (ac appCreator) newApp( diff --git a/go.mod b/go.mod index 4d81ffda01..865fc87402 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ toolchain go1.22.5 require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d cosmossdk.io/tools/rosetta v0.2.1 github.com/99designs/keyring v1.2.1 github.com/btcsuite/btcd v0.23.4 diff --git a/go.sum b/go.sum index ad829c39bc..9586df94bf 100644 --- a/go.sum +++ b/go.sum @@ -201,8 +201,6 @@ cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d h1:E/8y0oG3u9hBR8l4F9MtC0LdZIamPCUwUoLlrHrX86I= -cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d/go.mod h1:xbjky3L3DJEylaho6gXplkrMvJ5sFgv+qNX+Nn47bzY= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/testutil/keeper/codec.go b/testutil/keeper/codec.go index 8317ac4449..13003445ae 100644 --- a/testutil/keeper/codec.go +++ b/testutil/keeper/codec.go @@ -13,7 +13,7 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - etherminttypes "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -36,7 +36,7 @@ func NewCodec() *codec.ProtoCodec { evidencetypes.RegisterInterfaces(registry) crisistypes.RegisterInterfaces(registry) evmtypes.RegisterInterfaces(registry) - etherminttypes.RegisterInterfaces(registry) + ethermint.RegisterInterfaces(registry) crosschaintypes.RegisterInterfaces(registry) emissionstypes.RegisterInterfaces(registry) fungibletypes.RegisterInterfaces(registry) diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index 563a7aaf95..21b51b8558 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -8,7 +8,6 @@ import ( "sync" "time" - "cosmossdk.io/simapp/params" rpchttp "github.com/cometbft/cometbft/rpc/client/http" cosmosclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -17,10 +16,8 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/pkg/errors" "github.com/rs/zerolog" + etherminttypes "github.com/zeta-chain/ethermint/types" feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/pkg/authz" "github.com/zeta-chain/zetacore/pkg/chains" @@ -32,6 +29,8 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/config" zctx "github.com/zeta-chain/zetacore/zetaclient/context" keyinterfaces "github.com/zeta-chain/zetacore/zetaclient/keys/interfaces" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) var _ interfaces.ZetacoreClient = &Client{} @@ -48,7 +47,7 @@ type Client struct { accountNumber map[authz.KeyType]uint64 seqNumber map[authz.KeyType]uint64 - encodingCfg params.EncodingConfig + encodingCfg etherminttypes.EncodingConfig keys keyinterfaces.ObserverKeys chainID string chain chains.Chain @@ -178,7 +177,7 @@ func buildCosmosClientContext( chainID string, keys keyinterfaces.ObserverKeys, config config.ClientConfiguration, - encodingConfig params.EncodingConfig, + encodingConfig etherminttypes.EncodingConfig, opts constructOpts, ) (cosmosclient.Context, error) { if keys == nil { From d8256c9b6df696dfe00a085324eb9859faa9a70a Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 7 Aug 2024 18:35:18 +0200 Subject: [PATCH 04/26] fix: adapt to testutil to changes --- app/app.go | 1 - testutil/keeper/authority.go | 10 +++-- testutil/keeper/codec.go | 3 +- testutil/keeper/config.go | 79 +++++++++++++++++++++++++++++++++- testutil/keeper/crosschain.go | 73 ++++++++++++++++++++++--------- testutil/keeper/emissions.go | 7 +-- testutil/keeper/fungible.go | 61 +++++++++++++++++--------- testutil/keeper/keeper.go | 36 ++++++++++------ testutil/keeper/lightclient.go | 10 +++-- testutil/keeper/observer.go | 10 +++-- zetaclient/zetacore/client.go | 5 ++- 11 files changed, 219 insertions(+), 76 deletions(-) diff --git a/app/app.go b/app/app.go index 98bc427982..8784de770d 100644 --- a/app/app.go +++ b/app/app.go @@ -560,7 +560,6 @@ func New( ) evmSs := app.GetSubspace(evmtypes.ModuleName) - allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tkeys)+len(memKeys)) for k, v := range keys { allKeys[k] = v diff --git a/testutil/keeper/authority.go b/testutil/keeper/authority.go index 169b6df526..69ec02b493 100644 --- a/testutil/keeper/authority.go +++ b/testutil/keeper/authority.go @@ -4,8 +4,10 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/mock" @@ -28,8 +30,8 @@ func initAuthorityKeeper( ) keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, db) + ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) + ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, nil) return keeper.NewKeeper( cdc, @@ -46,14 +48,14 @@ func AuthorityKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() // Create regular keepers sdkKeepers := NewSDKKeepers(cdc, db, stateStore) // Create the observer keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/testutil/keeper/codec.go b/testutil/keeper/codec.go index 13003445ae..d9be189d04 100644 --- a/testutil/keeper/codec.go +++ b/testutil/keeper/codec.go @@ -42,6 +42,5 @@ func NewCodec() *codec.ProtoCodec { fungibletypes.RegisterInterfaces(registry) observertypes.RegisterInterfaces(registry) - cdc := codec.NewProtoCodec(registry) - return cdc + return codec.NewProtoCodec(registry) } diff --git a/testutil/keeper/config.go b/testutil/keeper/config.go index 9c2c63cf27..ec42304a64 100644 --- a/testutil/keeper/config.go +++ b/testutil/keeper/config.go @@ -1,6 +1,34 @@ package keeper -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + 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" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" + feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" + + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" + lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) const ( AccountAddressPrefix = "zeta" @@ -23,3 +51,52 @@ func SetConfig(seal bool) { config.Seal() } } + +func StoreKeys() ( + map[string]*storetypes.KVStoreKey, + map[string]*storetypes.MemoryStoreKey, + map[string]*storetypes.TransientStoreKey, + map[string]storetypes.StoreKey, +) { + keys := sdk.NewKVStoreKeys( + authtypes.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + distrtypes.StoreKey, + slashingtypes.StoreKey, + govtypes.StoreKey, + paramstypes.StoreKey, + group.StoreKey, + upgradetypes.StoreKey, + evidencetypes.StoreKey, + ibcexported.StoreKey, + ibctransfertypes.StoreKey, + capabilitytypes.StoreKey, + authzkeeper.StoreKey, + evmtypes.StoreKey, + feemarkettypes.StoreKey, + authoritytypes.StoreKey, + lightclienttypes.StoreKey, + crosschaintypes.StoreKey, + observertypes.StoreKey, + fungibletypes.StoreKey, + emissionstypes.StoreKey, + consensusparamtypes.StoreKey, + crisistypes.StoreKey, + ) + tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + + allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tkeys)+len(memKeys)) + for k, v := range keys { + allKeys[k] = v + } + for k, v := range tkeys { + allKeys[k] = v + } + for k, v := range memKeys { + allKeys[k] = v + } + + return keys, memKeys, tkeys, allKeys +} diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index f714475ca8..ceacad7bf3 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -5,10 +5,14 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -18,9 +22,15 @@ import ( "github.com/zeta-chain/zetacore/pkg/coin" crosschainmocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/crosschain" "github.com/zeta-chain/zetacore/testutil/sample" + authoritykeeper "github.com/zeta-chain/zetacore/x/authority/keeper" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" + fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" + lightclientkeeper "github.com/zeta-chain/zetacore/x/lightclient/keeper" + lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" + observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -85,40 +95,54 @@ func CrosschainKeeperWithMocks( t testing.TB, mockOptions CrosschainMockOptions, ) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { - SetConfig(false) - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + keys, memKeys, tkeys, allKeys := StoreKeys() // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + logger := log.NewNopLogger() + stateStore := rootmulti.NewStore(db, logger) cdc := NewCodec() // Create regular keepers - sdkKeepers := NewSDKKeepers(cdc, db, stateStore) + sdkKeepers := NewSDKKeepersWithKeys(cdc, keys, memKeys, tkeys, allKeys) // Create zeta keepers - authorityKeeperTmp := initAuthorityKeeper(cdc, db, stateStore) - lightclientKeeperTmp := initLightclientKeeper(cdc, db, stateStore, authorityKeeperTmp) - observerKeeperTmp := initObserverKeeper( + authorityKeeperTmp := authoritykeeper.NewKeeper( cdc, - db, - stateStore, + keys[authoritytypes.StoreKey], + memKeys[authoritytypes.MemStoreKey], + AuthorityGovAddress, + ) + + lightclientKeeperTmp := lightclientkeeper.NewKeeper( + cdc, + keys[lightclienttypes.StoreKey], + memKeys[lightclienttypes.MemStoreKey], + authorityKeeperTmp, + ) + + observerKeeperTmp := observerkeeper.NewKeeper( + cdc, + keys[observertypes.StoreKey], + memKeys[observertypes.MemStoreKey], sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, authorityKeeperTmp, lightclientKeeperTmp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - fungibleKeeperTmp := initFungibleKeeper( + + fungibleKeeperTmp := fungiblekeeper.NewKeeper( cdc, - db, - stateStore, + keys[types.StoreKey], + memKeys[types.MemStoreKey], sdkKeepers.AuthKeeper, - sdkKeepers.BankKeeper, sdkKeepers.EvmKeeper, + sdkKeepers.BankKeeper, observerKeeperTmp, authorityKeeperTmp, ) + zetaKeepers := ZetaKeepers{ ObserverKeeper: observerKeeperTmp, FungibleKeeper: fungibleKeeperTmp, @@ -129,9 +153,15 @@ func CrosschainKeeperWithMocks( var observerKeeper types.ObserverKeeper = observerKeeperTmp var fungibleKeeper types.FungibleKeeper = fungibleKeeperTmp - // Create the crosschain keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + for _, key := range keys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + } + for _, key := range tkeys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeTransient, nil) + } + for _, key := range memKeys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeMemory, nil) + } // Initialize mocks for mocked keepers var authKeeper types.AccountKeeper = sdkKeepers.AuthKeeper @@ -163,8 +193,8 @@ func CrosschainKeeperWithMocks( // create crosschain keeper k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, + keys[types.StoreKey], + memKeys[types.MemStoreKey], stakingKeeper, authKeeper, bankKeeper, @@ -189,8 +219,9 @@ func CrosschainKeeperWithMocks( } k.SetIBCCrosschainKeeper(ibcCrosschainKeeperTmp) - // seal the IBC router - sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) + // Seal the IBC router. + // TODO: Is this really necessary? + // sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) // load the latest version of the state store require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/testutil/keeper/emissions.go b/testutil/keeper/emissions.go index 594f46aca0..6c5bb47068 100644 --- a/testutil/keeper/emissions.go +++ b/testutil/keeper/emissions.go @@ -4,7 +4,8 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" - "github.com/cosmos/cosmos-sdk/store" + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -37,7 +38,7 @@ func EmissionKeeperWithMockOptions( // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() // Create regular keepers @@ -62,7 +63,7 @@ func EmissionKeeperWithMockOptions( var observerKeeper types.ObserverKeeper = observerKeeperTmp // Create the fungible keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index ca20891117..9daac4d3aa 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -5,10 +5,14 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/zeta-chain/ethermint/x/evm/statedb" @@ -16,9 +20,15 @@ import ( fungiblemocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/fungible" "github.com/zeta-chain/zetacore/testutil/sample" + authoritykeeper "github.com/zeta-chain/zetacore/x/authority/keeper" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" fungiblemodule "github.com/zeta-chain/zetacore/x/fungible" "github.com/zeta-chain/zetacore/x/fungible/keeper" "github.com/zeta-chain/zetacore/x/fungible/types" + lightclientkeeper "github.com/zeta-chain/zetacore/x/lightclient/keeper" + lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" + observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) type FungibleMockOptions struct { @@ -52,8 +62,8 @@ func initFungibleKeeper( ) *keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, db) + ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) + ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, nil) return keeper.NewKeeper( cdc, @@ -72,42 +82,44 @@ func FungibleKeeperWithMocks( t testing.TB, mockOptions FungibleMockOptions, ) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + keys, memKeys, tkeys, allKeys := StoreKeys() // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() // Create regular keepers - sdkKeepers := NewSDKKeepers(cdc, db, stateStore) + sdkKeepers := NewSDKKeepersWithKeys(cdc, keys, memKeys, tkeys, allKeys) // Create authority keeper - authorityKeeperTmp := initAuthorityKeeper( + authorityKeeperTmp := authoritykeeper.NewKeeper( cdc, - db, - stateStore, + keys[authoritytypes.StoreKey], + memKeys[authoritytypes.MemStoreKey], + AuthorityGovAddress, ) // Create lightclient keeper - lightclientKeeperTmp := initLightclientKeeper( + lightclientKeeperTmp := lightclientkeeper.NewKeeper( cdc, - db, - stateStore, + keys[lightclienttypes.StoreKey], + memKeys[lightclienttypes.MemStoreKey], authorityKeeperTmp, ) // Create observer keeper - observerKeeperTmp := initObserverKeeper( + observerKeeperTmp := observerkeeper.NewKeeper( cdc, - db, - stateStore, + keys[observertypes.StoreKey], + memKeys[observertypes.MemStoreKey], sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, authorityKeeperTmp, lightclientKeeperTmp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + zetaKeepers := ZetaKeepers{ ObserverKeeper: observerKeeperTmp, AuthorityKeeper: &authorityKeeperTmp, @@ -117,13 +129,20 @@ func FungibleKeeperWithMocks( var authorityKeeper types.AuthorityKeeper = authorityKeeperTmp // Create the fungible keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) + for _, key := range keys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + } + for _, key := range tkeys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeTransient, nil) + } + for _, key := range memKeys { + stateStore.MountStoreWithDB(key, storetypes.StoreTypeMemory, nil) + } - ctx := NewContext(stateStore) + require.NoError(t, stateStore.LoadLatestVersion()) // Initialize modules genesis + ctx := NewContext(stateStore) sdkKeepers.InitGenesis(ctx) zetaKeepers.InitGenesis(ctx) @@ -153,8 +172,8 @@ func FungibleKeeperWithMocks( k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, + keys[types.StoreKey], + memKeys[types.MemStoreKey], authKeeper, evmKeeper, bankKeeper, diff --git a/testutil/keeper/keeper.go b/testutil/keeper/keeper.go index b59b90b023..c33e0686f5 100644 --- a/testutil/keeper/keeper.go +++ b/testutil/keeper/keeper.go @@ -142,7 +142,12 @@ var moduleAccountPerms = map[string][]string{ } var ( - testStoreKeys = sdk.NewKVStoreKeys(authtypes.StoreKey, banktypes.StoreKey, evmtypes.StoreKey, consensustypes.StoreKey) + testStoreKeys = sdk.NewKVStoreKeys( + authtypes.StoreKey, + banktypes.StoreKey, + evmtypes.StoreKey, + consensustypes.StoreKey, + ) testTransientKeys = sdk.NewTransientStoreKeys(evmtypes.TransientKey) testMemKeys = sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) ) @@ -392,6 +397,7 @@ func EVMKeeper( func NewSDKKeepersWithKeys( cdc codec.Codec, keys map[string]*storetypes.KVStoreKey, + memKeys map[string]*storetypes.MemoryStoreKey, tKeys map[string]*storetypes.TransientStoreKey, allKeys map[string]storetypes.StoreKey, ) SDKKeepers { @@ -448,7 +454,7 @@ func NewSDKKeepersWithKeys( feeMarketKeeper, "", paramsKeeper.Subspace(evmtypes.ModuleName), - nil, + []evmkeeper.CustomContractFn{}, consensusKeeper, allKeys, ) @@ -459,14 +465,21 @@ func NewSDKKeepersWithKeys( stakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + capabilityKeeper := capabilitykeeper.NewKeeper( + cdc, + keys[capabilitytypes.StoreKey], + memKeys[capabilitytypes.MemStoreKey], + ) + return SDKKeepers{ - ParamsKeeper: paramsKeeper, - AuthKeeper: authKeeper, - BankKeeper: bankKeeper, - StakingKeeper: stakingKeeper, - FeeMarketKeeper: feeMarketKeeper, - EvmKeeper: evmKeeper, - SlashingKeeper: slashingKeeper, + ParamsKeeper: paramsKeeper, + AuthKeeper: authKeeper, + BankKeeper: bankKeeper, + StakingKeeper: stakingKeeper, + FeeMarketKeeper: feeMarketKeeper, + EvmKeeper: evmKeeper, + SlashingKeeper: slashingKeeper, + CapabilityKeeper: capabilityKeeper, } } @@ -540,8 +553,7 @@ func TransferKeeper( ) // create IBC module from bottom to top of stack - var transferStack porttypes.IBCModule - transferStack = transfer.NewIBCModule(transferKeeper) + transferStack := transfer.NewIBCModule(transferKeeper) // Add transfer stack to IBC Router ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) @@ -608,11 +620,9 @@ func NewSDKKeepers( // InitGenesis initializes the test modules genesis state func (sdkk SDKKeepers) InitGenesis(ctx sdk.Context) { capabilitymodule.InitGenesis(ctx, *sdkk.CapabilityKeeper, *capabilitytypes.DefaultGenesis()) - sdkk.AuthKeeper.InitGenesis(ctx, *authtypes.DefaultGenesisState()) sdkk.BankKeeper.InitGenesis(ctx, banktypes.DefaultGenesisState()) sdkk.StakingKeeper.InitGenesis(ctx, stakingtypes.DefaultGenesisState()) - evmGenesis := *evmtypes.DefaultGenesisState() evmGenesis.Params.EvmDenom = "azeta" evmmodule.InitGenesis(ctx, sdkk.EvmKeeper, sdkk.AuthKeeper, evmGenesis) diff --git a/testutil/keeper/lightclient.go b/testutil/keeper/lightclient.go index c9d907ec3d..6f11e68486 100644 --- a/testutil/keeper/lightclient.go +++ b/testutil/keeper/lightclient.go @@ -4,8 +4,10 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -35,8 +37,8 @@ func initLightclientKeeper( ) keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, db) + ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) + ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, nil) return keeper.NewKeeper(cdc, storeKey, memKey, authorityKeeper) } @@ -51,7 +53,7 @@ func LightclientKeeperWithMocks( // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() authorityKeeperTmp := initAuthorityKeeper(cdc, db, stateStore) @@ -60,7 +62,7 @@ func LightclientKeeperWithMocks( sdkKeepers := NewSDKKeepers(cdc, db, stateStore) // Create the observer keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/testutil/keeper/observer.go b/testutil/keeper/observer.go index f482fed0bc..267a3a1c60 100644 --- a/testutil/keeper/observer.go +++ b/testutil/keeper/observer.go @@ -4,8 +4,10 @@ import ( "testing" tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -50,8 +52,8 @@ func initObserverKeeper( ) *keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, db) + ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) + ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, nil) return keeper.NewKeeper( cdc, @@ -75,7 +77,7 @@ func ObserverKeeperWithMocks( // Initialize local store db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() authorityKeeperTmp := initAuthorityKeeper(cdc, db, stateStore) @@ -85,7 +87,7 @@ func ObserverKeeperWithMocks( sdkKeepers := NewSDKKeepers(cdc, db, stateStore) // Create the observer keeper - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index 21b51b8558..452f09aae9 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -18,6 +18,9 @@ import ( "github.com/rs/zerolog" etherminttypes "github.com/zeta-chain/ethermint/types" feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/pkg/authz" "github.com/zeta-chain/zetacore/pkg/chains" @@ -29,8 +32,6 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/config" zctx "github.com/zeta-chain/zetacore/zetaclient/context" keyinterfaces "github.com/zeta-chain/zetacore/zetaclient/keys/interfaces" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) var _ interfaces.ZetacoreClient = &Client{} From d987a02bd89410cbde3ec21713366d3d4bddff2e Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Thu, 8 Aug 2024 12:08:25 +0200 Subject: [PATCH 05/26] fix: linting --- testutil/network/network_setup.go | 4 ++-- x/crosschain/client/querytests/suite.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testutil/network/network_setup.go b/testutil/network/network_setup.go index 7fe4855de9..0a942aa83b 100644 --- a/testutil/network/network_setup.go +++ b/testutil/network/network_setup.go @@ -553,7 +553,7 @@ func (n *Network) LatestHeight() (int64, error) { for { select { case <-timeout.C: - return latestHeight, errors.New("timeout exceeded waiting for block") + return latestHeight, errors.New("LatestHeight: timeout exceeded waiting for block") case <-ticker.C: res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{}) if err == nil && res != nil { @@ -590,7 +590,7 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err for { select { case <-timeout.C: - return latestHeight, errors.New("timeout exceeded waiting for block") + return latestHeight, errors.New("WaitForHeightWithTimeout: timeout exceeded waiting for block") case <-ticker.C: res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{}) diff --git a/x/crosschain/client/querytests/suite.go b/x/crosschain/client/querytests/suite.go index 9d57b6ce79..36eb7c1d34 100644 --- a/x/crosschain/client/querytests/suite.go +++ b/x/crosschain/client/querytests/suite.go @@ -9,7 +9,7 @@ import ( cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/testutil/network" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) type CliTestSuite struct { @@ -18,7 +18,7 @@ type CliTestSuite struct { cfg network.Config network *network.Network crosschainState *types.GenesisState - observerState *observerTypes.GenesisState + observerState *observertypes.GenesisState } func NewCLITestSuite(cfg network.Config) *CliTestSuite { From ac03a5d321dc093f2a9b0826bbfeafb291ffcabb Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Thu, 8 Aug 2024 12:57:44 +0200 Subject: [PATCH 06/26] chore: add changelog and remove unused vars --- changelog.md | 1 + testutil/keeper/authority.go | 1 - testutil/keeper/emissions.go | 5 ++--- testutil/keeper/fungible.go | 1 - testutil/keeper/ibccrosschain.go | 6 ++---- testutil/keeper/lightclient.go | 3 +-- testutil/keeper/observer.go | 5 ++--- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/changelog.md b/changelog.md index 7cf196b8c8..bef780d4a2 100644 --- a/changelog.md +++ b/changelog.md @@ -57,6 +57,7 @@ * [2524](https://github.com/zeta-chain/node/pull/2524) - add inscription envelop parsing * [2560](https://github.com/zeta-chain/node/pull/2560) - add support for Solana SOL token withdraw * [2533](https://github.com/zeta-chain/node/pull/2533) - parse memo from both OP_RETURN and inscription +* [2633](https://github.com/zeta-chain/node/pull/2633) - support for stateful precompiled contracts. ### Refactor diff --git a/testutil/keeper/authority.go b/testutil/keeper/authority.go index 69ec02b493..34b917f2d4 100644 --- a/testutil/keeper/authority.go +++ b/testutil/keeper/authority.go @@ -25,7 +25,6 @@ var ( func initAuthorityKeeper( cdc codec.Codec, - db *tmdb.MemDB, ss store.CommitMultiStore, ) keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) diff --git a/testutil/keeper/emissions.go b/testutil/keeper/emissions.go index 6c5bb47068..903b7457c2 100644 --- a/testutil/keeper/emissions.go +++ b/testutil/keeper/emissions.go @@ -44,17 +44,16 @@ func EmissionKeeperWithMockOptions( // Create regular keepers sdkKeepers := NewSDKKeepers(cdc, db, stateStore) - authorityKeeper := initAuthorityKeeper(cdc, db, stateStore) + authorityKeeper := initAuthorityKeeper(cdc, stateStore) // Create zeta keepers observerKeeperTmp := initObserverKeeper( cdc, - db, stateStore, sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, authorityKeeper, - initLightclientKeeper(cdc, db, stateStore, authorityKeeper), + initLightclientKeeper(cdc, stateStore, authorityKeeper), ) zetaKeepers := ZetaKeepers{ diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index 9daac4d3aa..c1a25a75b1 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -52,7 +52,6 @@ var ( func initFungibleKeeper( cdc codec.Codec, - db *tmdb.MemDB, ss store.CommitMultiStore, authKeeper types.AccountKeeper, bankKeepr types.BankKeeper, diff --git a/testutil/keeper/ibccrosschain.go b/testutil/keeper/ibccrosschain.go index a13ca4fe00..d90e485002 100644 --- a/testutil/keeper/ibccrosschain.go +++ b/testutil/keeper/ibccrosschain.go @@ -69,11 +69,10 @@ func IBCCrosschainKeeperWithMocks( sdkKeepers := NewSDKKeepers(cdc, db, stateStore) // Create zeta keepers - authorityKeeper := initAuthorityKeeper(cdc, db, stateStore) - lightclientKeeper := initLightclientKeeper(cdc, db, stateStore, authorityKeeper) + authorityKeeper := initAuthorityKeeper(cdc, stateStore) + lightclientKeeper := initLightclientKeeper(cdc, stateStore, authorityKeeper) observerKeeper := initObserverKeeper( cdc, - db, stateStore, sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, @@ -82,7 +81,6 @@ func IBCCrosschainKeeperWithMocks( ) fungibleKeeper := initFungibleKeeper( cdc, - db, stateStore, sdkKeepers.AuthKeeper, sdkKeepers.BankKeeper, diff --git a/testutil/keeper/lightclient.go b/testutil/keeper/lightclient.go index 6f11e68486..62aa09288e 100644 --- a/testutil/keeper/lightclient.go +++ b/testutil/keeper/lightclient.go @@ -31,7 +31,6 @@ var ( func initLightclientKeeper( cdc codec.Codec, - db *tmdb.MemDB, ss store.CommitMultiStore, authorityKeeper types.AuthorityKeeper, ) keeper.Keeper { @@ -56,7 +55,7 @@ func LightclientKeeperWithMocks( stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() - authorityKeeperTmp := initAuthorityKeeper(cdc, db, stateStore) + authorityKeeperTmp := initAuthorityKeeper(cdc, stateStore) // Create regular keepers sdkKeepers := NewSDKKeepers(cdc, db, stateStore) diff --git a/testutil/keeper/observer.go b/testutil/keeper/observer.go index 267a3a1c60..c45d988045 100644 --- a/testutil/keeper/observer.go +++ b/testutil/keeper/observer.go @@ -43,7 +43,6 @@ var ( func initObserverKeeper( cdc codec.Codec, - db *tmdb.MemDB, ss store.CommitMultiStore, stakingKeeper stakingkeeper.Keeper, slashingKeeper slashingkeeper.Keeper, @@ -80,8 +79,8 @@ func ObserverKeeperWithMocks( stateStore := rootmulti.NewStore(db, log.NewNopLogger()) cdc := NewCodec() - authorityKeeperTmp := initAuthorityKeeper(cdc, db, stateStore) - lightclientKeeperTmp := initLightclientKeeper(cdc, db, stateStore, authorityKeeperTmp) + authorityKeeperTmp := initAuthorityKeeper(cdc, stateStore) + lightclientKeeperTmp := initLightclientKeeper(cdc, stateStore, authorityKeeperTmp) // Create regular keepers sdkKeepers := NewSDKKeepers(cdc, db, stateStore) From a6fa3e734d74eefd4477cd935a33f880607c8af0 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Thu, 8 Aug 2024 15:43:23 +0200 Subject: [PATCH 07/26] fix: create aggregateAllKeys function --- app/app.go | 59 ++++++++++++++++++---------------- cmd/zetaclientd/start_utils.go | 3 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/app/app.go b/app/app.go index 8784de770d..4c74dee89b 100644 --- a/app/app.go +++ b/app/app.go @@ -144,16 +144,11 @@ func init() { var ( AccountAddressPrefix = "zeta" NodeDir = ".zetacored" + DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir // AddrLen is the allowed length (in bytes) for an address. - // // NOTE: In the SDK, the default value is 255. AddrLen = 20 -) - -var ( - // DefaultNodeHome default home directories for wasmd - DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address Bech32PrefixAccAddr = AccountAddressPrefix @@ -354,9 +349,9 @@ func New( consensusparamtypes.StoreKey, crisistypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) + tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) memKeys := sdk.NewMemoryStoreKeys( - //capabilitytypes.MemStoreKey, + // capabilitytypes.MemStoreKey, ) app := &App{ @@ -366,7 +361,7 @@ func New( interfaceRegistry: interfaceRegistry, invCheckPeriod: invCheckPeriod, keys: keys, - tkeys: tkeys, + tkeys: tKeys, memKeys: memKeys, } if homePath == "" { @@ -376,7 +371,7 @@ func New( // get authority address authAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) + app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tKeys[paramstypes.TStoreKey]) // set the BaseApp's parameter store app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authAddr) bApp.SetParamStore(&app.ConsensusParamsKeeper) @@ -554,29 +549,16 @@ func New( appCodec, authtypes.NewModuleAddress(govtypes.ModuleName), keys[feemarkettypes.StoreKey], - tkeys[feemarkettypes.TransientKey], + tKeys[feemarkettypes.TransientKey], feeSs, app.ConsensusParamsKeeper, ) evmSs := app.GetSubspace(evmtypes.ModuleName) - allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tkeys)+len(memKeys)) - for k, v := range keys { - allKeys[k] = v - } - for k, v := range tkeys { - allKeys[k] = v - } - for k, v := range memKeys { - allKeys[k] = v - } - - //gasConfig := storetypes.TransientGasConfig() - app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], - tkeys[evmtypes.TransientKey], + tKeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, @@ -586,7 +568,7 @@ func New( evmSs, []evmkeeper.CustomContractFn{}, app.ConsensusParamsKeeper, - allKeys, + aggregateAllKeys(keys, tKeys, memKeys), ) app.FungibleKeeper = *fungiblekeeper.NewKeeper( @@ -825,7 +807,7 @@ func New( // initialize stores app.MountKVStores(keys) - app.MountTransientStores(tkeys) + app.MountTransientStores(tKeys) app.MountMemoryStores(memKeys) // initialize BaseApp @@ -1073,3 +1055,26 @@ func (app *App) BlockedAddrs() map[string]bool { } return blockList } + +// aggregateAllKeys aggregates all the keys in a single map. +func aggregateAllKeys( + keys map[string]*storetypes.KVStoreKey, + tKeys map[string]*storetypes.TransientStoreKey, + memKeys map[string]*storetypes.MemoryStoreKey, +) map[string]storetypes.StoreKey { + allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tKeys)+len(memKeys)) + + for k, v := range keys { + allKeys[k] = v + } + + for k, v := range tKeys { + allKeys[k] = v + } + + for k, v := range memKeys { + allKeys[k] = v + } + + return allKeys +} diff --git a/cmd/zetaclientd/start_utils.go b/cmd/zetaclientd/start_utils.go index 9692f32b29..e8070ab5d0 100644 --- a/cmd/zetaclientd/start_utils.go +++ b/cmd/zetaclientd/start_utils.go @@ -10,6 +10,7 @@ import ( "github.com/pkg/errors" "github.com/rs/zerolog" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "github.com/zeta-chain/zetacore/zetaclient/config" ) @@ -20,7 +21,7 @@ func waitForZetaCore(config config.Config, logger zerolog.Logger) { for { _, err := grpc.Dial( fmt.Sprintf("%s:9090", config.ZetaCoreURL), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { logger.Warn().Err(err).Msg("grpc dial fail") From 871cdd1654cab1020a5a35954eccdacde65bd47f Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 21 Aug 2024 12:48:40 +0200 Subject: [PATCH 08/26] feat: add e2e test stateful contract (#2703) * feat: add test precompiled contract * feat: add test stateful contract * feat: enable contracts granularly * feat: allow passing the app ctx to contracts * revert ctx changes * format ABI * add first e2e test * add RegularCaller contract to e2e * add signer to deployment * fix e2e, use regular abi * minor rewording * use idiomatic errors * remove unused files * rename and generate bindings automatically * create a new e2e section for precompiles * add bindings generator and makefile target * add GetGasStabilityPoolBalance as prototype contract function * include getGasStabilityPoolBalance function * apply code review fixes * include tests for precompiles package * delete regularcaller * ignore bindings from codecov * introduce more unit testing * add unit testing for prototype.go * minor linting fixes * remove ctx, keep fungible keeper private * increase unit tests coverage * add keys for new user_precompile * add init unit test * switch to double quotes * avoid go:embed * fixes derived from code review * refactor some parts of bech32 functions --- Makefile | 7 +- app/app.go | 13 +- changelog.md | 6 +- cmd/zetae2e/config/clients.go | 3 +- cmd/zetae2e/config/localnet.yml | 7 +- cmd/zetae2e/local/local.go | 4 + cmd/zetae2e/local/precompiles.go | 54 ++++ codecov.yml | 7 +- e2e/config/config.go | 6 + e2e/e2etests/e2etests.go | 14 + e2e/e2etests/test_precompiles_prototype.go | 36 +++ precompiles/precompiles.go | 43 +++ precompiles/precompiles_test.go | 39 +++ precompiles/prototype/IPrototype.abi | 64 ++++ precompiles/prototype/IPrototype.go | 274 +++++++++++++++++ precompiles/prototype/IPrototype.json | 66 ++++ precompiles/prototype/IPrototype.sol | 34 +++ precompiles/prototype/bindings.go | 7 + precompiles/prototype/prototype.go | 258 ++++++++++++++++ precompiles/prototype/prototype_test.go | 339 +++++++++++++++++++++ precompiles/types/errors.go | 44 +++ precompiles/types/errors_test.go | 48 +++ precompiles/types/types.go | 54 ++++ precompiles/types/types_test.go | 26 ++ scripts/bindings-stateful-precompiles.sh | 12 + 25 files changed, 1458 insertions(+), 7 deletions(-) create mode 100644 cmd/zetae2e/local/precompiles.go create mode 100644 e2e/e2etests/test_precompiles_prototype.go create mode 100644 precompiles/precompiles.go create mode 100644 precompiles/precompiles_test.go create mode 100644 precompiles/prototype/IPrototype.abi create mode 100644 precompiles/prototype/IPrototype.go create mode 100644 precompiles/prototype/IPrototype.json create mode 100644 precompiles/prototype/IPrototype.sol create mode 100644 precompiles/prototype/bindings.go create mode 100644 precompiles/prototype/prototype.go create mode 100644 precompiles/prototype/prototype_test.go create mode 100644 precompiles/types/errors.go create mode 100644 precompiles/types/errors_test.go create mode 100644 precompiles/types/types.go create mode 100644 precompiles/types/types_test.go create mode 100755 scripts/bindings-stateful-precompiles.sh diff --git a/Makefile b/Makefile index c8381d9538..6f0267ba32 100644 --- a/Makefile +++ b/Makefile @@ -202,8 +202,13 @@ mocks: @bash ./scripts/mocks-generate.sh .PHONY: mocks +precompiles: + @echo "--> Generating bindings for precompiled contracts" + @bash ./scripts/bindings-stateful-precompiles.sh +.PHONY: precompiles + # generate also includes Go code formatting -generate: proto-gen openapi specs typescript docs-zetacored mocks fmt +generate: proto-gen openapi specs typescript docs-zetacored mocks precompiles fmt .PHONY: generate diff --git a/app/app.go b/app/app.go index 4c74dee89b..32d85214eb 100644 --- a/app/app.go +++ b/app/app.go @@ -92,6 +92,7 @@ import ( "github.com/zeta-chain/zetacore/app/ante" "github.com/zeta-chain/zetacore/docs/openapi" zetamempool "github.com/zeta-chain/zetacore/pkg/mempool" + "github.com/zeta-chain/zetacore/precompiles" srvflags "github.com/zeta-chain/zetacore/server/flags" authoritymodule "github.com/zeta-chain/zetacore/x/authority" authoritykeeper "github.com/zeta-chain/zetacore/x/authority/keeper" @@ -566,7 +567,7 @@ func New( &app.FeeMarketKeeper, tracer, evmSs, - []evmkeeper.CustomContractFn{}, + precompiles.StatefulContracts(&app.FungibleKeeper, appCodec, storetypes.TransientGasConfig()), app.ConsensusParamsKeeper, aggregateAllKeys(keys, tKeys, memKeys), ) @@ -1049,10 +1050,20 @@ func (app *App) SimulationManager() *module.SimulationManager { func (app *App) BlockedAddrs() map[string]bool { blockList := make(map[string]bool) + for k, v := range blockedReceivingModAcc { addr := authtypes.NewModuleAddress(k) blockList[addr.String()] = v } + + // Each enabled precompiled stateful contract should be added as a BlockedAddrs. + // That way it's marked as non payable by the bank keeper. + for addr, enabled := range precompiles.EnabledStatefulContracts { + if enabled { + blockList[addr.String()] = enabled + } + } + return blockList } diff --git a/changelog.md b/changelog.md index bef780d4a2..fcd82cffe7 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ * [2634](https://github.com/zeta-chain/node/pull/2634) - add support for EIP-1559 gas fees * [2597](https://github.com/zeta-chain/node/pull/2597) - Add generic rpc metrics to zetaclient * [2538](https://github.com/zeta-chain/node/pull/2538) - add background worker routines to shutdown zetaclientd when needed for tss migration +* [2633](https://github.com/zeta-chain/node/pull/2633) - support for stateful precompiled contracts. ### Refactor @@ -17,6 +18,10 @@ * [2654](https://github.com/zeta-chain/node/pull/2654) - add validation for authorization list in when validating genesis state for authorization module +### Tests + +* [2703](https://github.com/zeta-chain/node/pull/2703) - add e2e tests for stateful precompiled contracts + ## v19.0.0 ### Breaking Changes @@ -57,7 +62,6 @@ * [2524](https://github.com/zeta-chain/node/pull/2524) - add inscription envelop parsing * [2560](https://github.com/zeta-chain/node/pull/2560) - add support for Solana SOL token withdraw * [2533](https://github.com/zeta-chain/node/pull/2533) - parse memo from both OP_RETURN and inscription -* [2633](https://github.com/zeta-chain/node/pull/2633) - support for stateful precompiled contracts. ### Refactor diff --git a/cmd/zetae2e/config/clients.go b/cmd/zetae2e/config/clients.go index e70f2c566a..ac4686fc23 100644 --- a/cmd/zetae2e/config/clients.go +++ b/cmd/zetae2e/config/clients.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/gagliardetto/solana-go/rpc" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "github.com/zeta-chain/zetacore/e2e/config" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -156,7 +157,7 @@ func getZetaClients(rpc string) ( zetaChainClients, error, ) { - grpcConn, err := grpc.Dial(rpc, grpc.WithInsecure()) + grpcConn, err := grpc.Dial(rpc, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return zetaChainClients{}, err } diff --git a/cmd/zetae2e/config/localnet.yml b/cmd/zetae2e/config/localnet.yml index eb6ba8fbb9..220fb15255 100644 --- a/cmd/zetae2e/config/localnet.yml +++ b/cmd/zetae2e/config/localnet.yml @@ -41,6 +41,10 @@ additional_accounts: bech32_address: "zeta1pvtxa708yvdmszn687nne6nl8qn704daf420xz" evm_address: "0x0B166ef9e7231Bb80A7A3FA73CEA7F3827E7D5BD" private_key: "0bcc2fa28b526f90e1d54648d612db901e860bf68248555593f91ea801c6b482" + user_precompile: + bech32_address: "zeta1k4f0l2e9qqjccxnstwj0uaarxvn44lj990she9" + evm_address: "0xb552FFAb2500258C1A705Ba4Fe77A333275AFE45" + private_key: "bd6b74387f11b31d21e87c2ae7a23ec269aee08a355dad6c508a6fceb79d1f48" policy_accounts: emergency_policy_account: bech32_address: "zeta16m2cnrdwtgweq4njc6t470vl325gw4kp6s7tap" @@ -67,5 +71,4 @@ rpcs: solana: "http://solana:8899" zetacore_grpc: "zetacore0:9090" zetacore_rpc: "http://zetacore0:26657" - -# contracts will be populated on first run \ No newline at end of file +# contracts will be populated on first run diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index cb24096859..ae7af95374 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -228,6 +228,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { erc20AdvancedTests := []string{ e2etests.TestERC20DepositRestrictedName, } + precompiledContractTests := []string{ + e2etests.TestZetaPrecompilesPrototypeName, + } zetaTests := []string{ e2etests.TestZetaWithdrawName, e2etests.TestMessagePassingExternalChainsName, @@ -283,6 +286,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { ethereumTests = append(ethereumTests, ethereumAdvancedTests...) } + eg.Go(statefulPrecompilesTestRoutine(conf, deployerRunner, verbose, precompiledContractTests...)) eg.Go(erc20TestRoutine(conf, deployerRunner, verbose, erc20Tests...)) eg.Go(zetaTestRoutine(conf, deployerRunner, verbose, zetaTests...)) eg.Go(zevmMPTestRoutine(conf, deployerRunner, verbose, zevmMPTests...)) diff --git a/cmd/zetae2e/local/precompiles.go b/cmd/zetae2e/local/precompiles.go new file mode 100644 index 0000000000..55372431e6 --- /dev/null +++ b/cmd/zetae2e/local/precompiles.go @@ -0,0 +1,54 @@ +package local + +import ( + "fmt" + "time" + + "github.com/fatih/color" + + "github.com/zeta-chain/zetacore/e2e/config" + "github.com/zeta-chain/zetacore/e2e/e2etests" + "github.com/zeta-chain/zetacore/e2e/runner" +) + +// statefulPrecompilesTestRoutine runs steateful precompiles related e2e tests +func statefulPrecompilesTestRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + account := conf.AdditionalAccounts.UserPrecompile + + precompileRunner, err := initTestRunner( + "precompiles", + conf, + deployerRunner, + account, + runner.NewLogger(verbose, color.FgRed, "precompiles"), + ) + if err != nil { + return err + } + + precompileRunner.Logger.Print("🏃 starting stateful precompiled contracts tests") + startTime := time.Now() + + testsToRun, err := precompileRunner.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("precompiled contracts tests failed: %v", err) + } + + if err := precompileRunner.RunE2ETests(testsToRun); err != nil { + return fmt.Errorf("precompiled contracts tests failed: %v", err) + } + + precompileRunner.Logger.Print("🍾 precompiled contracts tests completed in %s", time.Since(startTime).String()) + + return err + } +} diff --git a/codecov.yml b/codecov.yml index 45df0a7f87..474cfe97ee 100644 --- a/codecov.yml +++ b/codecov.yml @@ -75,4 +75,9 @@ ignore: - "server" - "testutil" - "tool" - - "typescript/**/*" \ No newline at end of file + - "typescript/**/*" + - "precompiles/**/bindings.go" + - "precompiles/**/*.abi" + - "precompiles/**/*.json" + - "precompiles/**/*.sol" + - "precompiles/prototype/IPrototype.go" diff --git a/e2e/config/config.go b/e2e/config/config.go index 8e8006c042..2be878b444 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -68,6 +68,7 @@ type AdditionalAccounts struct { UserMisc Account `yaml:"user_misc"` UserAdmin Account `yaml:"user_admin"` UserMigration Account `yaml:"user_migration"` + UserPrecompile Account `yaml:"user_precompile"` } type PolicyAccounts struct { @@ -212,6 +213,7 @@ func (a AdditionalAccounts) AsSlice() []Account { a.UserMisc, a.UserAdmin, a.UserMigration, + a.UserPrecompile, } } @@ -304,6 +306,10 @@ func (c *Config) GenerateKeys() error { if err != nil { return err } + c.AdditionalAccounts.UserPrecompile, err = generateAccount() + if err != nil { + return err + } c.PolicyAccounts.EmergencyPolicyAccount, err = generateAccount() if err != nil { diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index 402eed367e..b2e78ed380 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -116,6 +116,11 @@ const ( Not used to test functionalities but do various interactions with the netwoks */ TestDeploy = "deploy" + + /* + Stateful precompiled contracts tests + */ + TestZetaPrecompilesPrototypeName = "precompile_contracts_prototype" ) // AllE2ETests is an ordered list of all e2e tests @@ -589,4 +594,13 @@ var AllE2ETests = []runner.E2ETest{ []runner.ArgDefinition{}, TestMigrateTSS, ), + /* + Stateful precompiled contracts tests + */ + runner.NewE2ETest( + TestZetaPrecompilesPrototypeName, + "test stateful precompiled contracts prototype", + []runner.ArgDefinition{}, + TestPrecompilesRegular, + ), } diff --git a/e2e/e2etests/test_precompiles_prototype.go b/e2e/e2etests/test_precompiles_prototype.go new file mode 100644 index 0000000000..a78a20385f --- /dev/null +++ b/e2e/e2etests/test_precompiles_prototype.go @@ -0,0 +1,36 @@ +package e2etests + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/e2e/runner" + "github.com/zeta-chain/zetacore/precompiles/prototype" +) + +func TestPrecompilesRegular(r *runner.E2ERunner, args []string) { + require.Len(r, args, 0, "No arguments expected") + + iPrototype, err := prototype.NewIPrototype(prototype.ContractAddress, r.ZEVMClient) + require.NoError(r, err, "Failed to create prototype contract caller") + + res, err := iPrototype.Bech32ify(nil, "zeta", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")) + require.NoError(r, err, "Error calling Bech32ify") + require.Equal(r, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", res, "Failed to validate Bech32ify result") + + addr, err := iPrototype.Bech32ToHexAddr(nil, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u") + require.NoError(r, err, "Error calling Bech32ToHexAddr") + require.Equal( + r, + "0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE", + addr.String(), + "Failed to validate Bech32ToHexAddr result", + ) + + chainID, err := r.EVMClient.ChainID(r.Ctx) + require.NoError(r, err, "Error retrieving ChainID") + + balance, err := iPrototype.GetGasStabilityPoolBalance(nil, chainID.Int64()) + require.NoError(r, err, "Error calling GetGasStabilityPoolBalance") + require.NotNil(r, balance, "GetGasStabilityPoolBalance returned balance is nil") +} diff --git a/precompiles/precompiles.go b/precompiles/precompiles.go new file mode 100644 index 0000000000..ad5eb55c50 --- /dev/null +++ b/precompiles/precompiles.go @@ -0,0 +1,43 @@ +package precompiles + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdktypes "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + ethparams "github.com/ethereum/go-ethereum/params" + evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" + + "github.com/zeta-chain/zetacore/precompiles/prototype" + "github.com/zeta-chain/zetacore/x/fungible/keeper" +) + +// EnabledStatefulContracts contains the list of all enabled stateful precompiles. +// This is useful for listing and reading from other packages, such as BlockedAddrs() function. +// Setting to false a contract here will disable it, not being included in the blockchain. +var EnabledStatefulContracts = map[common.Address]bool{ + prototype.ContractAddress: true, +} + +// StatefulContracts returns all the registered precompiled contracts. +func StatefulContracts( + fungibleKeeper *keeper.Keeper, + cdc codec.Codec, + gasConfig storetypes.GasConfig, +) (precompiledContracts []evmkeeper.CustomContractFn) { + // Initialize at 0 the custom compiled contracts and the addresses. + precompiledContracts = make([]evmkeeper.CustomContractFn, 0) + + // Define the regular contract function. + if EnabledStatefulContracts[prototype.ContractAddress] { + prototype := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract { + return prototype.NewIPrototypeContract(fungibleKeeper, cdc, gasConfig) + } + + // Append the regular contract to the precompiledContracts slice. + precompiledContracts = append(precompiledContracts, prototype) + } + + return precompiledContracts +} diff --git a/precompiles/precompiles_test.go b/precompiles/precompiles_test.go new file mode 100644 index 0000000000..06c8ccb0bb --- /dev/null +++ b/precompiles/precompiles_test.go @@ -0,0 +1,39 @@ +package precompiles + +import ( + "testing" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + ethparams "github.com/ethereum/go-ethereum/params" + "github.com/stretchr/testify/require" + ethermint "github.com/zeta-chain/ethermint/types" + "github.com/zeta-chain/zetacore/testutil/keeper" +) + +func Test_StatefulContracts(t *testing.T) { + k, ctx, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + + var expectedContracts int + for _, enabled := range EnabledStatefulContracts { + if enabled { + expectedContracts++ + } + } + + // StatefulContracts() should return all the enabled contracts. + contracts := StatefulContracts(k, appCodec, gasConfig) + require.NotNil(t, contracts, "StatefulContracts() should not return a nil slice") + require.Len(t, contracts, expectedContracts, "StatefulContracts() should return all the enabled contracts") + + // Extract the contract function from the first contract. + customContractFn := contracts[0] + contract := customContractFn(ctx, ethparams.Rules{}) + + // Check the contract function returns a valid address. + contractAddr := contract.Address() + require.NotNil(t, contractAddr, "The called contract should have a valid address") +} diff --git a/precompiles/prototype/IPrototype.abi b/precompiles/prototype/IPrototype.abi new file mode 100644 index 0000000000..d510aa3ec5 --- /dev/null +++ b/precompiles/prototype/IPrototype.abi @@ -0,0 +1,64 @@ +[ + { + "inputs": [ + { + "internalType": "string", + "name": "bech32", + "type": "string" + } + ], + "name": "bech32ToHexAddr", + "outputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "prefix", + "type": "string" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "bech32ify", + "outputs": [ + { + "internalType": "string", + "name": "bech32", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int64", + "name": "chainID", + "type": "int64" + } + ], + "name": "getGasStabilityPoolBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/precompiles/prototype/IPrototype.go b/precompiles/prototype/IPrototype.go new file mode 100644 index 0000000000..ab97bd36fc --- /dev/null +++ b/precompiles/prototype/IPrototype.go @@ -0,0 +1,274 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package prototype + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// IPrototypeMetaData contains all meta data concerning the IPrototype contract. +var IPrototypeMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"bech32\",\"type\":\"string\"}],\"name\":\"bech32ToHexAddr\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"prefix\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"bech32ify\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"bech32\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int64\",\"name\":\"chainID\",\"type\":\"int64\"}],\"name\":\"getGasStabilityPoolBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"result\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// IPrototypeABI is the input ABI used to generate the binding from. +// Deprecated: Use IPrototypeMetaData.ABI instead. +var IPrototypeABI = IPrototypeMetaData.ABI + +// IPrototype is an auto generated Go binding around an Ethereum contract. +type IPrototype struct { + IPrototypeCaller // Read-only binding to the contract + IPrototypeTransactor // Write-only binding to the contract + IPrototypeFilterer // Log filterer for contract events +} + +// IPrototypeCaller is an auto generated read-only Go binding around an Ethereum contract. +type IPrototypeCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPrototypeTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IPrototypeTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPrototypeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IPrototypeFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPrototypeSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IPrototypeSession struct { + Contract *IPrototype // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IPrototypeCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IPrototypeCallerSession struct { + Contract *IPrototypeCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IPrototypeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IPrototypeTransactorSession struct { + Contract *IPrototypeTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IPrototypeRaw is an auto generated low-level Go binding around an Ethereum contract. +type IPrototypeRaw struct { + Contract *IPrototype // Generic contract binding to access the raw methods on +} + +// IPrototypeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IPrototypeCallerRaw struct { + Contract *IPrototypeCaller // Generic read-only contract binding to access the raw methods on +} + +// IPrototypeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IPrototypeTransactorRaw struct { + Contract *IPrototypeTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIPrototype creates a new instance of IPrototype, bound to a specific deployed contract. +func NewIPrototype(address common.Address, backend bind.ContractBackend) (*IPrototype, error) { + contract, err := bindIPrototype(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IPrototype{IPrototypeCaller: IPrototypeCaller{contract: contract}, IPrototypeTransactor: IPrototypeTransactor{contract: contract}, IPrototypeFilterer: IPrototypeFilterer{contract: contract}}, nil +} + +// NewIPrototypeCaller creates a new read-only instance of IPrototype, bound to a specific deployed contract. +func NewIPrototypeCaller(address common.Address, caller bind.ContractCaller) (*IPrototypeCaller, error) { + contract, err := bindIPrototype(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IPrototypeCaller{contract: contract}, nil +} + +// NewIPrototypeTransactor creates a new write-only instance of IPrototype, bound to a specific deployed contract. +func NewIPrototypeTransactor(address common.Address, transactor bind.ContractTransactor) (*IPrototypeTransactor, error) { + contract, err := bindIPrototype(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IPrototypeTransactor{contract: contract}, nil +} + +// NewIPrototypeFilterer creates a new log filterer instance of IPrototype, bound to a specific deployed contract. +func NewIPrototypeFilterer(address common.Address, filterer bind.ContractFilterer) (*IPrototypeFilterer, error) { + contract, err := bindIPrototype(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IPrototypeFilterer{contract: contract}, nil +} + +// bindIPrototype binds a generic wrapper to an already deployed contract. +func bindIPrototype(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IPrototypeMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IPrototype *IPrototypeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IPrototype.Contract.IPrototypeCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IPrototype *IPrototypeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IPrototype.Contract.IPrototypeTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IPrototype *IPrototypeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IPrototype.Contract.IPrototypeTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IPrototype *IPrototypeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IPrototype.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IPrototype *IPrototypeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IPrototype.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IPrototype *IPrototypeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IPrototype.Contract.contract.Transact(opts, method, params...) +} + +// Bech32ToHexAddr is a free data retrieval call binding the contract method 0xe4e2a4ec. +// +// Solidity: function bech32ToHexAddr(string bech32) view returns(address addr) +func (_IPrototype *IPrototypeCaller) Bech32ToHexAddr(opts *bind.CallOpts, bech32 string) (common.Address, error) { + var out []interface{} + err := _IPrototype.contract.Call(opts, &out, "bech32ToHexAddr", bech32) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Bech32ToHexAddr is a free data retrieval call binding the contract method 0xe4e2a4ec. +// +// Solidity: function bech32ToHexAddr(string bech32) view returns(address addr) +func (_IPrototype *IPrototypeSession) Bech32ToHexAddr(bech32 string) (common.Address, error) { + return _IPrototype.Contract.Bech32ToHexAddr(&_IPrototype.CallOpts, bech32) +} + +// Bech32ToHexAddr is a free data retrieval call binding the contract method 0xe4e2a4ec. +// +// Solidity: function bech32ToHexAddr(string bech32) view returns(address addr) +func (_IPrototype *IPrototypeCallerSession) Bech32ToHexAddr(bech32 string) (common.Address, error) { + return _IPrototype.Contract.Bech32ToHexAddr(&_IPrototype.CallOpts, bech32) +} + +// Bech32ify is a free data retrieval call binding the contract method 0x0615b74e. +// +// Solidity: function bech32ify(string prefix, address addr) view returns(string bech32) +func (_IPrototype *IPrototypeCaller) Bech32ify(opts *bind.CallOpts, prefix string, addr common.Address) (string, error) { + var out []interface{} + err := _IPrototype.contract.Call(opts, &out, "bech32ify", prefix, addr) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Bech32ify is a free data retrieval call binding the contract method 0x0615b74e. +// +// Solidity: function bech32ify(string prefix, address addr) view returns(string bech32) +func (_IPrototype *IPrototypeSession) Bech32ify(prefix string, addr common.Address) (string, error) { + return _IPrototype.Contract.Bech32ify(&_IPrototype.CallOpts, prefix, addr) +} + +// Bech32ify is a free data retrieval call binding the contract method 0x0615b74e. +// +// Solidity: function bech32ify(string prefix, address addr) view returns(string bech32) +func (_IPrototype *IPrototypeCallerSession) Bech32ify(prefix string, addr common.Address) (string, error) { + return _IPrototype.Contract.Bech32ify(&_IPrototype.CallOpts, prefix, addr) +} + +// GetGasStabilityPoolBalance is a free data retrieval call binding the contract method 0x3ee8d1a4. +// +// Solidity: function getGasStabilityPoolBalance(int64 chainID) view returns(uint256 result) +func (_IPrototype *IPrototypeCaller) GetGasStabilityPoolBalance(opts *bind.CallOpts, chainID int64) (*big.Int, error) { + var out []interface{} + err := _IPrototype.contract.Call(opts, &out, "getGasStabilityPoolBalance", chainID) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetGasStabilityPoolBalance is a free data retrieval call binding the contract method 0x3ee8d1a4. +// +// Solidity: function getGasStabilityPoolBalance(int64 chainID) view returns(uint256 result) +func (_IPrototype *IPrototypeSession) GetGasStabilityPoolBalance(chainID int64) (*big.Int, error) { + return _IPrototype.Contract.GetGasStabilityPoolBalance(&_IPrototype.CallOpts, chainID) +} + +// GetGasStabilityPoolBalance is a free data retrieval call binding the contract method 0x3ee8d1a4. +// +// Solidity: function getGasStabilityPoolBalance(int64 chainID) view returns(uint256 result) +func (_IPrototype *IPrototypeCallerSession) GetGasStabilityPoolBalance(chainID int64) (*big.Int, error) { + return _IPrototype.Contract.GetGasStabilityPoolBalance(&_IPrototype.CallOpts, chainID) +} diff --git a/precompiles/prototype/IPrototype.json b/precompiles/prototype/IPrototype.json new file mode 100644 index 0000000000..3b7c9ea8cb --- /dev/null +++ b/precompiles/prototype/IPrototype.json @@ -0,0 +1,66 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "bech32", + "type": "string" + } + ], + "name": "bech32ToHexAddr", + "outputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "prefix", + "type": "string" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "bech32ify", + "outputs": [ + { + "internalType": "string", + "name": "bech32", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int64", + "name": "chainID", + "type": "int64" + } + ], + "name": "getGasStabilityPoolBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/precompiles/prototype/IPrototype.sol b/precompiles/prototype/IPrototype.sol new file mode 100644 index 0000000000..eb8f34d770 --- /dev/null +++ b/precompiles/prototype/IPrototype.sol @@ -0,0 +1,34 @@ +pragma solidity ^0.8.26; + +/// @dev The IPrototype contract's address. +address constant IPROTOTYPE_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000000065; // 101 + +/// @dev The IPrototype contract's instance. +IPrototype constant IPROTOTYPE_CONTRACT = IPrototype( + IPROTOTYPE_PRECOMPILE_ADDRESS +); + +interface IPrototype { + /// @dev converting a bech32 address to hexadecimal address. + /// @param bech32 The bech32 address. + /// @return addr The hexadecimal address. + function bech32ToHexAddr( + string memory bech32 + ) external view returns (address addr); + + /// @dev converting a hex address to bech32 address. + /// @param prefix of the bech32, e.g. zeta. + /// @param addr The hex address + /// @return bech32 The bech32 address. + function bech32ify( + string memory prefix, + address addr + ) external view returns (string memory bech32); + + /// @dev returns the balance of the gas stability pool + /// @param chainID to query gas. + /// @return result of the call. + function getGasStabilityPoolBalance( + int64 chainID + ) external view returns (uint256 result); +} diff --git a/precompiles/prototype/bindings.go b/precompiles/prototype/bindings.go new file mode 100644 index 0000000000..e4a31a5e56 --- /dev/null +++ b/precompiles/prototype/bindings.go @@ -0,0 +1,7 @@ +//go:generate sh -c "solc IPrototype.sol --combined-json abi | jq '.contracts.\"IPrototype.sol:IPrototype\"' > IPrototype.json" +//go:generate sh -c "cat IPrototype.json | jq .abi > IPrototype.abi" +//go:generate sh -c "abigen --abi IPrototype.abi --pkg prototype --type IPrototype --out IPrototype.go" + +package prototype + +var _ Contract diff --git a/precompiles/prototype/prototype.go b/precompiles/prototype/prototype.go new file mode 100644 index 0000000000..930095f32f --- /dev/null +++ b/precompiles/prototype/prototype.go @@ -0,0 +1,258 @@ +package prototype + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + + ptypes "github.com/zeta-chain/zetacore/precompiles/types" + fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" +) + +const ( + Bech32ToHexAddrMethodName = "bech32ToHexAddr" + Bech32ifyMethodName = "bech32ify" + GetGasStabilityPoolBalanceName = "getGasStabilityPoolBalance" +) + +var ( + ABI abi.ABI + ContractAddress = common.HexToAddress("0x0000000000000000000000000000000000000065") + GasRequiredByMethod = map[[4]byte]uint64{} +) + +func init() { + initABI() +} + +func initABI() { + if err := ABI.UnmarshalJSON([]byte(IPrototypeMetaData.ABI)); err != nil { + panic(err) + } + + GasRequiredByMethod = map[[4]byte]uint64{} + for methodName := range ABI.Methods { + var methodID [4]byte + copy(methodID[:], ABI.Methods[methodName].ID[:4]) + switch methodName { + case Bech32ToHexAddrMethodName: + GasRequiredByMethod[methodID] = 10000 + case Bech32ifyMethodName: + GasRequiredByMethod[methodID] = 10000 + case GetGasStabilityPoolBalanceName: + GasRequiredByMethod[methodID] = 10000 + default: + GasRequiredByMethod[methodID] = 0 + } + } +} + +type Contract struct { + ptypes.BaseContract + + fungibleKeeper fungiblekeeper.Keeper + cdc codec.Codec + kvGasConfig storetypes.GasConfig +} + +func NewIPrototypeContract( + fungibleKeeper *fungiblekeeper.Keeper, + cdc codec.Codec, + kvGasConfig storetypes.GasConfig, +) *Contract { + return &Contract{ + BaseContract: ptypes.NewBaseContract(ContractAddress), + fungibleKeeper: *fungibleKeeper, + cdc: cdc, + kvGasConfig: kvGasConfig, + } +} + +// Address() is required to implement the PrecompiledContract interface. +func (c *Contract) Address() common.Address { + return ContractAddress +} + +// Abi() is required to implement the PrecompiledContract interface. +func (c *Contract) Abi() abi.ABI { + return ABI +} + +// RequiredGas is required to implement the PrecompiledContract interface. +// The gas has to be calculated deterministically based on the input. +func (c *Contract) RequiredGas(input []byte) uint64 { + // base cost to prevent large input size + baseCost := uint64(len(input)) * c.kvGasConfig.WriteCostPerByte + + // get methodID (first 4 bytes) + var methodID [4]byte + copy(methodID[:], input[:4]) + + if requiredGas, ok := GasRequiredByMethod[methodID]; ok { + return requiredGas + baseCost + } + + // Can not happen, but return 0 if the method is not found. + return 0 +} + +// Bech32ToHexAddr converts a bech32 address to a hex address. +func (c *Contract) Bech32ToHexAddr(method *abi.Method, args []interface{}) ([]byte, error) { + if len(args) != 1 { + return nil, &ptypes.ErrInvalidNumberOfArgs{ + Got: len(args), + Expect: 1, + } + } + + bech32String, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("invalid argument, wanted a string, got: %T", args[0]) + } + + bech32String = strings.TrimSpace(bech32String) + if bech32String == "" { + return nil, fmt.Errorf("invalid bech32 address: %s", bech32String) + } + + // 1 is always the separator between the bech32 prefix and the bech32 data part. + // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 + bech32Prefix, bech32Data, found := strings.Cut(bech32String, "1") + if !found || bech32Data == "" || bech32Prefix == "" || bech32Prefix == bech32String { + return nil, fmt.Errorf("invalid bech32 address: %s", bech32String) + } + + addressBz, err := sdk.GetFromBech32(bech32String, bech32Prefix) + if err != nil { + return nil, err + } + + if err := sdk.VerifyAddressFormat(addressBz); err != nil { + return nil, err + } + + return method.Outputs.Pack(common.BytesToAddress(addressBz)) +} + +// Bech32ify converts a hex address to a bech32 address. +func (c *Contract) Bech32ify(method *abi.Method, args []interface{}) ([]byte, error) { + if len(args) != 2 { + return nil, &ptypes.ErrInvalidNumberOfArgs{ + Got: len(args), + Expect: 2, + } + } + + cfg := sdk.GetConfig() + prefix, ok := args[0].(string) + if !ok { + return nil, fmt.Errorf("invalid bech32 human readable prefix (HRP): %v", args[0]) + } + + if strings.TrimSpace(prefix) == "" { + return nil, fmt.Errorf( + "invalid bech32 human readable prefix (HRP). Please provide a either an account, validator or consensus address prefix (eg: %s, %s, %s)", + cfg.GetBech32AccountAddrPrefix(), + cfg.GetBech32ValidatorAddrPrefix(), + cfg.GetBech32ConsensusAddrPrefix(), + ) + } + + address, ok := args[1].(common.Address) + if !ok { + return nil, fmt.Errorf("invalid hex address") + } + + // NOTE: safety check, should not happen given that the address is 20 bytes. + if err := sdk.VerifyAddressFormat(address.Bytes()); err != nil { + return nil, err + } + + bech32Str, err := sdk.Bech32ifyAddressBytes(prefix, address.Bytes()) + if err != nil { + return nil, err + } + + addressBz, err := sdk.GetFromBech32(bech32Str, prefix) + if err != nil { + return nil, err + } + + if err := sdk.VerifyAddressFormat(addressBz); err != nil { + return nil, err + } + + return method.Outputs.Pack(bech32Str) +} + +func (c *Contract) GetGasStabilityPoolBalance( + ctx sdk.Context, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + if len(args) != 1 { + return nil, &(ptypes.ErrInvalidNumberOfArgs{ + Got: len(args), + Expect: 1, + }) + } + + // Unwrap arguments. The chainID is the first and unique argument. + chainID, ok := args[0].(int64) + if !ok { + return nil, ptypes.ErrInvalidArgument{ + Got: chainID, + } + } + + balance, err := c.fungibleKeeper.GetGasStabilityPoolBalance(ctx, chainID) + if err != nil { + return nil, fmt.Errorf("error calling fungible keeper: %s", err.Error()) + } + + return method.Outputs.Pack(balance) +} + +// Run is the entrypoint of the precompiled contract, it switches over the input method, +// and execute them accordingly. +func (c *Contract) Run(evm *vm.EVM, contract *vm.Contract, _ bool) ([]byte, error) { + method, err := ABI.MethodById(contract.Input[:4]) + if err != nil { + return nil, err + } + + args, err := method.Inputs.Unpack(contract.Input[4:]) + if err != nil { + return nil, err + } + + stateDB := evm.StateDB.(ptypes.ExtStateDB) + + switch method.Name { + case GetGasStabilityPoolBalanceName: + var res []byte + execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error { + res, err = c.GetGasStabilityPoolBalance(ctx, method, args) + return err + }) + if execErr != nil { + return nil, err + } + return res, nil + + case Bech32ToHexAddrMethodName: + return c.Bech32ToHexAddr(method, args) + case Bech32ifyMethodName: + return c.Bech32ify(method, args) + default: + return nil, ptypes.ErrInvalidMethod{ + Method: method.Name, + } + } +} diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go new file mode 100644 index 0000000000..3c0d88b642 --- /dev/null +++ b/precompiles/prototype/prototype_test.go @@ -0,0 +1,339 @@ +package prototype + +import ( + "encoding/json" + "testing" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + ethermint "github.com/zeta-chain/ethermint/types" + "github.com/zeta-chain/zetacore/precompiles/types" + "github.com/zeta-chain/zetacore/testutil/keeper" +) + +func Test_IPrototypeContract(t *testing.T) { + /* + Configuration + */ + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + k, _, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + /* + Contract and ABI tests + */ + + // Create a new IPrototypeContract instance and get Address and Abi. + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + address := contract.Address() + require.Equal(t, ContractAddress, address, "contract address should match the precompiled address") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + + // Check all methods are present in the ABI. + bech32ToHex := abi.Methods[Bech32ToHexAddrMethodName] + require.NotNil(t, bech32ToHex, "bech32ToHexAddr method should be present in the ABI") + + bech32ify := abi.Methods[Bech32ifyMethodName] + require.NotNil(t, bech32ify, "bech32ify method should be present in the ABI") + + getGasStabilityPoolBalance := abi.Methods[GetGasStabilityPoolBalanceName] + require.NotNil(t, getGasStabilityPoolBalance, "getGasStabilityPoolBalance method should be present in the ABI") + + /* + Gas tests + */ + + // Check all methods use the correct gas amount. + var method [4]byte + + gasBech32ToHex := contract.RequiredGas(bech32ToHex.ID) + copy(method[:], bech32ToHex.ID[:4]) + baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasBech32ToHex, + "bech32ToHexAddr method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasBech32ToHex) + + gasBech32ify := contract.RequiredGas(bech32ify.ID) + copy(method[:], bech32ify.ID[:4]) + baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasBech32ify, + "bech32ify method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasBech32ify) + + gasGetGasStabilityPoolBalance := contract.RequiredGas(getGasStabilityPoolBalance.ID) + copy(method[:], getGasStabilityPoolBalance.ID[:4]) + baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasGetGasStabilityPoolBalance, + "getGasStabilityPoolBalance method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasGetGasStabilityPoolBalance) + + // Can not happen, but check the gas for an invalid method. + // At runtime if the method does not exist in the ABI, it returns an error. + invalidMethodBytes := []byte("invalidMethod") + gasInvalidMethod := contract.RequiredGas(invalidMethodBytes) + baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal( + t, + uint64(0), + gasInvalidMethod, + "invalid method should require %d gas, got %d", + uint64(0), + gasInvalidMethod) +} + +func Test_Bech32ToHexAddress(t *testing.T) { + /* + Configuration + */ + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + k, _, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + // Create contract and get ABI. + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + + // Test Bech32HexAddr method. Should succeed. + methodID := abi.Methods[Bech32ToHexAddrMethodName] + args := make([]interface{}, 0) + args = append(args, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u") + + rawBytes, err := contract.Bech32ToHexAddr(&methodID, args) + require.NoError(t, err, "Bech32ToHexAddr should not return an error") + + // Discard the first 12 bytes, the address is the last 20 bytes. + addr := common.BytesToAddress(rawBytes[12:]) + require.Equal( + t, + common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), + addr, + "Bech32ToHexAddr should return the correct address, got: %v", + addr, + ) + + // Test Bech32HexAddr method. Should fail with invalid argument type.. + args[0] = 1 + rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected invalid argument; wanted string; got: %T", args[0]) + + // Test Bech32HexAddr method. Should fail because it's not a valid bech32 address. + args[0] = "foobar" + rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; invalid bech32 address") + + // Test Bech32HexAddr method. Should fail with invalid prefix. + args[0] = "foobar1" + rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; invalid bech32 addresss") + + // Test Bech32HexAddr method. Should fail with invalid prefix. + args[0] = "foobar1foobar" + rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; decoding bech32 failed") + + // Test Bech32HexAddr method. Should fail with invalid number of arguments. + args = append(args, "second argument") + _, err = contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 1; got: 2") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + + // Test Bech32HexAddr method. Should fail with invalid address. + argsInvalid := make([]interface{}, 0) + argsInvalid = append(argsInvalid, "") + _, errInvalid := contract.Bech32ToHexAddr(&methodID, argsInvalid) + require.Error(t, errInvalid, "expected error invalid bech32 address: %v", argsInvalid[0]) +} + +func Test_Bech32ify(t *testing.T) { + /* + Configuration + */ + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + k, _, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + // Create contract and get ABI. + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + + // Test Bech32ify method with a zeta HRP. + methodID := abi.Methods[Bech32ifyMethodName] + args := make([]interface{}, 0) + args = append(args, "zeta") + args = append(args, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")) + + rawBytes, err := contract.Bech32ify(&methodID, args) + require.NoError(t, err, "Bech32ify prefix zeta should not return an error") + + // Manually extract the address from the raw bytes. + zetaAddr := string(rawBytes[64:107]) + require.Equal( + t, + "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", + string(zetaAddr), + "Bech32ify prefix zeta should return the correct address, got: %v", + zetaAddr, + ) + + // Test Bech32ify method with a cosmos HRP. + args[0] = "cosmos" + rawBytes, err = contract.Bech32ify(&methodID, args) + require.NoError(t, err, "Bech32ify prefix cosmos should not return an error") + + zetaAddr = string(rawBytes[64:107]) + require.Equal( + t, + "cosmos1h8duy2dltz9xz0qqhm5wvcnj02upy887lqaq", + string(zetaAddr), + "Bech32ify prefix cosmos should return the correct address, got: %v", + zetaAddr, + ) + + // Test for invalid number of arguments. + args = append(args, "third argument") + _, err = contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + + // Test for invalid bech32 human readable prefix. + argsInvalidBech32 := make([]interface{}, 0) + argsInvalidBech32 = append(argsInvalidBech32, 1337) + argsInvalidBech32 = append(argsInvalidBech32, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")) + _, errInvalidBech32 := contract.Bech32ify(&methodID, argsInvalidBech32) + require.Error(t, errInvalidBech32, "expected error invalid bech32 human readable prefix (HRP)") + + // Test for invalid hex address. + argsInvalidHexAddress := make([]interface{}, 0) + argsInvalidHexAddress = append(argsInvalidHexAddress, "zeta") + argsInvalidHexAddress = append(argsInvalidHexAddress, 1337) + _, errInvalidHexAddress := contract.Bech32ify(&methodID, argsInvalidHexAddress) + require.Error(t, errInvalidHexAddress, "expected error invalid hex address") + + // Test for invalid bech32 human readable prefix. + argsInvalidEmptyPrefix := make([]interface{}, 0) + argsInvalidEmptyPrefix = append(argsInvalidEmptyPrefix, "") + argsInvalidEmptyPrefix = append( + argsInvalidEmptyPrefix, + common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), + ) + _, errInvalidEmptyPrefix := contract.Bech32ify(&methodID, argsInvalidEmptyPrefix) + require.Error( + t, + errInvalidEmptyPrefix, + "expected error invalid bech32 human readable prefix (HRP). Please provide a either an account, validator or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", + ) +} + +func Test_GetGasStabilityPoolBalance(t *testing.T) { + /* + Configuration + */ + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + k, ctx, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + // Create contract and get ABI. + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + + // Test GetGasStabilityPoolBalance method. + // Only check the function is called correctly inside the contract, and it returns the expected error. + // Configuring a local environment for this contract would require deploying system contracts and gas pools. + // This method is tested thoroughly in the e2e tests. + methodID := abi.Methods[GetGasStabilityPoolBalanceName] + args := make([]interface{}, 0) + args = append(args, int64(1337)) + + _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) + require.Error( + t, + err, + "error calling fungible keeper: failed to get system contract variable: state variable not found", + ) + + // Test for invalid number of arguments. + args = append(args, "second argument") + _, err = contract.GetGasStabilityPoolBalance(ctx, &methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + + // Test for invalid chainID. + argsInvalid := make([]interface{}, 0) + argsInvalid = append(argsInvalid, "foobar") + _, errInvalid := contract.GetGasStabilityPoolBalance(ctx, &methodID, argsInvalid) + require.Error(t, errInvalid, "expected int64, got: %T", argsInvalid[0]) + require.IsType( + t, + types.ErrInvalidArgument{}, + errInvalid, + "expected error type: ErrInvalidArgument, got: %T", + errInvalid, + ) +} + +func Test_InvalidMethod(t *testing.T) { + /* + Configuration + */ + + var encoding ethermint.EncodingConfig + appCodec := encoding.Codec + k, _, _, _ := keeper.FungibleKeeper(t) + gasConfig := storetypes.TransientGasConfig() + + // Create contract and get ABI. + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + + // Test for non existent method. + _, doNotExist := abi.Methods["invalidMethod"] + require.False(t, doNotExist, "invalidMethod should not be present in the ABI") +} + +func Test_InvalidABI(t *testing.T) { + IPrototypeMetaData.ABI = "invalid json" + defer func() { + if r := recover(); r != nil { + require.IsType(t, &json.SyntaxError{}, r, "expected error type: json.SyntaxError, got: %T", r) + } + }() + + initABI() +} diff --git a/precompiles/types/errors.go b/precompiles/types/errors.go new file mode 100644 index 0000000000..0cc6928541 --- /dev/null +++ b/precompiles/types/errors.go @@ -0,0 +1,44 @@ +package types + +import "fmt" + +/* +Address related errors +*/ +type ErrInvalidAddr struct { + Got string +} + +func (e ErrInvalidAddr) Error() string { + return fmt.Sprintf("invalid address %s", e.Got) +} + +/* +Argument related errors +*/ +type ErrInvalidNumberOfArgs struct { + Got, Expect int +} + +func (e ErrInvalidNumberOfArgs) Error() string { + return fmt.Sprintf("invalid number of arguments; expected %d; got: %d", e.Expect, e.Got) +} + +type ErrInvalidArgument struct { + Got any +} + +func (e ErrInvalidArgument) Error() string { + return fmt.Sprintf("invalid argument: %s", e.Got.(string)) +} + +/* +Method related errors +*/ +type ErrInvalidMethod struct { + Method string +} + +func (e ErrInvalidMethod) Error() string { + return fmt.Sprintf("invalid method: %s", e.Method) +} diff --git a/precompiles/types/errors_test.go b/precompiles/types/errors_test.go new file mode 100644 index 0000000000..5693a450eb --- /dev/null +++ b/precompiles/types/errors_test.go @@ -0,0 +1,48 @@ +package types + +import "testing" + +func Test_ErrInvalidAddr(t *testing.T) { + e := ErrInvalidAddr{ + Got: "foo", + } + got := e.Error() + expect := "invalid address foo" + if got != expect { + t.Errorf("Expected %v, got %v", expect, got) + } +} + +func Test_ErrInvalidNumberOfArgs(t *testing.T) { + e := ErrInvalidNumberOfArgs{ + Got: 1, + Expect: 2, + } + got := e.Error() + expect := "invalid number of arguments; expected 2; got: 1" + if got != expect { + t.Errorf("Expected %v, got %v", expect, got) + } +} + +func Test_ErrInvalidArgument(t *testing.T) { + e := ErrInvalidArgument{ + Got: "foo", + } + got := e.Error() + expect := "invalid argument: foo" + if got != expect { + t.Errorf("Expected %v, got %v", expect, got) + } +} + +func Test_ErrInvalidMethod(t *testing.T) { + e := ErrInvalidMethod{ + Method: "foo", + } + got := e.Error() + expect := "invalid method: foo" + if got != expect { + t.Errorf("Expected %v, got %v", expect, got) + } +} diff --git a/precompiles/types/types.go b/precompiles/types/types.go new file mode 100644 index 0000000000..7bd4a57bfa --- /dev/null +++ b/precompiles/types/types.go @@ -0,0 +1,54 @@ +package types + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/zeta-chain/ethermint/x/evm/statedb" +) + +// Interface compliance. +var _ ExtStateDB = (*statedb.StateDB)(nil) +var _ Registrable = (*baseContract)(nil) +var _ BaseContract = (*baseContract)(nil) + +// ExtStateDB defines extra methods of statedb to support stateful precompiled contracts. +// It's used to persist changes into the store. +type ExtStateDB interface { + vm.StateDB + ExecuteNativeAction( + contract common.Address, + converter statedb.EventConverter, + action func(ctx sdk.Context) error, + ) error + CacheContext() sdk.Context +} + +type Registrable interface { + RegistryKey() common.Address +} + +type BaseContract interface { + Registrable +} + +// A baseContract implements Registrable and BaseContract interfaces. +type baseContract struct { + address common.Address +} + +func NewBaseContract(address common.Address) BaseContract { + return &baseContract{ + address: address, + } +} + +func (c *baseContract) RegistryKey() common.Address { + return c.address +} + +func BytesToBigInt(data []byte) *big.Int { + return big.NewInt(0).SetBytes(data[:]) +} diff --git a/precompiles/types/types_test.go b/precompiles/types/types_test.go new file mode 100644 index 0000000000..1193b55426 --- /dev/null +++ b/precompiles/types/types_test.go @@ -0,0 +1,26 @@ +package types + +import ( + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" +) + +func Test_BaseContract(t *testing.T) { + addr := common.BytesToAddress([]byte{0x1}) + + contract := NewBaseContract(addr) + require.NotNil(t, contract) + + // By implementing RegistryKey() the baseContract struct implements Registrable. + // Registrable is the unique requisite to implement BaseContract as well. + require.Equal(t, addr, contract.RegistryKey()) +} + +func Test_BytesToBigInt(t *testing.T) { + data := []byte{0x1} + intData := BytesToBigInt(data) + require.NotNil(t, intData) + require.Equal(t, int64(1), intData.Int64()) +} diff --git a/scripts/bindings-stateful-precompiles.sh b/scripts/bindings-stateful-precompiles.sh new file mode 100755 index 0000000000..cd649ed24c --- /dev/null +++ b/scripts/bindings-stateful-precompiles.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Generic function to generate bindings +function bindings() { + cd $1 + go generate > /dev/null 2>&1 + echo "Generated bindings for $1" +} + +# List of bindings to generate +bindings ./precompiles/prototype + From 42110e0b4c3e490f6e5170771f607db79b8164e8 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 21 Aug 2024 14:36:53 +0200 Subject: [PATCH 09/26] formatting --- x/crosschain/keeper/evm_hooks.go | 1 - x/fungible/keeper/deposits.go | 1 - x/fungible/keeper/evm.go | 2 -- 3 files changed, 4 deletions(-) diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go index a4564c5d03..03333e4f1e 100644 --- a/x/crosschain/keeper/evm_hooks.go +++ b/x/crosschain/keeper/evm_hooks.go @@ -13,7 +13,6 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/pkg/errors" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" connectorzevm "github.com/zeta-chain/protocol-contracts/v1/pkg/contracts/zevm/zetaconnectorzevm.sol" diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go index c289cca897..4a05d1dcd3 100644 --- a/x/fungible/keeper/deposits.go +++ b/x/fungible/keeper/deposits.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" - evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/v1/pkg/contracts/zevm/systemcontract.sol" diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index a63d4ed617..07354b6bff 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -19,9 +19,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - evmtypes "github.com/zeta-chain/ethermint/x/evm/types" - "github.com/zeta-chain/protocol-contracts/v1/pkg/contracts/zevm/systemcontract.sol" "github.com/zeta-chain/protocol-contracts/v1/pkg/contracts/zevm/wzeta.sol" zevmconnectorcontract "github.com/zeta-chain/protocol-contracts/v1/pkg/contracts/zevm/zetaconnectorzevm.sol" From 0488badede4ba6a6d1ea83fe8756f8449b29858b Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 21 Aug 2024 14:43:28 +0200 Subject: [PATCH 10/26] new generated mocks --- testutil/keeper/mocks/crosschain/fungible.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 0988e905b7..f7445a0785 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -8,11 +8,9 @@ import ( common "github.com/ethereum/go-ethereum/common" coin "github.com/zeta-chain/zetacore/pkg/coin" - - evmtypes "github.com/zeta-chain/ethermint/x/evm/types" - crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + evmtypes "github.com/zeta-chain/ethermint/x/evm/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" From e531669a9b029d9a6f09f0394a90fbb1614136d2 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 21 Aug 2024 22:40:36 +0200 Subject: [PATCH 11/26] skip precompile tests during upgrade --- cmd/zetae2e/local/local.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 356a899a9a..af249b9f03 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -303,6 +303,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { zevmMPTests = append(zevmMPTests, zevmMPAdvancedTests...) bitcoinTests = append(bitcoinTests, bitcoinAdvancedTests...) ethereumTests = append(ethereumTests, ethereumAdvancedTests...) + precompiledContractTests = make([]string, 0) } eg.Go(statefulPrecompilesTestRoutine(conf, deployerRunner, verbose, precompiledContractTests...)) From e8af6b8c383dc35cea8ca0be59c3c3831d9aaf55 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Fri, 23 Aug 2024 19:27:31 +0200 Subject: [PATCH 12/26] skip precompile --- cmd/zetae2e/local/local.go | 14 ++++++++++---- contrib/localnet/orchestrator/start-zetae2e.sh | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index af249b9f03..7a5e453e73 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -43,6 +43,7 @@ const ( flagSkipHeaderProof = "skip-header-proof" flagTestV2 = "test-v2" flagSkipTrackerCheck = "skip-tracker-check" + flagSkipPrecompiles = "skip-precompiles" ) var ( @@ -77,6 +78,7 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagTestTSSMigration, false, "set to true to include a migration test at the end") cmd.Flags().Bool(flagTestV2, false, "set to true to run tests for v2 contracts") cmd.Flags().Bool(flagSkipTrackerCheck, false, "set to true to skip tracker check at the end of the tests") + cmd.Flags().Bool(flagSkipPrecompiles, false, "set to true to skip stateful precompiled contracts test") return cmd } @@ -101,6 +103,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck)) testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration)) testV2 = must(cmd.Flags().GetBool(flagTestV2)) + skipPrecompiles = must(cmd.Flags().GetBool(flagSkipPrecompiles)) ) logger := runner.NewLogger(verbose, color.FgWhite, "setup") @@ -247,9 +250,6 @@ func localE2ETest(cmd *cobra.Command, _ []string) { erc20AdvancedTests := []string{ e2etests.TestERC20DepositRestrictedName, } - precompiledContractTests := []string{ - e2etests.TestZetaPrecompilesPrototypeName, - } zetaTests := []string{ e2etests.TestZetaWithdrawName, e2etests.TestMessagePassingExternalChainsName, @@ -296,6 +296,13 @@ func localE2ETest(cmd *cobra.Command, _ []string) { ethereumAdvancedTests := []string{ e2etests.TestEtherWithdrawRestrictedName, } + precompiledContractTests := []string{} + + if !skipPrecompiles { + precompiledContractTests = []string{ + e2etests.TestZetaPrecompilesPrototypeName, + } + } if !light { erc20Tests = append(erc20Tests, erc20AdvancedTests...) @@ -303,7 +310,6 @@ func localE2ETest(cmd *cobra.Command, _ []string) { zevmMPTests = append(zevmMPTests, zevmMPAdvancedTests...) bitcoinTests = append(bitcoinTests, bitcoinAdvancedTests...) ethereumTests = append(ethereumTests, ethereumAdvancedTests...) - precompiledContractTests = make([]string, 0) } eg.Go(statefulPrecompilesTestRoutine(conf, deployerRunner, verbose, precompiledContractTests...)) diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 4ee8192c6d..c7cb1ca574 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -131,7 +131,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then echo "running E2E command to setup the networks and populate the state..." # Use light flag to ensure tests can complete before the upgrade height - zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light --skip-precompiles ${COMMON_ARGS} if [ $? -ne 0 ]; then echo "first e2e failed" exit 1 @@ -170,9 +170,9 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then # When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up # Use light flag to skip advanced tests if [ "$UPGRADE_HEIGHT" -lt 100 ]; then - zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-precompiles ${COMMON_ARGS} else - zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-precompiles ${COMMON_ARGS} fi ZETAE2E_EXIT_CODE=$? From 48035a42495d670471cd913099667ae347d5903c Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 26 Aug 2024 22:25:15 +0200 Subject: [PATCH 13/26] try to fix generate --- scripts/bindings-stateful-precompiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bindings-stateful-precompiles.sh b/scripts/bindings-stateful-precompiles.sh index cd649ed24c..c3e8423eda 100755 --- a/scripts/bindings-stateful-precompiles.sh +++ b/scripts/bindings-stateful-precompiles.sh @@ -8,5 +8,5 @@ function bindings() { } # List of bindings to generate -bindings ./precompiles/prototype +bindings $(pwd)/precompiles/prototype From 16f2b0f3eb6c1d83ec167a8b2f0c189b131f8cb0 Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 26 Aug 2024 22:49:03 +0200 Subject: [PATCH 14/26] debug script --- .github/workflows/generate-files.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index a5f9f6d4e1..90b6423127 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -18,6 +18,24 @@ jobs: run: | echo "$HOME/go/bin" >> $GITHUB_PATH + - name: Print solc version + run: | + solc --version + + - name: Run solc and capture output + run: | + solc IPrototype.sol --combined-json abi 2>&1 | tee solc_output.log + cat solc_output.log + + - name: Extract ABI from JSON + run: | + cat IPrototype.json | jq .abi > IPrototype.abi + + - name: Run abigen and capture errors + run: | + abigen --abi ./precompiles/prototype/IPrototype.abi --pkg prototype --type IPrototype --out ./precompiles/prototype/IPrototype.go 2>&1 | tee abigen_output.log + cat abigen_output.log + - name: Generate Go code, docs and specs env: TEST_ENV: ${{ github.workspace }} From de59aa8295d40a2b4073be980a7f7be4c6a37a7e Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 26 Aug 2024 23:04:28 +0200 Subject: [PATCH 15/26] install solc in generate files --- .github/workflows/generate-files.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index 90b6423127..cbefdf0340 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -18,23 +18,23 @@ jobs: run: | echo "$HOME/go/bin" >> $GITHUB_PATH - - name: Print solc version + - name: Install solc run: | - solc --version + sudo add-apt-repository ppa:ethereum/ethereum + sudo apt-get update + sudo apt-get install solc - - name: Run solc and capture output + - name: Print solc version run: | - solc IPrototype.sol --combined-json abi 2>&1 | tee solc_output.log - cat solc_output.log + solc --version - - name: Extract ABI from JSON + - name: Print abigen version run: | - cat IPrototype.json | jq .abi > IPrototype.abi + abigen --version - - name: Run abigen and capture errors + - name: Print jq version run: | - abigen --abi ./precompiles/prototype/IPrototype.abi --pkg prototype --type IPrototype --out ./precompiles/prototype/IPrototype.go 2>&1 | tee abigen_output.log - cat abigen_output.log + jq --version - name: Generate Go code, docs and specs env: From a8566a04636b7a489623ee06382c7422ae8aa953 Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 26 Aug 2024 23:06:28 +0200 Subject: [PATCH 16/26] install abigen --- .github/workflows/generate-files.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index cbefdf0340..b3ac5e10a2 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -23,6 +23,7 @@ jobs: sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc + go install github.com/ethereum/go-ethereum/cmd/abigen@latest - name: Print solc version run: | From 9f2d9148820364a041d67d80097cc571c197d90d Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 11:59:51 +0200 Subject: [PATCH 17/26] cleanup action --- .github/workflows/generate-files.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index b3ac5e10a2..df0a625317 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -25,18 +25,6 @@ jobs: sudo apt-get install solc go install github.com/ethereum/go-ethereum/cmd/abigen@latest - - name: Print solc version - run: | - solc --version - - - name: Print abigen version - run: | - abigen --version - - - name: Print jq version - run: | - jq --version - - name: Generate Go code, docs and specs env: TEST_ENV: ${{ github.workspace }} From e83aa7032fe7602680492c6cc182af8f5103d578 Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 12:13:05 +0200 Subject: [PATCH 18/26] PR comments pt1 --- precompiles/precompiles.go | 4 +- readme.md | 2 +- x/observer/client/querytests/suite.go | 59 --------------------------- 3 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 x/observer/client/querytests/suite.go diff --git a/precompiles/precompiles.go b/precompiles/precompiles.go index ad5eb55c50..e3901aa873 100644 --- a/precompiles/precompiles.go +++ b/precompiles/precompiles.go @@ -31,12 +31,12 @@ func StatefulContracts( // Define the regular contract function. if EnabledStatefulContracts[prototype.ContractAddress] { - prototype := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract { + prototypeContract := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract { return prototype.NewIPrototypeContract(fungibleKeeper, cdc, gasConfig) } // Append the regular contract to the precompiledContracts slice. - precompiledContracts = append(precompiledContracts, prototype) + precompiledContracts = append(precompiledContracts, prototypeContract) } return precompiledContracts diff --git a/readme.md b/readme.md index c411a52674..61f04f632f 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ smart contracts and messaging between any blockchain. ZetaChain is built with [Cosmos SDK](https://github.com/cosmos/cosmos-sdk), a modular framework for building blockchain and [Ethermint](https://github.com/zeta-chain/ethermint), a module that implements -EVM-compatibility. +EVM-compatibility (ZetaChain fork). - [zeta-node](https://github.com/zeta-chain/zeta-node) (this repository) contains the source code for the ZetaChain node (`zetacored`) and the diff --git a/x/observer/client/querytests/suite.go b/x/observer/client/querytests/suite.go deleted file mode 100644 index 87cdac1147..0000000000 --- a/x/observer/client/querytests/suite.go +++ /dev/null @@ -1,59 +0,0 @@ -package querytests - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - ethcfg "github.com/zeta-chain/ethermint/cmd/config" - - "github.com/zeta-chain/zetacore/app" - cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/testutil/network" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" -) - -type CliTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network - crosschainState *types.GenesisState - observerState *observerTypes.GenesisState -} - -func NewCLITestSuite(cfg network.Config) *CliTestSuite { - return &CliTestSuite{cfg: cfg} -} - -func (s *CliTestSuite) Setconfig() { - config := sdk.GetConfig() - cmdcfg.SetBech32Prefixes(config) - ethcfg.SetBip44CoinType(config) - // Make sure address is compatible with ethereum - config.SetAddressVerifier(app.VerifyAddressFormat) - config.Seal() -} -func (s *CliTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - s.Setconfig() - minOBsDel, ok := sdk.NewIntFromString("100000000000000000000") - s.Require().True(ok) - s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10))) - s.cfg.BondedTokens = minOBsDel - observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", - } - network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false) - s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec) - s.observerState = network.AddObserverData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec, nil) - net, err := network.New(s.T(), app.NodeDir, s.cfg) - s.Assert().NoError(err) - s.network = net - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *CliTestSuite) TearDownSuite() { - s.T().Log("tearing down genesis test suite") - s.network.Cleanup() -} From 8a91d5fd0c3c5f747b40fd69db99684c83c08d4b Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 12:33:40 +0200 Subject: [PATCH 19/26] group prototype unit tests a bit --- precompiles/prototype/prototype_test.go | 416 ++++++++++-------------- 1 file changed, 172 insertions(+), 244 deletions(-) diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go index 3c0d88b642..32699af02e 100644 --- a/precompiles/prototype/prototype_test.go +++ b/precompiles/prototype/prototype_test.go @@ -13,316 +13,244 @@ import ( ) func Test_IPrototypeContract(t *testing.T) { - /* - Configuration - */ - var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, _, _, _ := keeper.FungibleKeeper(t) gasConfig := storetypes.TransientGasConfig() - /* - Contract and ABI tests - */ - - // Create a new IPrototypeContract instance and get Address and Abi. - contract := NewIPrototypeContract(k, appCodec, gasConfig) - require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") - - address := contract.Address() - require.Equal(t, ContractAddress, address, "contract address should match the precompiled address") - - abi := contract.Abi() - require.NotNil(t, abi, "contract ABI should not be nil") - - // Check all methods are present in the ABI. - bech32ToHex := abi.Methods[Bech32ToHexAddrMethodName] - require.NotNil(t, bech32ToHex, "bech32ToHexAddr method should be present in the ABI") - - bech32ify := abi.Methods[Bech32ifyMethodName] - require.NotNil(t, bech32ify, "bech32ify method should be present in the ABI") - - getGasStabilityPoolBalance := abi.Methods[GetGasStabilityPoolBalanceName] - require.NotNil(t, getGasStabilityPoolBalance, "getGasStabilityPoolBalance method should be present in the ABI") - - /* - Gas tests - */ - - // Check all methods use the correct gas amount. - var method [4]byte - - gasBech32ToHex := contract.RequiredGas(bech32ToHex.ID) - copy(method[:], bech32ToHex.ID[:4]) - baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal( - t, - GasRequiredByMethod[method]+baseCost, - gasBech32ToHex, - "bech32ToHexAddr method should require %d gas, got %d", - GasRequiredByMethod[method]+baseCost, - gasBech32ToHex) - - gasBech32ify := contract.RequiredGas(bech32ify.ID) - copy(method[:], bech32ify.ID[:4]) - baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal( - t, - GasRequiredByMethod[method]+baseCost, - gasBech32ify, - "bech32ify method should require %d gas, got %d", - GasRequiredByMethod[method]+baseCost, - gasBech32ify) - - gasGetGasStabilityPoolBalance := contract.RequiredGas(getGasStabilityPoolBalance.ID) - copy(method[:], getGasStabilityPoolBalance.ID[:4]) - baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal( - t, - GasRequiredByMethod[method]+baseCost, - gasGetGasStabilityPoolBalance, - "getGasStabilityPoolBalance method should require %d gas, got %d", - GasRequiredByMethod[method]+baseCost, - gasGetGasStabilityPoolBalance) - - // Can not happen, but check the gas for an invalid method. - // At runtime if the method does not exist in the ABI, it returns an error. - invalidMethodBytes := []byte("invalidMethod") - gasInvalidMethod := contract.RequiredGas(invalidMethodBytes) - baseCost = uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal( - t, - uint64(0), - gasInvalidMethod, - "invalid method should require %d gas, got %d", - uint64(0), - gasInvalidMethod) + t.Run("should create contract and check address and ABI", func(t *testing.T) { + contract := NewIPrototypeContract(k, appCodec, gasConfig) + require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") + + address := contract.Address() + require.Equal(t, ContractAddress, address, "contract address should match the precompiled address") + + abi := contract.Abi() + require.NotNil(t, abi, "contract ABI should not be nil") + }) + + t.Run("should check methods are present in ABI", func(t *testing.T) { + contract := NewIPrototypeContract(k, appCodec, gasConfig) + abi := contract.Abi() + + require.NotNil(t, abi.Methods[Bech32ToHexAddrMethodName], "bech32ToHexAddr method should be present in the ABI") + require.NotNil(t, abi.Methods[Bech32ifyMethodName], "bech32ify method should be present in the ABI") + require.NotNil(t, abi.Methods[GetGasStabilityPoolBalanceName], "getGasStabilityPoolBalance method should be present in the ABI") + }) + + t.Run("should check gas requirements for methods", func(t *testing.T) { + contract := NewIPrototypeContract(k, appCodec, gasConfig) + abi := contract.Abi() + var method [4]byte + + t.Run("bech32ToHexAddr", func(t *testing.T) { + gasBech32ToHex := contract.RequiredGas(abi.Methods[Bech32ToHexAddrMethodName].ID) + copy(method[:], abi.Methods[Bech32ToHexAddrMethodName].ID[:4]) + baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal(t, GasRequiredByMethod[method]+baseCost, gasBech32ToHex, "bech32ToHexAddr method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasBech32ToHex) + }) + + t.Run("bech32ify", func(t *testing.T) { + gasBech32ify := contract.RequiredGas(abi.Methods[Bech32ifyMethodName].ID) + copy(method[:], abi.Methods[Bech32ifyMethodName].ID[:4]) + baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal(t, GasRequiredByMethod[method]+baseCost, gasBech32ify, "bech32ify method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasBech32ify) + }) + + t.Run("getGasStabilityPoolBalance", func(t *testing.T) { + gasGetGasStabilityPoolBalance := contract.RequiredGas(abi.Methods[GetGasStabilityPoolBalanceName].ID) + copy(method[:], abi.Methods[GetGasStabilityPoolBalanceName].ID[:4]) + baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte + require.Equal(t, GasRequiredByMethod[method]+baseCost, gasGetGasStabilityPoolBalance, "getGasStabilityPoolBalance method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasGetGasStabilityPoolBalance) + }) + + t.Run("invalid method", func(t *testing.T) { + invalidMethodBytes := []byte("invalidMethod") + gasInvalidMethod := contract.RequiredGas(invalidMethodBytes) + require.Equal(t, uint64(0), gasInvalidMethod, "invalid method should require %d gas, got %d", uint64(0), gasInvalidMethod) + }) + }) } func Test_Bech32ToHexAddress(t *testing.T) { - /* - Configuration - */ - var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, _, _, _ := keeper.FungibleKeeper(t) gasConfig := storetypes.TransientGasConfig() - // Create contract and get ABI. contract := NewIPrototypeContract(k, appCodec, gasConfig) require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") abi := contract.Abi() require.NotNil(t, abi, "contract ABI should not be nil") - // Test Bech32HexAddr method. Should succeed. methodID := abi.Methods[Bech32ToHexAddrMethodName] - args := make([]interface{}, 0) - args = append(args, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u") - - rawBytes, err := contract.Bech32ToHexAddr(&methodID, args) - require.NoError(t, err, "Bech32ToHexAddr should not return an error") - - // Discard the first 12 bytes, the address is the last 20 bytes. - addr := common.BytesToAddress(rawBytes[12:]) - require.Equal( - t, - common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), - addr, - "Bech32ToHexAddr should return the correct address, got: %v", - addr, - ) - - // Test Bech32HexAddr method. Should fail with invalid argument type.. - args[0] = 1 - rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) - require.Error(t, err, "expected invalid argument; wanted string; got: %T", args[0]) - - // Test Bech32HexAddr method. Should fail because it's not a valid bech32 address. - args[0] = "foobar" - rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) - require.Error(t, err, "expected error; invalid bech32 address") - - // Test Bech32HexAddr method. Should fail with invalid prefix. - args[0] = "foobar1" - rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) - require.Error(t, err, "expected error; invalid bech32 addresss") - - // Test Bech32HexAddr method. Should fail with invalid prefix. - args[0] = "foobar1foobar" - rawBytes, err = contract.Bech32ToHexAddr(&methodID, args) - require.Error(t, err, "expected error; decoding bech32 failed") - - // Test Bech32HexAddr method. Should fail with invalid number of arguments. - args = append(args, "second argument") - _, err = contract.Bech32ToHexAddr(&methodID, args) - require.Error(t, err, "expected invalid number of arguments; expected 1; got: 2") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) - - // Test Bech32HexAddr method. Should fail with invalid address. - argsInvalid := make([]interface{}, 0) - argsInvalid = append(argsInvalid, "") - _, errInvalid := contract.Bech32ToHexAddr(&methodID, argsInvalid) - require.Error(t, errInvalid, "expected error invalid bech32 address: %v", argsInvalid[0]) + + t.Run("should succeed with valid bech32 address", func(t *testing.T) { + args := []interface{}{"zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u"} + + rawBytes, err := contract.Bech32ToHexAddr(&methodID, args) + require.NoError(t, err, "Bech32ToHexAddr should not return an error") + + addr := common.BytesToAddress(rawBytes[12:]) + require.Equal(t, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), addr, "Bech32ToHexAddr should return the correct address, got: %v", addr) + }) + + t.Run("should fail if invalid argument type", func(t *testing.T) { + args := []interface{}{1} + + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected invalid argument; wanted string; got: %T", args[0]) + }) + + t.Run("should fail if invalid bech32 address", func(t *testing.T) { + t.Run("invalid bech32 format", func(t *testing.T) { + args := []interface{}{"foobar"} + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; invalid bech32 address") + }) + + t.Run("invalid bech32 prefix", func(t *testing.T) { + args := []interface{}{"foobar1"} + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; invalid bech32 addresss") + }) + + t.Run("invalid bech32 decoding", func(t *testing.T) { + args := []interface{}{"foobar1foobar"} + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error; decoding bech32 failed") + }) + + t.Run("invalid number of arguments", func(t *testing.T) { + args := []interface{}{"zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", "second argument"} + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 1; got: 2") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + }) + }) + + t.Run("should fail if empty address argument", func(t *testing.T) { + args := []interface{}{""} + _, err := contract.Bech32ToHexAddr(&methodID, args) + require.Error(t, err, "expected error invalid bech32 address: %v", args[0]) + }) } func Test_Bech32ify(t *testing.T) { - /* - Configuration - */ - var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, _, _, _ := keeper.FungibleKeeper(t) gasConfig := storetypes.TransientGasConfig() - // Create contract and get ABI. contract := NewIPrototypeContract(k, appCodec, gasConfig) require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") abi := contract.Abi() require.NotNil(t, abi, "contract ABI should not be nil") - // Test Bech32ify method with a zeta HRP. methodID := abi.Methods[Bech32ifyMethodName] - args := make([]interface{}, 0) - args = append(args, "zeta") - args = append(args, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")) - - rawBytes, err := contract.Bech32ify(&methodID, args) - require.NoError(t, err, "Bech32ify prefix zeta should not return an error") - - // Manually extract the address from the raw bytes. - zetaAddr := string(rawBytes[64:107]) - require.Equal( - t, - "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", - string(zetaAddr), - "Bech32ify prefix zeta should return the correct address, got: %v", - zetaAddr, - ) - - // Test Bech32ify method with a cosmos HRP. - args[0] = "cosmos" - rawBytes, err = contract.Bech32ify(&methodID, args) - require.NoError(t, err, "Bech32ify prefix cosmos should not return an error") - - zetaAddr = string(rawBytes[64:107]) - require.Equal( - t, - "cosmos1h8duy2dltz9xz0qqhm5wvcnj02upy887lqaq", - string(zetaAddr), - "Bech32ify prefix cosmos should return the correct address, got: %v", - zetaAddr, - ) - - // Test for invalid number of arguments. - args = append(args, "third argument") - _, err = contract.Bech32ify(&methodID, args) - require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) - - // Test for invalid bech32 human readable prefix. - argsInvalidBech32 := make([]interface{}, 0) - argsInvalidBech32 = append(argsInvalidBech32, 1337) - argsInvalidBech32 = append(argsInvalidBech32, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")) - _, errInvalidBech32 := contract.Bech32ify(&methodID, argsInvalidBech32) - require.Error(t, errInvalidBech32, "expected error invalid bech32 human readable prefix (HRP)") - - // Test for invalid hex address. - argsInvalidHexAddress := make([]interface{}, 0) - argsInvalidHexAddress = append(argsInvalidHexAddress, "zeta") - argsInvalidHexAddress = append(argsInvalidHexAddress, 1337) - _, errInvalidHexAddress := contract.Bech32ify(&methodID, argsInvalidHexAddress) - require.Error(t, errInvalidHexAddress, "expected error invalid hex address") - - // Test for invalid bech32 human readable prefix. - argsInvalidEmptyPrefix := make([]interface{}, 0) - argsInvalidEmptyPrefix = append(argsInvalidEmptyPrefix, "") - argsInvalidEmptyPrefix = append( - argsInvalidEmptyPrefix, - common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), - ) - _, errInvalidEmptyPrefix := contract.Bech32ify(&methodID, argsInvalidEmptyPrefix) - require.Error( - t, - errInvalidEmptyPrefix, - "expected error invalid bech32 human readable prefix (HRP). Please provide a either an account, validator or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", - ) + + t.Run("should succeed with zeta HRP", func(t *testing.T) { + args := []interface{}{"zeta", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} + + rawBytes, err := contract.Bech32ify(&methodID, args) + require.NoError(t, err, "Bech32ify prefix zeta should not return an error") + + zetaAddr := string(rawBytes[64:107]) + require.Equal(t, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", zetaAddr, "Bech32ify prefix zeta should return the correct address, got: %v", zetaAddr) + }) + + t.Run("should succeed with cosmos HRP", func(t *testing.T) { + args := []interface{}{"cosmos", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} + + rawBytes, err := contract.Bech32ify(&methodID, args) + require.NoError(t, err, "Bech32ify prefix cosmos should not return an error") + + zetaAddr := string(rawBytes[64:107]) + require.Equal(t, "cosmos1h8duy2dltz9xz0qqhm5wvcnj02upy887lqaq", zetaAddr, "Bech32ify prefix cosmos should return the correct address, got: %v", zetaAddr) + }) + + t.Run("should fail with invalid arguments", func(t *testing.T) { + t.Run("too many arguments", func(t *testing.T) { + args := []interface{}{"zeta", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), "third argument"} + _, err := contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + }) + + t.Run("invalid HRP", func(t *testing.T) { + args := []interface{}{1337, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} + _, err := contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP)") + }) + + t.Run("invalid hex address", func(t *testing.T) { + args := []interface{}{"zeta", 1337} + _, err := contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected error invalid hex address") + }) + + t.Run("empty HRP", func(t *testing.T) { + args := []interface{}{"", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} + _, err := contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)") + }) + }) } func Test_GetGasStabilityPoolBalance(t *testing.T) { - /* - Configuration - */ - + // Only check the function is called correctly inside the contract, and it returns the expected error. + // Configuring a local environment for this contract would require deploying system contracts and gas pools. + // This method is tested thoroughly in the e2e tests. var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, ctx, _, _ := keeper.FungibleKeeper(t) gasConfig := storetypes.TransientGasConfig() - // Create contract and get ABI. contract := NewIPrototypeContract(k, appCodec, gasConfig) require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") abi := contract.Abi() require.NotNil(t, abi, "contract ABI should not be nil") - // Test GetGasStabilityPoolBalance method. - // Only check the function is called correctly inside the contract, and it returns the expected error. - // Configuring a local environment for this contract would require deploying system contracts and gas pools. - // This method is tested thoroughly in the e2e tests. methodID := abi.Methods[GetGasStabilityPoolBalanceName] - args := make([]interface{}, 0) - args = append(args, int64(1337)) + + args := []interface{}{int64(1337)} _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) - require.Error( - t, - err, - "error calling fungible keeper: failed to get system contract variable: state variable not found", - ) - - // Test for invalid number of arguments. - args = append(args, "second argument") - _, err = contract.GetGasStabilityPoolBalance(ctx, &methodID, args) - require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) - - // Test for invalid chainID. - argsInvalid := make([]interface{}, 0) - argsInvalid = append(argsInvalid, "foobar") - _, errInvalid := contract.GetGasStabilityPoolBalance(ctx, &methodID, argsInvalid) - require.Error(t, errInvalid, "expected int64, got: %T", argsInvalid[0]) - require.IsType( - t, - types.ErrInvalidArgument{}, - errInvalid, - "expected error type: ErrInvalidArgument, got: %T", - errInvalid, - ) + require.Error(t, err, "error calling fungible keeper: failed to get system contract variable: state variable not found") + + t.Run("should fail with invalid arguments", func(t *testing.T) { + + t.Run("invalid number of arguments", func(t *testing.T) { + args := []interface{}{int64(1337), "second argument"} + _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) + require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") + require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + }) + + t.Run("invalid chainID", func(t *testing.T) { + args := []interface{}{"foobar"} + _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) + require.Error(t, err, "expected int64, got: %T", args[0]) + require.IsType(t, types.ErrInvalidArgument{}, err, "expected error type: ErrInvalidArgument, got: %T", err) + }) + }) } func Test_InvalidMethod(t *testing.T) { - /* - Configuration - */ - var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, _, _, _ := keeper.FungibleKeeper(t) gasConfig := storetypes.TransientGasConfig() - // Create contract and get ABI. contract := NewIPrototypeContract(k, appCodec, gasConfig) require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") abi := contract.Abi() require.NotNil(t, abi, "contract ABI should not be nil") - // Test for non existent method. _, doNotExist := abi.Methods["invalidMethod"] require.False(t, doNotExist, "invalidMethod should not be present in the ABI") } From ac9f98e490d474251c5bbb666499b89bb701846c Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 12:37:18 +0200 Subject: [PATCH 20/26] PR comment missing test --- precompiles/prototype/prototype_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go index 32699af02e..249cd3b9eb 100644 --- a/precompiles/prototype/prototype_test.go +++ b/precompiles/prototype/prototype_test.go @@ -196,6 +196,12 @@ func Test_Bech32ify(t *testing.T) { _, err := contract.Bech32ify(&methodID, args) require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)") }) + + t.Run("alphanumeric HRP", func(t *testing.T) { + args := []interface{}{"%&", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} + _, err := contract.Bech32ify(&methodID, args) + require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)") + }) }) } From 45370d430a52d37b68ab9872955df4f403b3acb3 Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 13:00:52 +0200 Subject: [PATCH 21/26] cleanup action a bit --- .github/workflows/generate-files.yml | 1 - scripts/bindings-stateful-precompiles.sh | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index df0a625317..da7322e6a1 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -23,7 +23,6 @@ jobs: sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc - go install github.com/ethereum/go-ethereum/cmd/abigen@latest - name: Generate Go code, docs and specs env: diff --git a/scripts/bindings-stateful-precompiles.sh b/scripts/bindings-stateful-precompiles.sh index c3e8423eda..5106652fae 100755 --- a/scripts/bindings-stateful-precompiles.sh +++ b/scripts/bindings-stateful-precompiles.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash +set -eo pipefail + +# Check if abigen is installed +if ! command -v abigen &> /dev/null +then + echo "abigen could not be found, installing..." + go install github.com/ethereum/go-ethereum/cmd/abigen@latest +fi + # Generic function to generate bindings function bindings() { cd $1 @@ -8,5 +17,5 @@ function bindings() { } # List of bindings to generate -bindings $(pwd)/precompiles/prototype +bindings ./precompiles/prototype From c0a1d60d3051d593010e07013f1c9af11e1fe71a Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 13:13:43 +0200 Subject: [PATCH 22/26] add solc checks to script --- .github/workflows/generate-files.yml | 6 +- precompiles/prototype/prototype_test.go | 114 ++++++++++++++++++++--- scripts/bindings-stateful-precompiles.sh | 33 ++++++- 3 files changed, 132 insertions(+), 21 deletions(-) diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index da7322e6a1..1abbbb91ee 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -18,11 +18,9 @@ jobs: run: | echo "$HOME/go/bin" >> $GITHUB_PATH - - name: Install solc + - name: Install solc-select run: | - sudo add-apt-repository ppa:ethereum/ethereum - sudo apt-get update - sudo apt-get install solc + pip3 install solc-select - name: Generate Go code, docs and specs env: diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go index 249cd3b9eb..e117466073 100644 --- a/precompiles/prototype/prototype_test.go +++ b/precompiles/prototype/prototype_test.go @@ -35,7 +35,11 @@ func Test_IPrototypeContract(t *testing.T) { require.NotNil(t, abi.Methods[Bech32ToHexAddrMethodName], "bech32ToHexAddr method should be present in the ABI") require.NotNil(t, abi.Methods[Bech32ifyMethodName], "bech32ify method should be present in the ABI") - require.NotNil(t, abi.Methods[GetGasStabilityPoolBalanceName], "getGasStabilityPoolBalance method should be present in the ABI") + require.NotNil( + t, + abi.Methods[GetGasStabilityPoolBalanceName], + "getGasStabilityPoolBalance method should be present in the ABI", + ) }) t.Run("should check gas requirements for methods", func(t *testing.T) { @@ -47,27 +51,55 @@ func Test_IPrototypeContract(t *testing.T) { gasBech32ToHex := contract.RequiredGas(abi.Methods[Bech32ToHexAddrMethodName].ID) copy(method[:], abi.Methods[Bech32ToHexAddrMethodName].ID[:4]) baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal(t, GasRequiredByMethod[method]+baseCost, gasBech32ToHex, "bech32ToHexAddr method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasBech32ToHex) + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasBech32ToHex, + "bech32ToHexAddr method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasBech32ToHex, + ) }) t.Run("bech32ify", func(t *testing.T) { gasBech32ify := contract.RequiredGas(abi.Methods[Bech32ifyMethodName].ID) copy(method[:], abi.Methods[Bech32ifyMethodName].ID[:4]) baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal(t, GasRequiredByMethod[method]+baseCost, gasBech32ify, "bech32ify method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasBech32ify) + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasBech32ify, + "bech32ify method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasBech32ify, + ) }) t.Run("getGasStabilityPoolBalance", func(t *testing.T) { gasGetGasStabilityPoolBalance := contract.RequiredGas(abi.Methods[GetGasStabilityPoolBalanceName].ID) copy(method[:], abi.Methods[GetGasStabilityPoolBalanceName].ID[:4]) baseCost := uint64(len(method)) * gasConfig.WriteCostPerByte - require.Equal(t, GasRequiredByMethod[method]+baseCost, gasGetGasStabilityPoolBalance, "getGasStabilityPoolBalance method should require %d gas, got %d", GasRequiredByMethod[method]+baseCost, gasGetGasStabilityPoolBalance) + require.Equal( + t, + GasRequiredByMethod[method]+baseCost, + gasGetGasStabilityPoolBalance, + "getGasStabilityPoolBalance method should require %d gas, got %d", + GasRequiredByMethod[method]+baseCost, + gasGetGasStabilityPoolBalance, + ) }) t.Run("invalid method", func(t *testing.T) { invalidMethodBytes := []byte("invalidMethod") gasInvalidMethod := contract.RequiredGas(invalidMethodBytes) - require.Equal(t, uint64(0), gasInvalidMethod, "invalid method should require %d gas, got %d", uint64(0), gasInvalidMethod) + require.Equal( + t, + uint64(0), + gasInvalidMethod, + "invalid method should require %d gas, got %d", + uint64(0), + gasInvalidMethod, + ) }) }) } @@ -93,7 +125,13 @@ func Test_Bech32ToHexAddress(t *testing.T) { require.NoError(t, err, "Bech32ToHexAddr should not return an error") addr := common.BytesToAddress(rawBytes[12:]) - require.Equal(t, common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), addr, "Bech32ToHexAddr should return the correct address, got: %v", addr) + require.Equal( + t, + common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), + addr, + "Bech32ToHexAddr should return the correct address, got: %v", + addr, + ) }) t.Run("should fail if invalid argument type", func(t *testing.T) { @@ -126,7 +164,13 @@ func Test_Bech32ToHexAddress(t *testing.T) { args := []interface{}{"zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", "second argument"} _, err := contract.Bech32ToHexAddr(&methodID, args) require.Error(t, err, "expected invalid number of arguments; expected 1; got: 2") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + require.IsType( + t, + &types.ErrInvalidNumberOfArgs{}, + err, + "expected error type: ErrInvalidNumberOfArgs, got: %T", + err, + ) }) }) @@ -158,7 +202,13 @@ func Test_Bech32ify(t *testing.T) { require.NoError(t, err, "Bech32ify prefix zeta should not return an error") zetaAddr := string(rawBytes[64:107]) - require.Equal(t, "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", zetaAddr, "Bech32ify prefix zeta should return the correct address, got: %v", zetaAddr) + require.Equal( + t, + "zeta1h8duy2dltz9xz0qqhm5wvcnj02upy887fyn43u", + zetaAddr, + "Bech32ify prefix zeta should return the correct address, got: %v", + zetaAddr, + ) }) t.Run("should succeed with cosmos HRP", func(t *testing.T) { @@ -168,15 +218,31 @@ func Test_Bech32ify(t *testing.T) { require.NoError(t, err, "Bech32ify prefix cosmos should not return an error") zetaAddr := string(rawBytes[64:107]) - require.Equal(t, "cosmos1h8duy2dltz9xz0qqhm5wvcnj02upy887lqaq", zetaAddr, "Bech32ify prefix cosmos should return the correct address, got: %v", zetaAddr) + require.Equal( + t, + "cosmos1h8duy2dltz9xz0qqhm5wvcnj02upy887lqaq", + zetaAddr, + "Bech32ify prefix cosmos should return the correct address, got: %v", + zetaAddr, + ) }) t.Run("should fail with invalid arguments", func(t *testing.T) { t.Run("too many arguments", func(t *testing.T) { - args := []interface{}{"zeta", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), "third argument"} + args := []interface{}{ + "zeta", + common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE"), + "third argument", + } _, err := contract.Bech32ify(&methodID, args) require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + require.IsType( + t, + &types.ErrInvalidNumberOfArgs{}, + err, + "expected error type: ErrInvalidNumberOfArgs, got: %T", + err, + ) }) t.Run("invalid HRP", func(t *testing.T) { @@ -194,13 +260,21 @@ func Test_Bech32ify(t *testing.T) { t.Run("empty HRP", func(t *testing.T) { args := []interface{}{"", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} _, err := contract.Bech32ify(&methodID, args) - require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)") + require.Error( + t, + err, + "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", + ) }) t.Run("alphanumeric HRP", func(t *testing.T) { args := []interface{}{"%&", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} _, err := contract.Bech32ify(&methodID, args) - require.Error(t, err, "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)") + require.Error( + t, + err, + "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", + ) }) }) } @@ -225,7 +299,11 @@ func Test_GetGasStabilityPoolBalance(t *testing.T) { args := []interface{}{int64(1337)} _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) - require.Error(t, err, "error calling fungible keeper: failed to get system contract variable: state variable not found") + require.Error( + t, + err, + "error calling fungible keeper: failed to get system contract variable: state variable not found", + ) t.Run("should fail with invalid arguments", func(t *testing.T) { @@ -233,7 +311,13 @@ func Test_GetGasStabilityPoolBalance(t *testing.T) { args := []interface{}{int64(1337), "second argument"} _, err := contract.GetGasStabilityPoolBalance(ctx, &methodID, args) require.Error(t, err, "expected invalid number of arguments; expected 2; got: 3") - require.IsType(t, &types.ErrInvalidNumberOfArgs{}, err, "expected error type: ErrInvalidNumberOfArgs, got: %T", err) + require.IsType( + t, + &types.ErrInvalidNumberOfArgs{}, + err, + "expected error type: ErrInvalidNumberOfArgs, got: %T", + err, + ) }) t.Run("invalid chainID", func(t *testing.T) { diff --git a/scripts/bindings-stateful-precompiles.sh b/scripts/bindings-stateful-precompiles.sh index 5106652fae..3083f8bf43 100755 --- a/scripts/bindings-stateful-precompiles.sh +++ b/scripts/bindings-stateful-precompiles.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eo pipefail - # Check if abigen is installed if ! command -v abigen &> /dev/null then @@ -9,6 +7,37 @@ then go install github.com/ethereum/go-ethereum/cmd/abigen@latest fi +# Check if solc is installed and at version 0.8.26 +if command -v solc &> /dev/null +then + SOLC_VERSION=$(solc --version | grep -o "Version: 0.8.26") + if [ "$SOLC_VERSION" == "Version: 0.8.26" ]; then + echo "solc version 0.8.26 is already installed." + else + echo "solc is installed but not version 0.8.26. Checking for solc-select..." + if command -v solc-select &> /dev/null + then + echo "solc-select found, installing and using solc 0.8.26..." + solc-select install 0.8.26 + solc-select use 0.8.26 + else + echo "solc-select not found. Please install solc-select or ensure solc 0.8.26 is available." + exit 1 + fi + fi +else + echo "solc is not installed. Checking for solc-select..." + if command -v solc-select &> /dev/null + then + echo "solc-select found, installing and using solc 0.8.26..." + solc-select install 0.8.26 + solc-select use 0.8.26 + else + echo "solc or solc-select could not be found. Please install one of them to proceed." + exit 1 + fi +fi + # Generic function to generate bindings function bindings() { cd $1 From e3649c196a514ccf39471d506d59ee02f3786830 Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 13:29:48 +0200 Subject: [PATCH 23/26] cleanup not needed changes --- .../localnet/orchestrator/start-zetae2e.sh | 2 +- testutil/keeper/crosschain.go | 5 +- x/crosschain/client/querytests/suite.go | 60 ------------------- 3 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 x/crosschain/client/querytests/suite.go diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 52c87132a7..98ba9060e7 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -209,7 +209,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then # When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up # Use light flag to skip advanced tests if [ "$UPGRADE_HEIGHT" -lt 100 ]; then - zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-precompiles ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light --skip-precompiles ${COMMON_ARGS} else zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-precompiles ${COMMON_ARGS} fi diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index e7650075f4..8b4f9b119e 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -219,9 +219,8 @@ func CrosschainKeeperWithMocks( } k.SetIBCCrosschainKeeper(ibcCrosschainKeeperTmp) - // Seal the IBC router. - // TODO: Is this really necessary? - // sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) + // seal the IBC router + sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) // load the latest version of the state store require.NoError(t, stateStore.LoadLatestVersion()) diff --git a/x/crosschain/client/querytests/suite.go b/x/crosschain/client/querytests/suite.go deleted file mode 100644 index 36eb7c1d34..0000000000 --- a/x/crosschain/client/querytests/suite.go +++ /dev/null @@ -1,60 +0,0 @@ -package querytests - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - ethcfg "github.com/zeta-chain/ethermint/cmd/config" - - "github.com/zeta-chain/zetacore/app" - cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/testutil/network" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" -) - -type CliTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network - crosschainState *types.GenesisState - observerState *observertypes.GenesisState -} - -func NewCLITestSuite(cfg network.Config) *CliTestSuite { - return &CliTestSuite{cfg: cfg} -} - -func (s *CliTestSuite) Setconfig() { - config := sdk.GetConfig() - cmdcfg.SetBech32Prefixes(config) - ethcfg.SetBip44CoinType(config) - // Make sure the address is compatible with ethereum - config.SetAddressVerifier(app.VerifyAddressFormat) - config.Seal() -} - -func (s *CliTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - s.Setconfig() - minOBsDel, ok := sdk.NewIntFromString("100000000000000000000") - s.Require().True(ok) - s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10))) - s.cfg.BondedTokens = minOBsDel - observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", - } - network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false) - s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec) - s.observerState = network.AddObserverData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec, nil) - net, err := network.New(s.T(), app.NodeDir, s.cfg) - s.Assert().NoError(err) - s.network = net - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *CliTestSuite) TearDownSuite() { - s.T().Log("tearing down genesis test suite") - s.network.Cleanup() -} From 4aba6e021bb4d28724671f0d4332d30316e9c1fe Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 13:37:49 +0200 Subject: [PATCH 24/26] revert ibc change in test --- testutil/keeper/crosschain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index 8b4f9b119e..8e58c6527f 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -220,7 +220,7 @@ func CrosschainKeeperWithMocks( k.SetIBCCrosschainKeeper(ibcCrosschainKeeperTmp) // seal the IBC router - sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) + // sdkKeepers.IBCKeeper.SetRouter(sdkKeepers.IBCRouter) // load the latest version of the state store require.NoError(t, stateStore.LoadLatestVersion()) From c8405423e804c8fd6c793afba54160ef375fea9a Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 13:57:34 +0200 Subject: [PATCH 25/26] remove new test --- precompiles/prototype/prototype_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go index e117466073..8999fa14eb 100644 --- a/precompiles/prototype/prototype_test.go +++ b/precompiles/prototype/prototype_test.go @@ -266,16 +266,6 @@ func Test_Bech32ify(t *testing.T) { "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", ) }) - - t.Run("alphanumeric HRP", func(t *testing.T) { - args := []interface{}{"%&", common.HexToAddress("0xB9Dbc229Bf588A613C00BEE8e662727AB8121cfE")} - _, err := contract.Bech32ify(&methodID, args) - require.Error( - t, - err, - "expected error invalid bech32 human readable prefix (HRP). Please provide either an account, validator, or consensus address prefix (eg: cosmos, cosmosvaloper, cosmosvalcons)", - ) - }) }) } From ecdc35faaf70c4862136eb027307bce304e6a5ef Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 27 Aug 2024 19:12:50 +0200 Subject: [PATCH 26/26] reduce simple operations gas required to 500 --- precompiles/prototype/prototype.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/precompiles/prototype/prototype.go b/precompiles/prototype/prototype.go index 930095f32f..eeba2f9328 100644 --- a/precompiles/prototype/prototype.go +++ b/precompiles/prototype/prototype.go @@ -42,9 +42,9 @@ func initABI() { copy(methodID[:], ABI.Methods[methodName].ID[:4]) switch methodName { case Bech32ToHexAddrMethodName: - GasRequiredByMethod[methodID] = 10000 + GasRequiredByMethod[methodID] = 500 case Bech32ifyMethodName: - GasRequiredByMethod[methodID] = 10000 + GasRequiredByMethod[methodID] = 500 case GetGasStabilityPoolBalanceName: GasRequiredByMethod[methodID] = 10000 default: