From 01b048ee822270c5b67ff5d8df8da9d98667e50a Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 28 Oct 2024 10:51:11 +0800 Subject: [PATCH 1/2] Problem: cometbft not up to date (#1664) * Problem: cometbft not up to date update to 0.38.13 * Update CHANGELOG.md Signed-off-by: yihuang * Apply suggestions from code review Signed-off-by: yihuang * update nixpkgs and golang * try bigger timeout * add golangci-lint overlay * lint-nix --------- Signed-off-by: yihuang Co-authored-by: mmsqe --- .github/workflows/lint.yml | 10 +++---- CHANGELOG.md | 6 ++++ docs/docs.go | 3 +- flake.lock | 8 ++--- flake.nix | 2 +- go.mod | 30 +++++++++---------- go.sum | 61 +++++++++++++++++++------------------- gomod2nix.toml | 52 ++++++++++++++++---------------- nix/build_overlay.nix | 1 + nix/golangci-lint.nix | 43 +++++++++++++++++++++++++++ nix/sources.json | 8 ++--- 11 files changed, 137 insertions(+), 87 deletions(-) create mode 100644 nix/golangci-lint.nix diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9d30403bc2..dc8f1e64d6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: golangci: name: Run golangci-lint runs-on: macos-latest - timeout-minutes: 60 + timeout-minutes: 120 steps: - uses: actions/setup-go@v3 with: @@ -46,13 +46,13 @@ jobs: BUILD_TAGS=rocksdb,grocksdb_clean_link,objstore go build -tags $BUILD_TAGS ./cmd/cronosd - golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 10m --build-tags $BUILD_TAGS + golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 30m --build-tags $BUILD_TAGS cd versiondb - golangci-lint run --out-format=github-actions --path-prefix=./versiondb --timeout 10m --build-tags $BUILD_TAGS + golangci-lint run --out-format=github-actions --path-prefix=./versiondb --timeout 30m --build-tags $BUILD_TAGS cd ../memiavl - golangci-lint run --out-format=github-actions --path-prefix=./memiavl --timeout 10m --build-tags objstore + golangci-lint run --out-format=github-actions --path-prefix=./memiavl --timeout 30m --build-tags objstore cd ../store - golangci-lint run --out-format=github-actions --path-prefix=./store --timeout 10m --build-tags objstore + golangci-lint run --out-format=github-actions --path-prefix=./store --timeout 30m --build-tags objstore # Check only if there are differences in the source code if: steps.changed-files.outputs.any_changed == 'true' diff --git a/CHANGELOG.md b/CHANGELOG.md index 8734ce4c5e..e943fbd331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## UNRELEASED + +### Improvements + +* [#1664](https://github.com/crypto-org-chain/cronos/pull/1664) Update cometbft to 0.38.13. + *Oct 24, 2024* ## v1.4.0-rc2 diff --git a/docs/docs.go b/docs/docs.go index 034ddd7b45..e6d66eeedc 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3,5 +3,6 @@ package docs import "embed" // Docs embed docs static files -// go:embed static +// +//go:embed static var Docs embed.FS diff --git a/flake.lock b/flake.lock index 26a3262253..ddadd0c001 100644 --- a/flake.lock +++ b/flake.lock @@ -77,16 +77,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716715802, - "narHash": "sha256-usk0vE7VlxPX8jOavrtpOqphdfqEQpf9lgedlY/r66c=", + "lastModified": 1729805696, + "narHash": "sha256-FArm/EIAbykrhtWxWKT1QXIg+dD44joehXZWdY12WKc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e2dd4e18cc1c7314e24154331bae07df76eb582f", + "rev": "50286248f2d7283682bdd47ba14af33a9233b88b", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "release-24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index b5d6d9a164..d005959740 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; flake-utils.url = "github:numtide/flake-utils"; nix-bundle-exe = { url = "github:3noch/nix-bundle-exe"; diff --git a/go.mod b/go.mod index 525960b41d..f9969066ce 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/crypto-org-chain/cronos/v2 -go 1.22.2 +go 1.22.7 -toolchain go1.22.3 +toolchain go1.23.1 require ( cosmossdk.io/api v0.7.6 @@ -19,7 +19,7 @@ require ( cosmossdk.io/x/upgrade v0.1.4 filippo.io/age v1.1.1 github.com/99designs/keyring v1.2.2 - github.com/cometbft/cometbft v0.38.13-0.20240920204745-fdf90d16f608 + github.com/cometbft/cometbft v0.38.13 github.com/cosmos/cosmos-db v1.0.3-0.20240408151834-e75f6e4b28d8 github.com/cosmos/cosmos-sdk v0.50.9 github.com/cosmos/gogoproto v1.7.0 @@ -42,8 +42,8 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 golang.org/x/crypto v0.27.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 - google.golang.org/grpc v1.66.1 + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 ) @@ -52,7 +52,7 @@ require ( cloud.google.com/go v0.115.0 // indirect cloud.google.com/go/auth v0.6.0 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.9 // indirect cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/collections v0.4.0 // indirect @@ -86,7 +86,7 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/cometbft/cometbft-db v0.12.0 // indirect + github.com/cometbft/cometbft-db v0.14.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect @@ -129,7 +129,7 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.2.1 // indirect + github.com/golang/glog v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect @@ -171,7 +171,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/ledgerwatch/erigon-lib v0.0.0-20230210071639-db0e7ed11263 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -187,12 +187,12 @@ require ( github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.1 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.57.0 // indirect + github.com/prometheus/common v0.59.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -200,7 +200,7 @@ require ( github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect @@ -233,7 +233,7 @@ require ( golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.24.0 // indirect @@ -242,7 +242,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // 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 // indirect diff --git a/go.sum b/go.sum index 03b1db312a..85298487d0 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -244,8 +244,8 @@ github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= -github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= +github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= +github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -370,10 +370,10 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.38.13-0.20240920204745-fdf90d16f608 h1:H/OAewlwE0zYQYbaYx2fLgw8agjr8F10Ai43Ug92P4w= -github.com/cometbft/cometbft v0.38.13-0.20240920204745-fdf90d16f608/go.mod h1:a8NBI2IdO283RZdpH0MuXlze3j+lv6PXuzOtTCq4YGE= -github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= -github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= +github.com/cometbft/cometbft v0.38.13 h1:k0ssyC8W0FfFvGpSHpojZ4JrXAANlJEIM41hjRq6OoU= +github.com/cometbft/cometbft v0.38.13/go.mod h1:NMmNysQM+T5uxTXVLMgzcvq35OVOyC7GK2/bnHqldjE= +github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz3DlerQ= +github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -579,8 +579,8 @@ github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoB github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= -github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -850,8 +850,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/ledgerwatch/erigon-lib v0.0.0-20230210071639-db0e7ed11263 h1:LGEzZvf33Y1NhuP5+jI/ni9l1TFS6oYPDilgy74NusM= github.com/ledgerwatch/erigon-lib v0.0.0-20230210071639-db0e7ed11263/go.mod h1:OXgMDuUo2lZ3NpH29ZvMYbk+LxFd5ffDl2Z2mGMuY/I= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.9.2 h1:O3mzvO0wuzQ9mtlHbDrShixyVjVbmuqTjFrzlf43wZ8= @@ -950,8 +950,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= -github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= +github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -971,9 +971,8 @@ github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -994,8 +993,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= -github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1010,8 +1009,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= -github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1046,8 +1045,8 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= 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= @@ -1343,8 +1342,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1730,10 +1729,10 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGrVb2hFXuQ+ZMbCNdakARIn/aHMmG8= google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1775,8 +1774,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM= -google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/gomod2nix.toml b/gomod2nix.toml index dec9b33381..daa7761b3c 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -11,8 +11,8 @@ schema = 3 version = "v0.2.2" hash = "sha256-rdgb3uWekFSfsMZeY7DqHr7Q8ELOwLIZO4W7t2Cvt40=" [mod."cloud.google.com/go/compute/metadata"] - version = "v0.3.0" - hash = "sha256-hj2Xjlz3vj7KYONZO/ItclWGGJEUgo5EvMEkGPfQi1Q=" + version = "v0.5.0" + hash = "sha256-IyVEEElHNPLTRFUMF8ymV3FfQEJQfEdTSeU5PodfOzA=" [mod."cloud.google.com/go/iam"] version = "v1.1.9" hash = "sha256-xC4/ssYSWYXlGz9y5BrVKHizSM7bGV/gi10qvf9dvKA=" @@ -158,11 +158,11 @@ schema = 3 version = "v1.0.0" hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0=" [mod."github.com/cometbft/cometbft"] - version = "v0.38.13-0.20240920204745-fdf90d16f608" - hash = "sha256-fusVsybvHUoqb0arjAyacGbCu/s50HOhlt1DV/7jpjM=" + version = "v0.38.13" + hash = "sha256-faMmyVlJUDpTl7dL1WKjEnGrQ56jxeCXPqPgbj/I1JY=" [mod."github.com/cometbft/cometbft-db"] - version = "v0.12.0" - hash = "sha256-mfeUD8+V+xUzEhSOLgQQP0GFDWt7ch/TeBw9gnTJuHk=" + version = "v0.14.1" + hash = "sha256-QvWMRGsdgCsSfL+DHp3w1Bm4jXa14SeT7oRK3PiNGV0=" [mod."github.com/cosmos/btcutil"] version = "v1.0.5" hash = "sha256-t572Sr5iiHcuMKLMWa2i+LBAt192oa+G1oA371tG/eI=" @@ -317,8 +317,8 @@ schema = 3 version = "v1.3.2" hash = "sha256-pogILFrrk+cAtb0ulqn9+gRZJ7sGnnLLdtqITvxvG6c=" [mod."github.com/golang/glog"] - version = "v1.2.1" - hash = "sha256-H9gR4sQRFOb4ZlSwvxU0MGR6iKnYWv4NSY3genjN/V4=" + version = "v1.2.2" + hash = "sha256-AIPEkLcrbIw49fuTDKfDifVLCtSpFPHgujQ/c99dPqk=" [mod."github.com/golang/groupcache"] version = "v0.0.0-20210331224755-41bb18bfe9da" hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" @@ -455,8 +455,8 @@ schema = 3 version = "v0.0.0-20230210071639-db0e7ed11263" hash = "sha256-SKFGLsJV6G4xIQ5IU+qq9EY3v0/I8B/CTMcDOhXGfc4=" [mod."github.com/lib/pq"] - version = "v1.10.7" - hash = "sha256-YPUv1VBZNFVUjFxQKdYd0Djje6KYYE99Hz6FnTfrmMw=" + version = "v1.10.9" + hash = "sha256-Gl6dLtL+yk6UrTTWfas43aM4lP/pNa2l7+ITXnjQyKs=" [mod."github.com/linxGnu/grocksdb"] version = "v1.9.2" hash = "sha256-ThXtaXx6LvRIFW4xLHsMrVWdsN2qobLPA0InLmlADOM=" @@ -506,8 +506,8 @@ schema = 3 version = "v2.2.2" hash = "sha256-ukxk1Cfm6cQW18g/aa19tLcUu5BnF7VmfAvrDHAOl6A=" [mod."github.com/petermattis/goid"] - version = "v0.0.0-20231207134359-e60b3f734c67" - hash = "sha256-73DbyhUTwYhqmvbcI96CNblTrfl6uz9OvM6z/h8j5TM=" + version = "v0.0.0-20240813172612-4fcff4a6cae7" + hash = "sha256-tfb/0LbMHJQsmxwaj2RItXiYn2AVd05E92Z/vp+rJhs=" [mod."github.com/pkg/errors"] version = "v0.9.1" hash = "sha256-mNfQtcrQmu3sNg/7IwiieKWOgFQOVVe2yXgKBpe/wZw=" @@ -515,14 +515,14 @@ schema = 3 version = "v1.0.1-0.20181226105442-5d4384ee4fb2" hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90=" [mod."github.com/prometheus/client_golang"] - version = "v1.20.1" - hash = "sha256-V6r2m3/bh07DYL2y6eMdXg6msM0G0k3abJdUoyrmYLU=" + version = "v1.20.4" + hash = "sha256-pdyQUDEkBwNmbT6IPtEVqmx7z0kBROvmOMMeeRVHAog=" [mod."github.com/prometheus/client_model"] version = "v0.6.1" hash = "sha256-rIDyUzNfxRA934PIoySR0EhuBbZVRK/25Jlc/r8WODw=" [mod."github.com/prometheus/common"] - version = "v0.57.0" - hash = "sha256-Lh9qK+5EfNHvT9u9QNvCTZFHJDB7CiFiHB+XqGENXNY=" + version = "v0.59.1" + hash = "sha256-PYoEunC2Rx1KP8vH2inTD7uBCfUlvcROfeeAGRRjXPY=" [mod."github.com/prometheus/procfs"] version = "v0.15.1" hash = "sha256-H+WXJemFFwdoglmD6p7JRjrJJZmIVAmJwYmLbZ8Q9sw=" @@ -545,8 +545,8 @@ schema = 3 version = "v0.1.0" hash = "sha256-F92BQXXmn3mCwu3mBaGh+joTRItQDSDhsjU6SofkYdA=" [mod."github.com/sasha-s/go-deadlock"] - version = "v0.3.1" - hash = "sha256-2CBEi9/iN/OMt7wEIG+hRjgDH6CRWIgibGGGy1dQ78I=" + version = "v0.3.5" + hash = "sha256-1vyxWqOTVVVeodipm/tpDgRKUMkEdkoLWSgtiVZaZmw=" [mod."github.com/shirou/gopsutil"] version = "v3.21.4-0.20210419000835-c7a38de76ee5+incompatible" hash = "sha256-oqIqyFquWabIE6DID6uTEc8oFEmM1rVu2ATn3toiCEg=" @@ -664,8 +664,8 @@ schema = 3 version = "v0.29.0" hash = "sha256-dH9Rdf5T04KJ4B5WvIZh12ogMbADWiWgIt77nvPTk2k=" [mod."golang.org/x/oauth2"] - version = "v0.21.0" - hash = "sha256-0xgi5k7fxMScMH+rDwXhDqe8raTFHh5ih727jGVS918=" + version = "v0.22.0" + hash = "sha256-3gmmXfCcxYBMaXmKRzGBpX01h4lMenFPkqWT9TwqIBE=" [mod."golang.org/x/sync"] version = "v0.8.0" hash = "sha256-usvF0z7gq1vsX58p4orX+8WHlv52pdXgaueXlwj2Wss=" @@ -691,14 +691,14 @@ schema = 3 version = "v0.0.0-20240701130421-f6361c86f094" hash = "sha256-5ZxSUe1BHYoiaiw0K1lLJmuobmBvk0+Y3CNkaLMnEic=" [mod."google.golang.org/genproto/googleapis/api"] - version = "v0.0.0-20240701130421-f6361c86f094" - hash = "sha256-uDvld45ensSUweUJYFdUfVt/0mNRrexpuQ3Jas3GMv4=" + version = "v0.0.0-20240814211410-ddb44dafa142" + hash = "sha256-NosKwVYZLpvtvRq7oD4ldoNcodSur62X1bpujarh9t8=" [mod."google.golang.org/genproto/googleapis/rpc"] - version = "v0.0.0-20240709173604-40e1e62336c5" - hash = "sha256-ass/74EkCljwk7DaASDtK2zipn2cZv6tCLKvwONUWgY=" + version = "v0.0.0-20240814211410-ddb44dafa142" + hash = "sha256-4T4DTrmFbqT4tD7PSL7Ie7u8ZN2iwGkhK02nWugssxk=" [mod."google.golang.org/grpc"] - version = "v1.66.1" - hash = "sha256-RIXP4zfg3dUciGpnbf0k2KTw8SAnSm06iCz+5dTW0iw=" + version = "v1.67.0" + hash = "sha256-n/0i7nR+dm0mIkJfUlM1BNcOdkwWBxspr9TQtwHMXV0=" [mod."google.golang.org/protobuf"] version = "v1.34.2" hash = "sha256-nMTlrDEE2dbpWz50eQMPBQXCyQh4IdjrTIccaU0F3m0=" diff --git a/nix/build_overlay.nix b/nix/build_overlay.nix index 2870eae80e..1904555195 100644 --- a/nix/build_overlay.nix +++ b/nix/build_overlay.nix @@ -1,4 +1,5 @@ # some basic overlays necessary for the build final: super: { rocksdb = final.callPackage ./rocksdb.nix { }; + golangci-lint = final.callPackage ./golangci-lint.nix { }; } diff --git a/nix/golangci-lint.nix b/nix/golangci-lint.nix new file mode 100644 index 0000000000..9845f267dc --- /dev/null +++ b/nix/golangci-lint.nix @@ -0,0 +1,43 @@ +{ buildGo123Module, fetchFromGitHub, lib, installShellFiles }: + +buildGo123Module rec { + pname = "golangci-lint"; + version = "1.60.1"; + + src = fetchFromGitHub { + owner = "golangci"; + repo = "golangci-lint"; + rev = "v${version}"; + hash = "sha256-+F/t5UJjyqOsabi2J4M9g5JvAqfKjOvlzdhNozRCv70="; + }; + + vendorHash = "sha256-elDDSAeEpKXn6fhBFB218mWsSq0mo+GcfQsTDOAPSCI="; + + subPackages = [ "cmd/golangci-lint" ]; + + nativeBuildInputs = [ installShellFiles ]; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + "-X main.commit=v${version}" + "-X main.date=19700101-00:00:00" + ]; + + postInstall = '' + for shell in bash zsh fish; do + HOME=$TMPDIR $out/bin/golangci-lint completion $shell > golangci-lint.$shell + installShellCompletion golangci-lint.$shell + done + ''; + + meta = with lib; { + description = "Fast linters Runner for Go"; + homepage = "https://golangci-lint.run/"; + changelog = "https://github.com/golangci/golangci-lint/blob/v${version}/CHANGELOG.md"; + mainProgram = "golangci-lint"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ SuperSandro2000 mic92 ]; + }; +} diff --git a/nix/sources.json b/nix/sources.json index 4d02d2cc91..1770fa786d 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -97,15 +97,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "nixpkgs-unstable", + "branch": "release-24.05", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", - "sha256": "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx", + "rev": "50286248f2d7283682bdd47ba14af33a9233b88b", + "sha256": "19sqfs6pamknhlg3mqpqs3wj0wj1ynj5icfmhqmjjvq08byfc2hl", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/63dacb46bf939521bdc93981b4cbb7ecb58427a0.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/50286248f2d7283682bdd47ba14af33a9233b88b.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "poetry2nix": { From 27f1a590ffdaea058892ddeccad051db291c6a3c Mon Sep 17 00:00:00 2001 From: mmsqe Date: Mon, 28 Oct 2024 13:02:24 +0800 Subject: [PATCH 2/2] Problem: no register support for payee and counterpartyPayee (#1665) * Problem: no register support for payee and counterpartyPayee * Update integration_tests/ibc_utils.py Signed-off-by: mmsqe * counterpartyPayee * fix test --------- Signed-off-by: mmsqe --- CHANGELOG.md | 4 + app/app.go | 2 +- integration_tests/configs/ibc.jsonnet | 4 +- .../contracts/contracts/TestRelayer.sol | 23 +- integration_tests/cosmoscli.py | 2 +- integration_tests/ibc_utils.py | 243 +++++++++----- integration_tests/test_ibc.py | 3 +- integration_tests/test_ibc_rly.py | 14 +- integration_tests/test_ibc_rly_gas.py | 5 +- integration_tests/test_ica_precompile.py | 1 + .../relayer/i_relayer_functions.abigen.go | 317 +++--------------- .../events/bindings/src/RelayerFunctions.sol | 15 +- x/cronos/keeper/precompiles/relayer.go | 64 +++- x/cronos/types/interfaces.go | 6 + 14 files changed, 289 insertions(+), 414 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e943fbd331..686e0aed34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## UNRELEASED +### Features + +* [#1665](https://github.com/crypto-org-chain/cronos/pull/1665) Support register for payee and counterpartyPayee in relayer precompile. + ### Improvements * [#1664](https://github.com/crypto-org-chain/cronos/pull/1664) Update cometbft to 0.38.13. diff --git a/app/app.go b/app/app.go index 2ef656b0d5..14a2cad6df 100644 --- a/app/app.go +++ b/app/app.go @@ -680,7 +680,7 @@ func New( evmS, []evmkeeper.CustomContractFn{ func(_ sdk.Context, rules ethparams.Rules) vm.PrecompiledContract { - return cronosprecompiles.NewRelayerContract(app.IBCKeeper, appCodec, rules, app.Logger()) + return cronosprecompiles.NewRelayerContract(app.IBCKeeper, app.IBCFeeKeeper, appCodec, rules, app.Logger()) }, func(ctx sdk.Context, rules ethparams.Rules) vm.PrecompiledContract { return cronosprecompiles.NewIcaContract(ctx, app.ICAControllerKeeper, &app.CronosKeeper, appCodec, gasConfig) diff --git a/integration_tests/configs/ibc.jsonnet b/integration_tests/configs/ibc.jsonnet index 09e2b05359..eafeb430a1 100644 --- a/integration_tests/configs/ibc.jsonnet +++ b/integration_tests/configs/ibc.jsonnet @@ -39,7 +39,7 @@ config { 'account-prefix': 'cro', 'coin-type': 394, 'app-config': { - 'minimum-gas-prices': '500basecro', + 'minimum-gas-prices': '0basecro', }, validators: [ { @@ -68,7 +68,7 @@ config { }, { name: 'signer2', - coins: '10000000000000cro', + coins: '10000000000000cro,100000000000ibcfee', mnemonic: '${SIGNER2_MNEMONIC}', }, ] + [ diff --git a/integration_tests/contracts/contracts/TestRelayer.sol b/integration_tests/contracts/contracts/TestRelayer.sol index 663b02e65f..ba930f1ae7 100644 --- a/integration_tests/contracts/contracts/TestRelayer.sol +++ b/integration_tests/contracts/contracts/TestRelayer.sol @@ -1,13 +1,32 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; +import {IRelayerFunctions} from "./src/RelayerFunctions.sol"; + contract TestRelayer { - address constant relayer = 0x0000000000000000000000000000000000000065; + address constant relayerContract = 0x0000000000000000000000000000000000000065; + IRelayerFunctions relayer = IRelayerFunctions(relayerContract); + address payee; + address counterpartyPayee; function batchCall(bytes[] memory payloads) public { for (uint256 i = 0; i < payloads.length; i++) { - (bool success,) = relayer.call(payloads[i]); + (bool success,) = relayerContract.call(payloads[i]); require(success); } } + + function callRegisterPayee(string calldata portID, string calldata channelID, address payeeAddr) public returns (bool) { + require(payee == address(0) || payee == msg.sender, "register fail"); + bool result = relayer.registerPayee(portID, channelID, payeeAddr); + require(result, "call failed"); + payee = msg.sender; + } + + function callRegisterCounterpartyPayee(string calldata portID, string calldata channelID, string calldata counterpartyPayeeAddr) public returns (bool) { + require(counterpartyPayee == address(0) || counterpartyPayee == msg.sender, "register fail"); + bool result = relayer.registerCounterpartyPayee(portID, channelID, counterpartyPayeeAddr); + require(result, "call failed"); + counterpartyPayee = msg.sender; + } } diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index 4b6aca5746..a81eeebc01 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -888,7 +888,7 @@ def ibc_transfer( to, amount, channel, # src channel - target_version, # chain version number of target chain + target_version=1, # chain version number of target chain event_query_tx_for=False, **kwargs, ): diff --git a/integration_tests/ibc_utils.py b/integration_tests/ibc_utils.py index bd88269006..fcb68c42f9 100644 --- a/integration_tests/ibc_utils.py +++ b/integration_tests/ibc_utils.py @@ -9,12 +9,14 @@ import requests from cprotobuf import Field, ProtoEntity +from eth_utils import to_checksum_address from pystarport import cluster, ports from .network import Chainmain, Cronos, Hermes, setup_custom_cronos from .utils import ( ADDRS, CONTRACTS, + bech32_to_eth, deploy_contract, derive_new_account, eth_to_bech32, @@ -97,7 +99,7 @@ def call_hermes_cmd( ) -def call_rly_cmd(path, connection_only, version, hostchain="chainmain-1"): +def call_rly_cmd(path, connection_only, incentivized, version, hostchain="chainmain-1"): cmd = [ "rly", "pth", @@ -130,11 +132,11 @@ def call_rly_cmd(path, connection_only, version, hostchain="chainmain-1"): "transfer", "--order", "unordered", - "--version", - json.dumps(version), "--home", str(path), ] + if incentivized: + cmd.extend(["--version", json.dumps(version)]) subprocess.check_call(cmd) @@ -145,12 +147,14 @@ def prepare_network( is_relay=True, connection_only=False, grantee=None, + need_relayer_caller=False, relayer=cluster.Relayer.HERMES.value, ): print("incentivized", incentivized) print("is_relay", is_relay) print("connection_only", connection_only) print("relayer", relayer) + print("need_relayer_caller", need_relayer_caller) is_hermes = relayer == cluster.Relayer.HERMES.value hermes = None file = f"configs/{file}.jsonnet" @@ -181,16 +185,20 @@ def prepare_network( version = {"fee_version": "ics29-1", "app_version": "ics20-1"} path = cronos.base_dir.parent / "relayer" w3 = cronos.w3 - acc = derive_new_account(2) - sender = acc.address - # fund new sender to deploy contract with same address - if w3.eth.get_balance(sender, "latest") == 0: - fund = 3000000000000000000 - tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price} - send_transaction(w3, tx) - assert w3.eth.get_balance(sender, "latest") == fund - caller = deploy_contract(w3, CONTRACTS["TestRelayer"], key=acc.key).address - assert caller == RELAYER_CALLER, caller + contract = None + acc = None + if need_relayer_caller: + acc = derive_new_account(2) + sender = acc.address + # fund new sender to deploy contract with same address + if w3.eth.get_balance(sender, "latest") == 0: + fund = 3000000000000000000 + tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price} + send_transaction(w3, tx) + assert w3.eth.get_balance(sender, "latest") == fund + contract = deploy_contract(w3, CONTRACTS["TestRelayer"], key=acc.key) + caller = contract.address + assert caller == RELAYER_CALLER, caller if is_hermes: hermes = Hermes(path.with_suffix(".toml")) call_hermes_cmd( @@ -200,10 +208,10 @@ def prepare_network( version, ) else: - call_rly_cmd(path, connection_only, version) + call_rly_cmd(path, connection_only, incentivized, version) if incentivized: - register_fee_payee(cronos.cosmos_cli(), chainmain.cosmos_cli()) + register_fee_payee(cronos, chainmain, contract, acc) port = None if is_relay: @@ -217,16 +225,52 @@ def prepare_network( wait_for_port(port) -def register_fee_payee(src_chain, dst_chain): - rsp = dst_chain.register_counterparty_payee( - "transfer", - "channel-0", - dst_chain.address("relayer"), - src_chain.address("signer1"), - from_="relayer", +def register_fee_payee(src_chain, dst_chain, contract=None, acc=None): + port_id = "transfer" + channel_id = "channel-0" + chains = [src_chain.cosmos_cli(), dst_chain.cosmos_cli()] + relayer0 = chains[0].address("signer1") + relayer1 = chains[1].address("relayer") + rsp = chains[1].register_counterparty_payee( + port_id, + channel_id, + relayer1, + relayer0, + from_=relayer1, fees="100000000basecro", ) assert rsp["code"] == 0, rsp["raw_log"] + if contract is None: + rsp = chains[0].register_payee( + port_id, + channel_id, + relayer0, + relayer0, + from_="signer1", + fees="100000000basetcro", + ) + assert rsp["code"] == 0, rsp["raw_log"] + rsp = chains[0].register_counterparty_payee( + port_id, + channel_id, + relayer0, + relayer1, + from_=relayer0, + fees="100000000basetcro", + ) + assert rsp["code"] == 0, rsp["raw_log"] + else: + data = {"from": acc.address} + tx = contract.functions.callRegisterPayee( + port_id, channel_id, to_checksum_address(bech32_to_eth(relayer0)) + ).build_transaction(data) + receipt = send_transaction(src_chain.w3, tx, acc.key) + assert receipt.status == 1, receipt + tx = contract.functions.callRegisterCounterpartyPayee( + port_id, channel_id, relayer1 + ).build_transaction(data) + receipt = send_transaction(src_chain.w3, tx, acc.key) + assert receipt.status == 1, receipt def assert_ready(ibc): @@ -360,7 +404,6 @@ def ibc_multi_transfer(ibc): addrs1[i], f"{amount}{denom0}", channel0, - 1, fees=f"1000{denom1}", event_query_tx_for=True, ) @@ -401,7 +444,6 @@ def assert_balance(addr): addrs0[i], f"{amt}ibc/{denom_hash}", channel1, - 1, fees=f"100000000{denom1}", ) assert rsp["code"] == 0, rsp["raw_log"] @@ -414,66 +456,61 @@ def assert_balance(addr): def ibc_incentivized_transfer(ibc): chains = [ibc.cronos.cosmos_cli(), ibc.chainmain.cosmos_cli()] - receiver = chains[1].address("signer2") - sender = chains[0].address("signer2") - relayer = chains[0].address("signer1") - relayer_caller = eth_to_bech32(RELAYER_CALLER) + user0 = chains[0].address("signer2") + relayer0 = chains[0].address("signer1") + user1 = chains[1].address("signer2") + relayer1 = chains[1].address("relayer") amount = 1000 fee_denom = "ibcfee" - base_denom = "basetcro" - old_amt_fee = chains[0].balance(relayer, fee_denom) - old_amt_fee_caller = chains[0].balance(relayer_caller, fee_denom) - old_amt_sender_fee = chains[0].balance(sender, fee_denom) - old_amt_sender_base = chains[0].balance(sender, base_denom) - old_amt_receiver_base = chains[1].balance(receiver, "basecro") - assert old_amt_sender_base == 30000000000100000000000 - assert old_amt_receiver_base == 1000000000000000000000 + base_denom0 = "basetcro" + base_denom1 = "basecro" + old_relayer0_fee = chains[0].balance(relayer0, fee_denom) + old_user0_fee = chains[0].balance(user0, fee_denom) + old_user0_base = chains[0].balance(user0, base_denom0) + old_relayer1_fee = chains[1].balance(relayer1, fee_denom) + old_user1_fee = chains[1].balance(user1, fee_denom) + old_user1_base = chains[1].balance(user1, base_denom1) + assert old_user0_base == 30000000000100000000000 + assert old_user1_base == 1000000000000000000000 src_channel = "channel-0" dst_channel = "channel-0" rsp = chains[0].ibc_transfer( - sender, - receiver, - f"{amount}{base_denom}", + user0, + user1, + f"{amount}{base_denom0}", src_channel, - 1, - fees="0basecro", + fees=f"0{base_denom0}", ) assert rsp["code"] == 0, rsp["raw_log"] - src_chain = ibc.cronos.cosmos_cli() - rsp = src_chain.event_query_tx_for(rsp["txhash"]) - - def cb(attrs): - return "packet_sequence" in attrs - - evt = find_log_event_attrs(rsp["events"], "send_packet", cb) + rsp = chains[0].event_query_tx_for(rsp["txhash"]) + evt = find_log_event_attrs( + rsp["events"], "send_packet", lambda attrs: "packet_sequence" in attrs + ) print("packet event", evt) packet_seq = int(evt["packet_sequence"]) - fee = f"10{fee_denom}" + recv_fee = 10 + ack_fee = 11 + timeout_fee = 12 rsp = chains[0].pay_packet_fee( "transfer", src_channel, packet_seq, - recv_fee=fee, - ack_fee=fee, - timeout_fee=fee, - from_=sender, + recv_fee=f"{recv_fee}{fee_denom}", + ack_fee=f"{ack_fee}{fee_denom}", + timeout_fee=f"{timeout_fee}{fee_denom}", + from_=user0, ) assert rsp["code"] == 0, rsp["raw_log"] # fee is locked - current = chains[0].balance(sender, fee_denom) + user0_fee = chains[0].balance(user0, fee_denom) # https://github.com/cosmos/ibc-go/pull/5571 - assert current == old_amt_sender_fee - 20, current + assert user0_fee == old_user0_fee - recv_fee - ack_fee, user0_fee # wait for relayer receive the fee def check_fee(): - amount = chains[0].balance(relayer, fee_denom) - if amount > old_amt_fee: - amount_caller = chains[0].balance(relayer_caller, fee_denom) - if amount_caller > 0: - assert amount_caller == old_amt_fee_caller + 10, amount_caller - assert amount == old_amt_fee + 10, amount - else: - assert amount == old_amt_fee + 20, amount + relayer0_fee = chains[0].balance(relayer0, fee_denom) + if relayer0_fee > old_relayer0_fee: + assert relayer0_fee == old_relayer0_fee + recv_fee + ack_fee, relayer0_fee return True else: return False @@ -481,41 +518,67 @@ def check_fee(): wait_for_fn("wait for relayer to receive the fee", check_fee) # timeout fee is refunded - actual = get_balances(ibc.cronos, sender) - assert actual == [ - {"denom": base_denom, "amount": f"{old_amt_sender_base - amount}"}, - {"denom": fee_denom, "amount": f"{old_amt_sender_fee - 20}"}, - ], actual - path = f"transfer/{dst_channel}/{base_denom}" - denom_hash = hashlib.sha256(path.encode()).hexdigest().upper() + user0_balances = get_balances(ibc.cronos, user0) + expected = [ + {"denom": base_denom0, "amount": f"{old_user0_base - amount}"}, + {"denom": fee_denom, "amount": f"{old_user0_fee - recv_fee - ack_fee}"}, + ] + assert user0_balances == expected, user0_balances + path = f"transfer/{dst_channel}/{base_denom0}" + denom_hash = ibc_denom(dst_channel, base_denom0) denom_trace = chains[0].ibc_denom_trace(path, ibc.chainmain.node_rpc(0)) - assert denom_trace == {"path": f"transfer/{dst_channel}", "base_denom": base_denom} - current = get_balances(ibc.chainmain, receiver) - assert current == [ - {"denom": "basecro", "amount": f"{old_amt_receiver_base}"}, - {"denom": f"ibc/{denom_hash}", "amount": f"{amount}"}, - ], current + assert denom_trace == {"path": f"transfer/{dst_channel}", "base_denom": base_denom0} + user1_balances = get_balances(ibc.chainmain, user1) + expected = [ + {"denom": base_denom1, "amount": f"{old_user1_base}"}, + {"denom": f"{denom_hash}", "amount": f"{amount}"}, + {"denom": f"{fee_denom}", "amount": f"{old_user1_fee}"}, + ] + assert user1_balances == expected, user1_balances # transfer back - fee_amount = 100000000 rsp = chains[1].ibc_transfer( - receiver, - sender, - f"{amount}ibc/{denom_hash}", + user1, + user0, + f"{amount}{denom_hash}", + dst_channel, + fees=f"0{base_denom1}", + ) + assert rsp["code"] == 0, rsp["raw_log"] + rsp = chains[1].event_query_tx_for(rsp["txhash"]) + evt = find_log_event_attrs( + rsp["events"], "send_packet", lambda attrs: "packet_sequence" in attrs + ) + print("packet event", evt) + rsp = chains[1].pay_packet_fee( + "transfer", dst_channel, - 1, - fees=f"{fee_amount}basecro", + int(evt["packet_sequence"]), + recv_fee=f"{recv_fee}{fee_denom}", + ack_fee=f"{ack_fee}{fee_denom}", + timeout_fee=f"{timeout_fee}{fee_denom}", + from_=user1, ) assert rsp["code"] == 0, rsp["raw_log"] + # fee is locked + user1_fee = chains[1].balance(user1, fee_denom) + assert user1_fee == old_user1_fee - recv_fee - ack_fee, user1_fee + + # wait for relayer receive the fee + def check_fee(): + relayer1_fee = chains[1].balance(relayer1, fee_denom) + if relayer1_fee > old_relayer1_fee: + assert relayer1_fee == old_relayer1_fee + recv_fee + ack_fee, relayer1_fee + return True + else: + return False + + wait_for_fn("wait for relayer to receive the fee", check_fee) def check_balance_change(): - return chains[0].balance(sender, base_denom) != old_amt_sender_base - amount + return chains[0].balance(user0, base_denom0) != old_user0_base - amount wait_for_fn("balance change", check_balance_change) - actual = chains[0].balance(sender, base_denom) - assert actual == old_amt_sender_base, actual - current = chains[1].balance(receiver, "basecro") - assert current == old_amt_receiver_base - fee_amount - return amount, packet_seq + return amount, packet_seq, recv_fee, ack_fee def ibc_denom(channel, denom): @@ -581,7 +644,7 @@ def check_chainmain_balance_change(): coin = "1000" + dest_denom fees = "100000000basecro" rsp = chainmain_cli.ibc_transfer( - chainmain_receiver, cronos_receiver, coin, "channel-0", 1, fees=fees + chainmain_receiver, cronos_receiver, coin, "channel-0", fees=fees ) assert rsp["code"] == 0, rsp["raw_log"] @@ -683,7 +746,7 @@ def check_chainmain_balance_change(): coin = f"{amount}{dest_denom}" fees = "100000000basecro" rsp = chainmain_cli.ibc_transfer( - chainmain_receiver, cronos_receiver, coin, "channel-0", 1, fees=fees + chainmain_receiver, cronos_receiver, coin, "channel-0", fees=fees ) assert rsp["code"] == 0, rsp["raw_log"] diff --git a/integration_tests/test_ibc.py b/integration_tests/test_ibc.py index 56edf919c3..7c60039475 100644 --- a/integration_tests/test_ibc.py +++ b/integration_tests/test_ibc.py @@ -68,7 +68,6 @@ def test_ibc_incentivized_transfer(ibc, tmp_path): if not ibc.incentivized: # upgrade to incentivized src_chain = ibc.cronos.cosmos_cli() - dst_chain = ibc.chainmain.cosmos_cli() version = {"fee_version": "ics29-1", "app_version": "ics20-1"} community = "community" authority = module_address("gov") @@ -96,7 +95,7 @@ def test_ibc_incentivized_transfer(ibc, tmp_path): src_chain, connid, channel_id, "STATE_FLUSHCOMPLETE" ) wait_for_check_channel_ready(src_chain, connid, channel_id) - register_fee_payee(src_chain, dst_chain) + register_fee_payee(ibc.cronos, ibc.chainmain) ibc_incentivized_transfer(ibc) diff --git a/integration_tests/test_ibc_rly.py b/integration_tests/test_ibc_rly.py index 0e8e23ee91..f40263a271 100644 --- a/integration_tests/test_ibc_rly.py +++ b/integration_tests/test_ibc_rly.py @@ -2,7 +2,6 @@ import pytest from eth_utils import keccak, to_checksum_address -from pystarport import cluster from web3.datastructures import AttributeDict from .ibc_utils import ( @@ -51,7 +50,7 @@ def ibc(request, tmp_path_factory): yield from prepare_network( path, name, - relayer=cluster.Relayer.HERMES.value, + need_relayer_caller=True, ) @@ -277,10 +276,9 @@ def test_ibc_incentivized_transfer(ibc): cli = ibc.cronos.cosmos_cli() wait_for_new_blocks(cli, 1) start = w3.eth.get_block_number() - amount, seq0 = ibc_incentivized_transfer(ibc) + amount, seq0, recv_fee, ack_fee = ibc_incentivized_transfer(ibc) logs = get_logs_since(w3, CONTRACT, start) fee_denom = "ibcfee" - fee = f"{src_amount}{fee_denom}" transfer_denom = "transfer/channel-0/basetcro" dst_adr = ibc.chainmain.cosmos_cli().address("signer2") src_relayer = ADDRS["signer1"] @@ -290,10 +288,10 @@ def test_ibc_incentivized_transfer(ibc): seq1 = get_send_packet_seq(ibc.chainmain.cosmos_cli()) expected = [ acknowledge_packet(seq0), - distribute_fee(src_relayer, fee), - *send_coins(feeibc_addr, src_relayer, src_amount, fee_denom), - distribute_fee(src_relayer, fee), - *send_coins(feeibc_addr, src_relayer, src_amount, fee_denom), + distribute_fee(src_relayer, f"{recv_fee}{fee_denom}"), + *send_coins(feeibc_addr, src_relayer, recv_fee, fee_denom), + distribute_fee(src_relayer, f"{ack_fee}{fee_denom}"), + *send_coins(feeibc_addr, src_relayer, ack_fee, fee_denom), distribute_fee(cronos_signer2, ""), *send_coins(feeibc_addr, cronos_signer2, 0, fee_denom), fungible(checksum_dst_adr, cronos_signer2, amount, dst_denom), diff --git a/integration_tests/test_ibc_rly_gas.py b/integration_tests/test_ibc_rly_gas.py index ce1f206895..8b3c7486c4 100644 --- a/integration_tests/test_ibc_rly_gas.py +++ b/integration_tests/test_ibc_rly_gas.py @@ -1,5 +1,4 @@ import pytest -from pystarport import cluster from .ibc_utils import ( ibc_incentivized_transfer, @@ -18,7 +17,7 @@ def ibc(request, tmp_path_factory): "prepare-network" name = request.param path = tmp_path_factory.mktemp(name) - yield from prepare_network(path, name, relayer=cluster.Relayer.HERMES.value) + yield from prepare_network(path, name, need_relayer_caller=name == "ibc_rly_evm") records = [] @@ -31,7 +30,7 @@ def test_ibc(ibc): ibc_transfer(ibc) ibc_incentivized_transfer(ibc) ibc_multi_transfer(ibc) - diff = 0.1 + diff = 0.15 record = log_gas_records(cli) if record: records.append(record) diff --git a/integration_tests/test_ica_precompile.py b/integration_tests/test_ica_precompile.py index d3ddba1078..067bf1f671 100644 --- a/integration_tests/test_ica_precompile.py +++ b/integration_tests/test_ica_precompile.py @@ -56,6 +56,7 @@ def ibc(request, tmp_path_factory): incentivized=False, connection_only=True, relayer=cluster.Relayer.RLY.value, + need_relayer_caller=True, ) diff --git a/x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go b/x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go index eb1cd85583..520abd2896 100644 --- a/x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go +++ b/x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go @@ -31,7 +31,7 @@ var ( // RelayerFunctionsMetaData contains all meta data concerning the RelayerFunctions contract. var RelayerFunctionsMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"acknowledgement\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelCloseConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelCloseInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenAck\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenTry\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenAck\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenTry\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"createClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"recvPacket\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"submitMisbehaviour\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"timeout\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"timeoutOnClose\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"updateClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndAcknowledgement\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelCloseConfirm\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelCloseInit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelOpenAck\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelOpenConfirm\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelOpenInit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndChannelOpenTry\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndConnectionOpenAck\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndConnectionOpenConfirm\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndConnectionOpenInit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndConnectionOpenTry\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndRecvPacket\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data2\",\"type\":\"bytes\"}],\"name\":\"updateClientAndTimeout\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"acknowledgement\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelCloseConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelCloseInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenAck\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"channelOpenTry\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenAck\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenConfirm\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenInit\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"connectionOpenTry\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"createClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"recvPacket\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"portID\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"channelID\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"counterpartyPayeeAddr\",\"type\":\"string\"}],\"name\":\"registerCounterpartyPayee\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"portID\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"channelID\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"payeeAddr\",\"type\":\"address\"}],\"name\":\"registerPayee\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"submitMisbehaviour\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"timeout\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"timeoutOnClose\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"updateClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeClient\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // RelayerFunctionsABI is the input ABI used to generate the binding from. @@ -453,6 +453,48 @@ func (_RelayerFunctions *RelayerFunctionsTransactorSession) RecvPacket(data []by return _RelayerFunctions.Contract.RecvPacket(&_RelayerFunctions.TransactOpts, data) } +// RegisterCounterpartyPayee is a paid mutator transaction binding the contract method 0x8e0bf32e. +// +// Solidity: function registerCounterpartyPayee(string portID, string channelID, string counterpartyPayeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsTransactor) RegisterCounterpartyPayee(opts *bind.TransactOpts, portID string, channelID string, counterpartyPayeeAddr string) (*types.Transaction, error) { + return _RelayerFunctions.contract.Transact(opts, "registerCounterpartyPayee", portID, channelID, counterpartyPayeeAddr) +} + +// RegisterCounterpartyPayee is a paid mutator transaction binding the contract method 0x8e0bf32e. +// +// Solidity: function registerCounterpartyPayee(string portID, string channelID, string counterpartyPayeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsSession) RegisterCounterpartyPayee(portID string, channelID string, counterpartyPayeeAddr string) (*types.Transaction, error) { + return _RelayerFunctions.Contract.RegisterCounterpartyPayee(&_RelayerFunctions.TransactOpts, portID, channelID, counterpartyPayeeAddr) +} + +// RegisterCounterpartyPayee is a paid mutator transaction binding the contract method 0x8e0bf32e. +// +// Solidity: function registerCounterpartyPayee(string portID, string channelID, string counterpartyPayeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsTransactorSession) RegisterCounterpartyPayee(portID string, channelID string, counterpartyPayeeAddr string) (*types.Transaction, error) { + return _RelayerFunctions.Contract.RegisterCounterpartyPayee(&_RelayerFunctions.TransactOpts, portID, channelID, counterpartyPayeeAddr) +} + +// RegisterPayee is a paid mutator transaction binding the contract method 0xb0dff939. +// +// Solidity: function registerPayee(string portID, string channelID, address payeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsTransactor) RegisterPayee(opts *bind.TransactOpts, portID string, channelID string, payeeAddr common.Address) (*types.Transaction, error) { + return _RelayerFunctions.contract.Transact(opts, "registerPayee", portID, channelID, payeeAddr) +} + +// RegisterPayee is a paid mutator transaction binding the contract method 0xb0dff939. +// +// Solidity: function registerPayee(string portID, string channelID, address payeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsSession) RegisterPayee(portID string, channelID string, payeeAddr common.Address) (*types.Transaction, error) { + return _RelayerFunctions.Contract.RegisterPayee(&_RelayerFunctions.TransactOpts, portID, channelID, payeeAddr) +} + +// RegisterPayee is a paid mutator transaction binding the contract method 0xb0dff939. +// +// Solidity: function registerPayee(string portID, string channelID, address payeeAddr) payable returns(bool) +func (_RelayerFunctions *RelayerFunctionsTransactorSession) RegisterPayee(portID string, channelID string, payeeAddr common.Address) (*types.Transaction, error) { + return _RelayerFunctions.Contract.RegisterPayee(&_RelayerFunctions.TransactOpts, portID, channelID, payeeAddr) +} + // SubmitMisbehaviour is a paid mutator transaction binding the contract method 0xa53b1c82. // // Solidity: function submitMisbehaviour(bytes data) payable returns(bytes) @@ -537,279 +579,6 @@ func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClient(data [] return _RelayerFunctions.Contract.UpdateClient(&_RelayerFunctions.TransactOpts, data) } -// UpdateClientAndAcknowledgement is a paid mutator transaction binding the contract method 0x65a939c6. -// -// Solidity: function updateClientAndAcknowledgement(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndAcknowledgement(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndAcknowledgement", data1, data2) -} - -// UpdateClientAndAcknowledgement is a paid mutator transaction binding the contract method 0x65a939c6. -// -// Solidity: function updateClientAndAcknowledgement(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndAcknowledgement(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndAcknowledgement(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndAcknowledgement is a paid mutator transaction binding the contract method 0x65a939c6. -// -// Solidity: function updateClientAndAcknowledgement(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndAcknowledgement(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndAcknowledgement(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelCloseConfirm is a paid mutator transaction binding the contract method 0x9bbcbfd2. -// -// Solidity: function updateClientAndChannelCloseConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelCloseConfirm(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelCloseConfirm", data1, data2) -} - -// UpdateClientAndChannelCloseConfirm is a paid mutator transaction binding the contract method 0x9bbcbfd2. -// -// Solidity: function updateClientAndChannelCloseConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelCloseConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelCloseConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelCloseConfirm is a paid mutator transaction binding the contract method 0x9bbcbfd2. -// -// Solidity: function updateClientAndChannelCloseConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelCloseConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelCloseConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelCloseInit is a paid mutator transaction binding the contract method 0x5447448d. -// -// Solidity: function updateClientAndChannelCloseInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelCloseInit(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelCloseInit", data1, data2) -} - -// UpdateClientAndChannelCloseInit is a paid mutator transaction binding the contract method 0x5447448d. -// -// Solidity: function updateClientAndChannelCloseInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelCloseInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelCloseInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelCloseInit is a paid mutator transaction binding the contract method 0x5447448d. -// -// Solidity: function updateClientAndChannelCloseInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelCloseInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelCloseInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenAck is a paid mutator transaction binding the contract method 0xc518ffc8. -// -// Solidity: function updateClientAndChannelOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelOpenAck(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelOpenAck", data1, data2) -} - -// UpdateClientAndChannelOpenAck is a paid mutator transaction binding the contract method 0xc518ffc8. -// -// Solidity: function updateClientAndChannelOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelOpenAck(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenAck(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenAck is a paid mutator transaction binding the contract method 0xc518ffc8. -// -// Solidity: function updateClientAndChannelOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelOpenAck(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenAck(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenConfirm is a paid mutator transaction binding the contract method 0x0982b806. -// -// Solidity: function updateClientAndChannelOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelOpenConfirm(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelOpenConfirm", data1, data2) -} - -// UpdateClientAndChannelOpenConfirm is a paid mutator transaction binding the contract method 0x0982b806. -// -// Solidity: function updateClientAndChannelOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelOpenConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenConfirm is a paid mutator transaction binding the contract method 0x0982b806. -// -// Solidity: function updateClientAndChannelOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelOpenConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenInit is a paid mutator transaction binding the contract method 0x66365fc4. -// -// Solidity: function updateClientAndChannelOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelOpenInit(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelOpenInit", data1, data2) -} - -// UpdateClientAndChannelOpenInit is a paid mutator transaction binding the contract method 0x66365fc4. -// -// Solidity: function updateClientAndChannelOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelOpenInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenInit is a paid mutator transaction binding the contract method 0x66365fc4. -// -// Solidity: function updateClientAndChannelOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelOpenInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenTry is a paid mutator transaction binding the contract method 0x33978088. -// -// Solidity: function updateClientAndChannelOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndChannelOpenTry(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndChannelOpenTry", data1, data2) -} - -// UpdateClientAndChannelOpenTry is a paid mutator transaction binding the contract method 0x33978088. -// -// Solidity: function updateClientAndChannelOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndChannelOpenTry(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenTry(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndChannelOpenTry is a paid mutator transaction binding the contract method 0x33978088. -// -// Solidity: function updateClientAndChannelOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndChannelOpenTry(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndChannelOpenTry(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenAck is a paid mutator transaction binding the contract method 0xfedb9353. -// -// Solidity: function updateClientAndConnectionOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndConnectionOpenAck(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndConnectionOpenAck", data1, data2) -} - -// UpdateClientAndConnectionOpenAck is a paid mutator transaction binding the contract method 0xfedb9353. -// -// Solidity: function updateClientAndConnectionOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndConnectionOpenAck(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenAck(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenAck is a paid mutator transaction binding the contract method 0xfedb9353. -// -// Solidity: function updateClientAndConnectionOpenAck(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndConnectionOpenAck(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenAck(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x70009dfc. -// -// Solidity: function updateClientAndConnectionOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndConnectionOpenConfirm(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndConnectionOpenConfirm", data1, data2) -} - -// UpdateClientAndConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x70009dfc. -// -// Solidity: function updateClientAndConnectionOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndConnectionOpenConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x70009dfc. -// -// Solidity: function updateClientAndConnectionOpenConfirm(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndConnectionOpenConfirm(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenConfirm(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenInit is a paid mutator transaction binding the contract method 0x491e69c7. -// -// Solidity: function updateClientAndConnectionOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndConnectionOpenInit(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndConnectionOpenInit", data1, data2) -} - -// UpdateClientAndConnectionOpenInit is a paid mutator transaction binding the contract method 0x491e69c7. -// -// Solidity: function updateClientAndConnectionOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndConnectionOpenInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenInit is a paid mutator transaction binding the contract method 0x491e69c7. -// -// Solidity: function updateClientAndConnectionOpenInit(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndConnectionOpenInit(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenInit(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenTry is a paid mutator transaction binding the contract method 0x5f3a7169. -// -// Solidity: function updateClientAndConnectionOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndConnectionOpenTry(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndConnectionOpenTry", data1, data2) -} - -// UpdateClientAndConnectionOpenTry is a paid mutator transaction binding the contract method 0x5f3a7169. -// -// Solidity: function updateClientAndConnectionOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndConnectionOpenTry(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenTry(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndConnectionOpenTry is a paid mutator transaction binding the contract method 0x5f3a7169. -// -// Solidity: function updateClientAndConnectionOpenTry(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndConnectionOpenTry(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndConnectionOpenTry(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndRecvPacket is a paid mutator transaction binding the contract method 0xd3cffc28. -// -// Solidity: function updateClientAndRecvPacket(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndRecvPacket(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndRecvPacket", data1, data2) -} - -// UpdateClientAndRecvPacket is a paid mutator transaction binding the contract method 0xd3cffc28. -// -// Solidity: function updateClientAndRecvPacket(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndRecvPacket(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndRecvPacket(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndRecvPacket is a paid mutator transaction binding the contract method 0xd3cffc28. -// -// Solidity: function updateClientAndRecvPacket(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndRecvPacket(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndRecvPacket(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndTimeout is a paid mutator transaction binding the contract method 0xca4c72a0. -// -// Solidity: function updateClientAndTimeout(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactor) UpdateClientAndTimeout(opts *bind.TransactOpts, data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.contract.Transact(opts, "updateClientAndTimeout", data1, data2) -} - -// UpdateClientAndTimeout is a paid mutator transaction binding the contract method 0xca4c72a0. -// -// Solidity: function updateClientAndTimeout(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsSession) UpdateClientAndTimeout(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndTimeout(&_RelayerFunctions.TransactOpts, data1, data2) -} - -// UpdateClientAndTimeout is a paid mutator transaction binding the contract method 0xca4c72a0. -// -// Solidity: function updateClientAndTimeout(bytes data1, bytes data2) payable returns(bool) -func (_RelayerFunctions *RelayerFunctionsTransactorSession) UpdateClientAndTimeout(data1 []byte, data2 []byte) (*types.Transaction, error) { - return _RelayerFunctions.Contract.UpdateClientAndTimeout(&_RelayerFunctions.TransactOpts, data1, data2) -} - // UpgradeClient is a paid mutator transaction binding the contract method 0x8a8e4c5d. // // Solidity: function upgradeClient(bytes data) payable returns(bytes) diff --git a/x/cronos/events/bindings/src/RelayerFunctions.sol b/x/cronos/events/bindings/src/RelayerFunctions.sol index f580fe5ccb..c413852aed 100644 --- a/x/cronos/events/bindings/src/RelayerFunctions.sol +++ b/x/cronos/events/bindings/src/RelayerFunctions.sol @@ -20,17 +20,6 @@ interface IRelayerFunctions { function acknowledgement(bytes calldata data) external payable returns (bytes calldata); function timeout(bytes calldata data) external payable returns (bytes calldata); function timeoutOnClose(bytes calldata data) external payable returns (bytes calldata); - function updateClientAndConnectionOpenInit(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndConnectionOpenTry(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndConnectionOpenAck(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndConnectionOpenConfirm(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelOpenInit(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelOpenTry(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelOpenAck(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelOpenConfirm(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndRecvPacket(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndAcknowledgement(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndTimeout(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelCloseInit(bytes calldata data1, bytes calldata data2) external payable returns (bool); - function updateClientAndChannelCloseConfirm(bytes calldata data1, bytes calldata data2) external payable returns (bool); + function registerPayee(string calldata portID, string calldata channelID, address payeeAddr) external payable returns (bool); + function registerCounterpartyPayee(string calldata portID, string calldata channelID, string calldata counterpartyPayeeAddr) external payable returns (bool); } diff --git a/x/cronos/keeper/precompiles/relayer.go b/x/cronos/keeper/precompiles/relayer.go index a16c90df71..84413057b7 100644 --- a/x/cronos/keeper/precompiles/relayer.go +++ b/x/cronos/keeper/precompiles/relayer.go @@ -1,7 +1,6 @@ package precompiles import ( - "context" "errors" "fmt" @@ -15,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/params" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" cronosevents "github.com/crypto-org-chain/cronos/v2/x/cronos/events" @@ -48,7 +48,9 @@ const ( Acknowledgement = "acknowledgement" Timeout = "timeout" TimeoutOnClose = "timeoutOnClose" - + // ibc fee + RegisterPayee = "registerPayee" + RegisterCounterpartyPayee = "registerCounterpartyPayee" GasWhenReceiverChainIsSource = 51705 GasWhenReceiverChainIsNotSource = 144025 ) @@ -91,6 +93,10 @@ func init() { relayerGasRequiredByMethod[methodID] = 61781 case Timeout: relayerGasRequiredByMethod[methodID] = 104283 + case RegisterPayee: + relayerGasRequiredByMethod[methodID] = 38000 + case RegisterCounterpartyPayee: + relayerGasRequiredByMethod[methodID] = 37000 default: relayerGasRequiredByMethod[methodID] = 100000 } @@ -101,18 +107,20 @@ func init() { type RelayerContract struct { BaseContract - cdc codec.Codec - ibcKeeper types.IbcKeeper - logger log.Logger - isHomestead bool - isIstanbul bool - isShanghai bool + cdc codec.Codec + ibcKeeper types.IbcKeeper + ibcFeeKeeper types.IbcFeeKeeper + logger log.Logger + isHomestead bool + isIstanbul bool + isShanghai bool } -func NewRelayerContract(ibcKeeper types.IbcKeeper, cdc codec.Codec, rules params.Rules, logger log.Logger) vm.PrecompiledContract { +func NewRelayerContract(ibcKeeper types.IbcKeeper, ibcFeeKeeper types.IbcFeeKeeper, cdc codec.Codec, rules params.Rules, logger log.Logger) vm.PrecompiledContract { return &RelayerContract{ BaseContract: NewBaseContract(relayerContractAddress), ibcKeeper: ibcKeeper, + ibcFeeKeeper: ibcFeeKeeper, cdc: cdc, isHomestead: rules.IsHomestead, isIstanbul: rules.IsIstanbul, @@ -191,8 +199,34 @@ func (bc *RelayerContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool if err != nil { return nil, errors.New("fail to unpack input arguments") } - input := args[0].([]byte) converter := cronosevents.RelayerConvertEvent + if method.Name == RegisterPayee || method.Name == RegisterCounterpartyPayee { + execErr := stateDB.ExecuteNativeAction(precompileAddr, converter, func(ctx sdk.Context) error { + portID := args[0].(string) + channelID := args[1].(string) + caller := sdk.AccAddress(contract.CallerAddress.Bytes()).String() + if method.Name == RegisterPayee { + payeeAddr := sdk.AccAddress(args[2].(common.Address).Bytes()).String() + _, err := bc.ibcFeeKeeper.RegisterPayee( + ctx, + ibcfeetypes.NewMsgRegisterPayee(portID, channelID, caller, payeeAddr), + ) + return err + } else { + counterpartyPayeeAddr := args[2].(string) + _, err := bc.ibcFeeKeeper.RegisterCounterpartyPayee( + ctx, + ibcfeetypes.NewMsgRegisterCounterpartyPayee(portID, channelID, caller, counterpartyPayeeAddr), + ) + return err + } + }) + if execErr != nil { + return nil, execErr + } + return method.Outputs.Pack(true) + } + input := args[0].([]byte) e := &Executor{ cdc: bc.cdc, stateDB: stateDB, @@ -231,15 +265,9 @@ func (bc *RelayerContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool case RecvPacket: res, err = exec(e, bc.ibcKeeper.RecvPacket) case Acknowledgement: - res, err = exec(e, func(goCtx context.Context, msg *channeltypes.MsgAcknowledgement) (*channeltypes.MsgAcknowledgementResponse, error) { - msg.Signer = sdk.AccAddress(evm.TxContext.Origin.Bytes()).String() - return bc.ibcKeeper.Acknowledgement(goCtx, msg) - }) + res, err = exec(e, bc.ibcKeeper.Acknowledgement) case Timeout: - res, err = exec(e, func(goCtx context.Context, msg *channeltypes.MsgTimeout) (*channeltypes.MsgTimeoutResponse, error) { - msg.Signer = sdk.AccAddress(evm.TxContext.Origin.Bytes()).String() - return bc.ibcKeeper.Timeout(goCtx, msg) - }) + res, err = exec(e, bc.ibcKeeper.Timeout) case TimeoutOnClose: res, err = exec(e, bc.ibcKeeper.TimeoutOnClose) default: diff --git a/x/cronos/types/interfaces.go b/x/cronos/types/interfaces.go index 25becabe1f..b303c4128c 100644 --- a/x/cronos/types/interfaces.go +++ b/x/cronos/types/interfaces.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/params" evmtypes "github.com/evmos/ethermint/x/evm/types" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -94,3 +95,8 @@ type IbcKeeper interface { Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (*channeltypes.MsgTimeoutResponse, error) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTimeoutOnClose) (*channeltypes.MsgTimeoutOnCloseResponse, error) } + +type IbcFeeKeeper interface { + RegisterPayee(goCtx context.Context, msg *ibcfeetypes.MsgRegisterPayee) (*ibcfeetypes.MsgRegisterPayeeResponse, error) + RegisterCounterpartyPayee(goCtx context.Context, msg *ibcfeetypes.MsgRegisterCounterpartyPayee) (*ibcfeetypes.MsgRegisterCounterpartyPayeeResponse, error) +}