From 60f122c1ed52ca09c18a7c45174c3ef2e04924c5 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 26 Nov 2025 13:17:39 -0800 Subject: [PATCH 01/14] tracing wip --- evmd/app.go | 2 + evmd/go.mod | 61 +++++-- evmd/go.sum | 127 +++++++++---- go.mod | 68 ++++--- go.sum | 135 ++++++++++---- rpc/backend/account_info.go | 76 +++++--- rpc/backend/backend.go | 140 +++++++-------- rpc/backend/blocks.go | 96 ++++++---- rpc/backend/call_tx.go | 111 ++++++++---- rpc/backend/chain_info.go | 87 ++++++--- rpc/backend/comet.go | 55 ++++-- rpc/backend/comet_to_eth.go | 87 ++++++--- rpc/backend/filters.go | 30 +++- rpc/backend/headers.go | 51 ++++-- rpc/backend/node_info.go | 29 +-- rpc/backend/sign_tx.go | 27 ++- rpc/backend/tracer.go | 5 + rpc/backend/tracing.go | 48 +++-- rpc/backend/tx_info.go | 170 ++++++++++++------ rpc/backend/tx_info_test.go | 5 +- rpc/backend/tx_pool.go | 31 ++-- rpc/backend/utils.go | 19 +- rpc/namespaces/ethereum/debug/api.go | 59 ++++-- rpc/namespaces/ethereum/eth/api.go | 150 +++++++++++----- rpc/namespaces/ethereum/eth/filters/api.go | 26 ++- .../ethereum/eth/filters/filters.go | 16 +- rpc/namespaces/ethereum/miner/api.go | 15 +- rpc/namespaces/ethereum/net/api.go | 11 +- rpc/namespaces/ethereum/personal/api.go | 33 +++- rpc/namespaces/ethereum/txpool/api.go | 23 ++- rpc/types/block.go | 13 +- rpc/types/utils.go | 6 + server/start.go | 2 + .../rpc/backend/test_account_info.go | 14 +- .../rpc/backend/test_backend_suite.go | 13 +- tests/integration/rpc/backend/test_blocks.go | 40 ++--- tests/integration/rpc/backend/test_call_tx.go | 12 +- .../rpc/backend/test_chain_info.go | 16 +- tests/integration/rpc/backend/test_filters.go | 4 +- .../integration/rpc/backend/test_node_info.go | 14 +- tests/integration/rpc/backend/test_sign_tx.go | 10 +- tests/integration/rpc/backend/test_tracing.go | 8 +- tests/integration/rpc/backend/test_tx_info.go | 28 +-- tests/speedtest/go.mod | 4 +- tests/speedtest/go.sum | 8 +- tests/systemtests/go.mod | 16 +- tests/systemtests/go.sum | 68 ++++--- x/vm/keeper/state_transition.go | 9 + 48 files changed, 1390 insertions(+), 688 deletions(-) create mode 100644 rpc/backend/tracer.go diff --git a/evmd/app.go b/evmd/app.go index a4bfe0be1..3623f57ce 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -128,6 +128,8 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" cosmosevmserver "github.com/cosmos/evm/server" + + _ "github.com/cosmos/cosmos-sdk/telemetry" ) func init() { diff --git a/evmd/go.mod b/evmd/go.mod index 687d63fa3..bb64a96f5 100644 --- a/evmd/go.mod +++ b/evmd/go.mod @@ -29,7 +29,7 @@ require ( github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 golang.org/x/sync v0.18.0 - google.golang.org/grpc v1.76.0 + google.golang.org/grpc v1.77.0 ) require ( @@ -37,7 +37,7 @@ require ( cloud.google.com/go v0.122.0 // indirect cloud.google.com/go/auth v0.16.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.8.0 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect cloud.google.com/go/iam v1.5.2 // indirect cloud.google.com/go/monitoring v1.24.2 // indirect cloud.google.com/go/storage v1.56.1 // indirect @@ -50,7 +50,7 @@ require ( github.com/99designs/keyring v1.2.2 // indirect github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.7 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect @@ -76,7 +76,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect - github.com/bits-and-blooms/bitset v1.24.3 // indirect + github.com/bits-and-blooms/bitset v1.24.4 // indirect github.com/btcsuite/btcd v0.24.2 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect github.com/btcsuite/btcd/btcutil v1.1.6 // indirect @@ -85,10 +85,11 @@ require ( github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cloudwego/base64x v0.1.6 // indirect - github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect + github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.12.0 // indirect github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect @@ -120,8 +121,9 @@ require ( github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect + github.com/ebitengine/purego v0.8.4 // indirect github.com/emicklei/dot v1.8.0 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect github.com/ethereum/go-verkle v0.2.2 // indirect @@ -130,7 +132,7 @@ require ( github.com/ferranbt/fastssz v0.1.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/getsentry/sentry-go v0.35.0 // indirect - github.com/go-jose/go-jose/v4 v4.1.2 // indirect + github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.1 // indirect @@ -158,8 +160,10 @@ require ( github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -188,6 +192,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/linxGnu/grocksdb v1.10.3 // indirect + github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -212,9 +217,11 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -224,9 +231,10 @@ require ( github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sasha-s/go-deadlock v0.3.6 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shirou/gopsutil/v4 v4.25.7 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect - github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect + github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.16 // indirect @@ -243,20 +251,38 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.15 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - github.com/zeebo/errs v1.4.0 // indirect github.com/zondax/golem v0.27.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v1.0.1 // indirect go.etcd.io/bbolt v1.4.0 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/host v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 // indirect + go.opentelemetry.io/contrib/otelconf v0.18.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.37.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect + go.opentelemetry.io/otel/log v0.14.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -264,10 +290,10 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.21.0 // indirect - golang.org/x/crypto v0.44.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/net v0.46.0 // indirect - golang.org/x/oauth2 v0.31.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/oauth2 v0.32.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/text v0.31.0 // indirect @@ -275,8 +301,8 @@ require ( golang.org/x/tools v0.38.0 // indirect google.golang.org/api v0.247.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -290,6 +316,7 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/cosmos/cosmos-sdk => ../../cosmos-sdk github.com/cosmos/evm => ../ // use Cosmos geth fork // branch: release/1.16 diff --git a/evmd/go.sum b/evmd/go.sum index c8d5bb837..45727e252 100644 --- a/evmd/go.sum +++ b/evmd/go.sum @@ -8,8 +8,8 @@ cloud.google.com/go/auth v0.16.5 h1:mFWNQ2FEVWAliEQWpAdH80omXFokmrnbDhUS9cBywsI= cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gCc2dUhQ= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute/metadata v0.8.0 h1:HxMRIbao8w17ZX6wBnjhcDkW6lTFpgcaobyVfZWqRLA= -cloud.google.com/go/compute/metadata v0.8.0/go.mod h1:sYOGTp851OV9bOFJ9CH7elVvyzopvWQFNNghtDQ/Biw= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8= cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE= cloud.google.com/go/logging v1.13.0 h1:7j0HgAp0B94o1YRDqiqm26w4q1rDMH7XNRU34lJXHYc= @@ -66,8 +66,8 @@ github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bp github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.7 h1:ybO8RBeh29qrxIhCA9E8gKY6xfONU9T6G6aP9DTKfLE= github.com/DataDog/zstd v1.5.7/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 h1:UQUsRi8WTzhZntp5313l+CHIAT95ojUI2lpP/ExlZa4= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0/go.mod h1:Cz6ft6Dkn3Et6l2v2a9/RpN7epQ1GtDlO6lj8bEcOvw= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 h1:sBEjpZlNHzK1voKq9695PJSX2o5NEXl7/OL3coiIY0c= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 h1:owcC2UnmsZycprQ5RfRgjydWhuoxg71LUfyiQdijZuM= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0/go.mod h1:ZPpqegjbE99EPKsu3iUWV22A04wzGPcAY/ziSIQEEgs= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.53.0 h1:4LP6hvB4I5ouTbGgWtixJhgED6xdf67twf9PoY96Tbg= @@ -153,8 +153,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.24.3 h1:Bte86SlO3lwPQqww+7BE9ZuUCKIjfqnG5jtEyqA9y9Y= -github.com/bits-and-blooms/bitset v1.24.3/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.24.4 h1:95H15Og1clikBrKr/DuzMXkQzECs1M6hhoGXLwLQOZE= +github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= @@ -198,6 +198,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -232,8 +234,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y+bSQAYZnetRJ70VMVKm5CKI0= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -272,8 +274,6 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0 h1:KOyM1CjuriSxMm2CNhceGfEc2LbRWuImKw7L9yp3+SM= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= @@ -356,6 +356,8 @@ github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= +github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.8.0 h1:HnD60yAKFAevNeT+TPYr9pb8VB9bqdeSo0nzwIW6IOI= github.com/emicklei/dot v1.8.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= @@ -366,10 +368,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M= -github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA= -github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A= -github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw= +github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329 h1:K+fnvUM0VZ7ZFJf0n4L/BRlnsb9pL/GuDG6FqaH+PwM= +github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329/go.mod h1:Alz8LEClvR7xKsrq3qzoc4N0guvVNSS8KmSChGYr9hs= +github.com/envoyproxy/go-control-plane/envoy v1.35.0 h1:ixjkELDE+ru6idPxcHLj8LBVc2bFP7iBytj353BoHUo= +github.com/envoyproxy/go-control-plane/envoy v1.35.0/go.mod h1:09qwbGVuSWWAyN5t/b3iyVfz5+z8QWGrzkoqm/8SbEs= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -408,8 +410,8 @@ github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SU github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI= -github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -543,6 +545,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -553,6 +557,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 h1:81+kWbE1yErFBMjME0I5k3x3kojjKsWtPYHEAutoPow= @@ -693,6 +699,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.10.3 h1:0laII9AQ6kFxo5SjhdTfSh9EgF20piD6TMHK6YuDm+4= github.com/linxGnu/grocksdb v1.10.3/go.mod h1:OLQKZwiKwaJiAVCsOzWKvwiLwfZ5Vz8Md5TYR7t7pM8= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -841,6 +849,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -867,8 +877,10 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= +github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= 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= @@ -910,6 +922,8 @@ github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGT github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM= +github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -937,8 +951,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= -github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE= -github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g= +github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= +github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1007,8 +1021,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM= -github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/zondax/golem v0.27.0 h1:IbBjGIXF3SoGOZHsILJvIM/F/ylwJzMcHAcggiqniPw= github.com/zondax/golem v0.27.0/go.mod h1:AmorCgJPt00L8xN1VrMBe13PSifoZksnQ1Ge906bu4A= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= @@ -1022,27 +1034,65 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0 h1:F7q2tNlCaHY9nMKHR6XH9/qkp8FktLnIcy6jJNyOCQw= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0/go.mod h1:IbBN8uAIIx734PTonTPxAxnjc2pQTxWNkwfstZ+6H2k= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY6LiIY9I8cUfm+pJs= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0 h1:zsaUrWypCf0NtYSUby+/BS6QqhXVNxMQD5w4dLczKCQ= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0/go.mod h1:Ru+kuFO+ToZqBKwI59rCStOhW6LWrbGisYrFaX61bJk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/contrib/otelconf v0.18.0 h1:ciF2Gf00BWs0DnexKFZXcxg9kJ8r3SUW1LOzW3CsKA8= +go.opentelemetry.io/contrib/otelconf v0.18.0/go.mod h1:FcP7k+JLwBLdOxS6qY6VQ/4b5VBntI6L6o80IMwhAeI= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 h1:pW+qDVo0jB0rLsNeaP85xLuz20cvsECUcN7TE+D8YTM= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0/go.mod h1:x7bd+t034hxLTve1hF9Yn9qQJlO/pP8H5pWIt7+gsFM= go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 h1:QQqYw3lkrzwVsoEX0w//EhH/TCnpRdEenKBOOEIMjWc= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0/go.mod h1:gSVQcr17jk2ig4jqJ2DX30IdWH251JcNAecvrqTxH1s= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 h1:Oe2z/BCg5q7k4iXC3cqJxKYg0ieRiOqF0cecFYdPTwk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0/go.mod h1:ZQM5lAJpOsKnYagGg/zV2krVqTtaVdYdDkhMoX6Oalg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 h1:B/g+qde6Mkzxbry5ZZag0l7QrQBCtVm7lVjaLgmpje8= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0/go.mod h1:mOJK8eMmgW6ocDJn6Bn11CcZ05gi3P8GylBXEkZtbgA= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg= +go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1087,8 +1137,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -1143,13 +1193,13 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= -golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= -golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= +golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= 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= @@ -1197,6 +1247,7 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1301,10 +1352,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 h1:M1rk8KBnUsBDg1oPGHNCxG4vc1f49epmTO7xscSajMk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= 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= @@ -1322,8 +1373,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/go.mod b/go.mod index b2a404df2..e5106d496 100644 --- a/go.mod +++ b/go.mod @@ -47,13 +47,17 @@ require ( github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 github.com/zondax/hid v0.9.2 + go.opencensus.io v0.24.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/trace v1.38.0 go.uber.org/mock v0.6.0 - golang.org/x/crypto v0.44.0 - golang.org/x/net v0.46.0 + golang.org/x/crypto v0.45.0 + golang.org/x/net v0.47.0 golang.org/x/sync v0.18.0 golang.org/x/text v0.31.0 - google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 - google.golang.org/grpc v1.76.0 + google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 + google.golang.org/grpc v1.77.0 google.golang.org/protobuf v1.36.10 sigs.k8s.io/yaml v1.6.0 ) @@ -63,7 +67,7 @@ require ( cloud.google.com/go v0.122.0 // indirect cloud.google.com/go/auth v0.16.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.8.0 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect cloud.google.com/go/iam v1.5.2 // indirect cloud.google.com/go/monitoring v1.24.2 // indirect cloud.google.com/go/storage v1.56.1 // indirect @@ -76,7 +80,7 @@ require ( github.com/99designs/keyring v1.2.2 // indirect github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.7 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect @@ -102,17 +106,18 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect - github.com/bits-and-blooms/bitset v1.24.3 // indirect + github.com/bits-and-blooms/bitset v1.24.4 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cloudwego/base64x v0.1.6 // indirect - github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect + github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect github.com/cockroachdb/errors v1.12.0 // indirect github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect @@ -136,8 +141,9 @@ require ( github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect + github.com/ebitengine/purego v0.8.4 // indirect github.com/emicklei/dot v1.8.0 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect github.com/ethereum/go-verkle v0.2.2 // indirect @@ -146,7 +152,7 @@ require ( github.com/ferranbt/fastssz v0.1.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/getsentry/sentry-go v0.35.0 // indirect - github.com/go-jose/go-jose/v4 v4.1.2 // indirect + github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.1 // indirect @@ -158,6 +164,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect + github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/snappy v1.0.0 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v25.2.10+incompatible // indirect @@ -169,7 +176,9 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect github.com/googleapis/gax-go/v2 v2.15.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -194,6 +203,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect + github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -217,9 +227,11 @@ require ( github.com/pion/transport/v3 v3.0.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -228,10 +240,11 @@ require ( github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sasha-s/go-deadlock v0.3.6 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shirou/gopsutil/v4 v4.25.7 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect + github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.16 // indirect @@ -245,20 +258,34 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ulikunitz/xz v0.5.15 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - github.com/zeebo/errs v1.4.0 // indirect github.com/zondax/golem v0.27.0 // indirect github.com/zondax/ledger-go v1.0.1 // indirect go.etcd.io/bbolt v1.4.0 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect + go.opentelemetry.io/contrib/instrumentation/host v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect - go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 // indirect + go.opentelemetry.io/contrib/otelconf v0.18.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.37.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect + go.opentelemetry.io/otel/log v0.14.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect - go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect @@ -266,14 +293,14 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.21.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/oauth2 v0.31.0 // indirect + golang.org/x/oauth2 v0.32.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/time v0.13.0 // indirect golang.org/x/tools v0.38.0 // indirect google.golang.org/api v0.247.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.2 // indirect @@ -285,6 +312,7 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/cosmos/cosmos-sdk => ../cosmos-sdk // use Cosmos geth fork // branch: release/1.16 github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v1.16.2-cosmos-1 diff --git a/go.sum b/go.sum index 77dff5330..de90e9c77 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ cloud.google.com/go/auth v0.16.5 h1:mFWNQ2FEVWAliEQWpAdH80omXFokmrnbDhUS9cBywsI= cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gCc2dUhQ= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute/metadata v0.8.0 h1:HxMRIbao8w17ZX6wBnjhcDkW6lTFpgcaobyVfZWqRLA= -cloud.google.com/go/compute/metadata v0.8.0/go.mod h1:sYOGTp851OV9bOFJ9CH7elVvyzopvWQFNNghtDQ/Biw= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8= cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE= cloud.google.com/go/logging v1.13.0 h1:7j0HgAp0B94o1YRDqiqm26w4q1rDMH7XNRU34lJXHYc= @@ -64,8 +64,8 @@ github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bp github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.7 h1:ybO8RBeh29qrxIhCA9E8gKY6xfONU9T6G6aP9DTKfLE= github.com/DataDog/zstd v1.5.7/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 h1:UQUsRi8WTzhZntp5313l+CHIAT95ojUI2lpP/ExlZa4= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0/go.mod h1:Cz6ft6Dkn3Et6l2v2a9/RpN7epQ1GtDlO6lj8bEcOvw= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 h1:sBEjpZlNHzK1voKq9695PJSX2o5NEXl7/OL3coiIY0c= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 h1:owcC2UnmsZycprQ5RfRgjydWhuoxg71LUfyiQdijZuM= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0/go.mod h1:ZPpqegjbE99EPKsu3iUWV22A04wzGPcAY/ziSIQEEgs= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.53.0 h1:4LP6hvB4I5ouTbGgWtixJhgED6xdf67twf9PoY96Tbg= @@ -151,8 +151,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.24.3 h1:Bte86SlO3lwPQqww+7BE9ZuUCKIjfqnG5jtEyqA9y9Y= -github.com/bits-and-blooms/bitset v1.24.3/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.24.4 h1:95H15Og1clikBrKr/DuzMXkQzECs1M6hhoGXLwLQOZE= +github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= @@ -196,6 +196,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -227,8 +229,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y+bSQAYZnetRJ70VMVKm5CKI0= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -267,8 +269,6 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0 h1:KOyM1CjuriSxMm2CNhceGfEc2LbRWuImKw7L9yp3+SM= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= @@ -343,6 +343,8 @@ github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= +github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.8.0 h1:HnD60yAKFAevNeT+TPYr9pb8VB9bqdeSo0nzwIW6IOI= github.com/emicklei/dot v1.8.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= @@ -353,10 +355,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M= -github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA= -github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A= -github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw= +github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329 h1:K+fnvUM0VZ7ZFJf0n4L/BRlnsb9pL/GuDG6FqaH+PwM= +github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329/go.mod h1:Alz8LEClvR7xKsrq3qzoc4N0guvVNSS8KmSChGYr9hs= +github.com/envoyproxy/go-control-plane/envoy v1.35.0 h1:ixjkELDE+ru6idPxcHLj8LBVc2bFP7iBytj353BoHUo= +github.com/envoyproxy/go-control-plane/envoy v1.35.0/go.mod h1:09qwbGVuSWWAyN5t/b3iyVfz5+z8QWGrzkoqm/8SbEs= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -395,8 +397,8 @@ github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SU github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI= -github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -452,6 +454,9 @@ github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 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-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= @@ -488,6 +493,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -527,6 +533,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -537,6 +545,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 h1:81+kWbE1yErFBMjME0I5k3x3kojjKsWtPYHEAutoPow= @@ -674,6 +684,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.10.3 h1:0laII9AQ6kFxo5SjhdTfSh9EgF20piD6TMHK6YuDm+4= github.com/linxGnu/grocksdb v1.10.3/go.mod h1:OLQKZwiKwaJiAVCsOzWKvwiLwfZ5Vz8Md5TYR7t7pM8= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -822,6 +834,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -848,8 +862,10 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= +github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= 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= @@ -890,6 +906,8 @@ github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGT github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM= +github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -917,8 +935,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= -github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE= -github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g= +github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= +github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -987,8 +1005,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM= -github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/zondax/golem v0.27.0 h1:IbBjGIXF3SoGOZHsILJvIM/F/ylwJzMcHAcggiqniPw= github.com/zondax/golem v0.27.0/go.mod h1:AmorCgJPt00L8xN1VrMBe13PSifoZksnQ1Ge906bu4A= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= @@ -1002,27 +1018,67 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0 h1:F7q2tNlCaHY9nMKHR6XH9/qkp8FktLnIcy6jJNyOCQw= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0/go.mod h1:IbBN8uAIIx734PTonTPxAxnjc2pQTxWNkwfstZ+6H2k= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY6LiIY9I8cUfm+pJs= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0 h1:zsaUrWypCf0NtYSUby+/BS6QqhXVNxMQD5w4dLczKCQ= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0/go.mod h1:Ru+kuFO+ToZqBKwI59rCStOhW6LWrbGisYrFaX61bJk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/contrib/otelconf v0.18.0 h1:ciF2Gf00BWs0DnexKFZXcxg9kJ8r3SUW1LOzW3CsKA8= +go.opentelemetry.io/contrib/otelconf v0.18.0/go.mod h1:FcP7k+JLwBLdOxS6qY6VQ/4b5VBntI6L6o80IMwhAeI= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 h1:pW+qDVo0jB0rLsNeaP85xLuz20cvsECUcN7TE+D8YTM= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0/go.mod h1:x7bd+t034hxLTve1hF9Yn9qQJlO/pP8H5pWIt7+gsFM= go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 h1:QQqYw3lkrzwVsoEX0w//EhH/TCnpRdEenKBOOEIMjWc= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0/go.mod h1:gSVQcr17jk2ig4jqJ2DX30IdWH251JcNAecvrqTxH1s= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 h1:Oe2z/BCg5q7k4iXC3cqJxKYg0ieRiOqF0cecFYdPTwk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0/go.mod h1:ZQM5lAJpOsKnYagGg/zV2krVqTtaVdYdDkhMoX6Oalg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 h1:B/g+qde6Mkzxbry5ZZag0l7QrQBCtVm7lVjaLgmpje8= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0/go.mod h1:mOJK8eMmgW6ocDJn6Bn11CcZ05gi3P8GylBXEkZtbgA= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg= +go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1067,8 +1123,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -1113,6 +1169,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1123,13 +1180,13 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= -golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= -golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= +golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= 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= @@ -1177,6 +1234,7 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1281,10 +1339,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 h1:M1rk8KBnUsBDg1oPGHNCxG4vc1f49epmTO7xscSajMk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= 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= @@ -1299,11 +1357,12 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 9bbaff660..1ecda5d73 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" "math" "math/big" @@ -8,6 +9,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "github.com/cometbft/cometbft/libs/bytes" @@ -23,17 +26,22 @@ import ( ) // GetCode returns the contract code at the given address and block number. -func (b *Backend) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) +func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (bz hexutil.Bytes, err error) { + ctx, span := tracer.Start(ctx, "GetCode", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } + ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) req := &evmtypes.QueryCodeRequest{ Address: address.String(), } - res, err := b.QueryClient.Code(rpctypes.ContextWithHeight(blockNum.Int64()), req) + res, err := b.QueryClient.Code(ctx, req) if err != nil { return nil, err } @@ -42,15 +50,19 @@ func (b *Backend) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNu } // GetProof returns an account object with proof and any storage proofs -func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error) { - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) +func (b *Backend) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (result *rpctypes.AccountResult, err error) { + ctx, span := tracer.Start(ctx, "GetProof", trace.WithAttributes(attribute.String("address", address.String()), attribute.StringSlice("storageKeys", storageKeys), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } height := int64(blockNum) - _, err = b.CometHeaderByNumber(blockNum) + _, err = b.CometHeaderByNumber(ctx, blockNum) if err != nil { // the error message imitates geth behavior return nil, errors.New("header not found") @@ -58,7 +70,7 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr // if the height is equal to zero, meaning the query condition of the block is either "pending" or "latest" if height == 0 { - bn, err := b.BlockNumber() + bn, err := b.BlockNumber(ctx) if err != nil { return nil, err } @@ -70,8 +82,8 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr height = int64(bn) //#nosec G115 -- checked for int overflow already } - ctx := rpctypes.ContextWithHeight(height) - clientCtx := b.ClientCtx.WithHeight(height) + ctx = rpctypes.ContextWithHeight(height, ctx) + clientCtx := b.ClientCtx.WithHeight(height).WithCmdContext(ctx) // query storage proofs storageProofs := make([]rpctypes.StorageResult, len(storageKeys)) @@ -124,18 +136,23 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr } // GetStorageAt returns the contract storage at the given address, block number, and key. -func (b *Backend) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) +func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (result hexutil.Bytes, err error) { + ctx, span := tracer.Start(ctx, "GetStorageAt", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("key", key), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } + ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) req := &evmtypes.QueryStorageRequest{ Address: address.String(), Key: key, } - res, err := b.QueryClient.Storage(rpctypes.ContextWithHeight(blockNum.Int64()), req) + res, err := b.QueryClient.Storage(ctx, req) if err != nil { return nil, err } @@ -145,22 +162,27 @@ func (b *Backend) GetStorageAt(address common.Address, key string, blockNrOrHash } // GetBalance returns the provided account's *spendable* balance up to the provided block number. -func (b *Backend) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error) { - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) +func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (result *hexutil.Big, err error) { + ctx, span := tracer.Start(ctx, "GetBalance", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } + ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) req := &evmtypes.QueryBalanceRequest{ Address: address.String(), } - _, err = b.CometHeaderByNumber(blockNum) + _, err = b.CometHeaderByNumber(ctx, blockNum) if err != nil { return nil, err } - res, err := b.QueryClient.Balance(rpctypes.ContextWithHeight(blockNum.Int64()), req) + res, err := b.QueryClient.Balance(ctx, req) if err != nil { return nil, err } @@ -179,9 +201,13 @@ func (b *Backend) GetBalance(address common.Address, blockNrOrHash rpctypes.Bloc } // GetTransactionCount returns the number of transactions at the given address up to the given block number. -func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes.BlockNumber) (*hexutil.Uint64, error) { +func (b *Backend) GetTransactionCount(ctx context.Context, address common.Address, blockNum rpctypes.BlockNumber) (result *hexutil.Uint64, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionCount", trace.WithAttributes(attribute.String("address", address.String()), attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + n := hexutil.Uint64(0) - bn, err := b.BlockNumber() + bn, err := b.BlockNumber(ctx) if err != nil { return &n, err } @@ -199,14 +225,14 @@ func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes. from := sdk.AccAddress(address.Bytes()) accRet := b.ClientCtx.AccountRetriever - err = accRet.EnsureExists(b.ClientCtx, from) + err = accRet.EnsureExists(b.ClientCtx.WithCmdContext(ctx), from) if err != nil { // account doesn't exist yet, return 0 return &n, nil } includePending := blockNum == rpctypes.EthPendingBlockNumber - nonce, err := b.getAccountNonce(address, includePending, blockNum.Int64(), b.Logger) + nonce, err := b.getAccountNonce(ctx, address, includePending, blockNum.Int64(), b.Logger) if err != nil { return nil, err } @@ -214,3 +240,13 @@ func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes. n = hexutil.Uint64(nonce) return &n, nil } + +func unwrapBlockNOrHash(blockNOrHash rpctypes.BlockNumberOrHash) string { + if blockNOrHash.BlockHash != nil { + return blockNOrHash.BlockHash.String() + } + if blockNOrHash.BlockNumber != nil { + return fmt.Sprintf("%d", *blockNOrHash.BlockNumber) + } + return "" +} diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 06079229d..c9ec34ded 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -44,13 +44,13 @@ type BackendI interface { //nolint: revive // Implemented by Backend. type EVMBackend interface { // Node specific queries - Accounts() ([]common.Address, error) - Syncing() (interface{}, error) - SetEtherbase(etherbase common.Address) bool - SetGasPrice(gasPrice hexutil.Big) bool - ImportRawKey(privkey, password string) (common.Address, error) - ListAccounts() ([]common.Address, error) - NewMnemonic(uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error) + Accounts(ctx context.Context) ([]common.Address, error) + Syncing(ctx context.Context) (interface{}, error) + SetEtherbase(ctx context.Context, etherbase common.Address) bool + SetGasPrice(ctx context.Context, gasPrice hexutil.Big) bool + ImportRawKey(ctx context.Context, privkey, password string) (common.Address, error) + ListAccounts(ctx context.Context) ([]common.Address, error) + NewMnemonic(ctx context.Context, uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error) UnprotectedAllowed() bool RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection @@ -58,83 +58,83 @@ type EVMBackend interface { RPCMinGasPrice() *big.Int // Sign Tx - Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) - SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) - SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) + Sign(ctx context.Context, address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) + SendTransaction(ctx context.Context, args evmtypes.TransactionArgs) (common.Hash, error) + SignTypedData(ctx context.Context, address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) // Blocks Info - BlockNumber() (hexutil.Uint64, error) - GetHeaderByNumber(blockNum types.BlockNumber) (map[string]interface{}, error) - GetHeaderByHash(hash common.Hash) (map[string]interface{}, error) - GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) - GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) - GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint - GetBlockTransactionCountByNumber(blockNum types.BlockNumber) *hexutil.Uint - CometBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) - CometBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) - BlockNumberFromComet(blockNrOrHash types.BlockNumberOrHash) (types.BlockNumber, error) - BlockNumberFromCometByHash(blockHash common.Hash) (*big.Int, error) - EthMsgsFromCometBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx - BlockBloomFromCometBlock(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error) - HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) - HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) - RPCBlockFromCometBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, fullTx bool) (map[string]interface{}, error) - EthBlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) - EthBlockFromCometBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*ethtypes.Block, error) - GetBlockReceipts(blockNrOrHash types.BlockNumberOrHash) ([]map[string]interface{}, error) + BlockNumber(ctx context.Context) (hexutil.Uint64, error) + GetHeaderByNumber(ctx context.Context, blockNum types.BlockNumber) (map[string]interface{}, error) + GetHeaderByHash(ctx context.Context, hash common.Hash) (map[string]interface{}, error) + GetBlockByNumber(ctx context.Context, blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) + GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error) + GetBlockTransactionCountByHash(ctx context.Context, hash common.Hash) *hexutil.Uint + GetBlockTransactionCountByNumber(ctx context.Context, blockNum types.BlockNumber) *hexutil.Uint + CometBlockByNumber(ctx context.Context, blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) + CometBlockByHash(ctx context.Context, blockHash common.Hash) (*tmrpctypes.ResultBlock, error) + BlockNumberFromComet(ctx context.Context, blockNrOrHash types.BlockNumberOrHash) (types.BlockNumber, error) + BlockNumberFromCometByHash(ctx context.Context, blockHash common.Hash) (*big.Int, error) + EthMsgsFromCometBlock(ctx context.Context, block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx + BlockBloomFromCometBlock(ctx context.Context, blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error) + HeaderByNumber(ctx context.Context, blockNum types.BlockNumber) (*ethtypes.Header, error) + HeaderByHash(ctx context.Context, blockHash common.Hash) (*ethtypes.Header, error) + RPCBlockFromCometBlock(ctx context.Context, resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, fullTx bool) (map[string]interface{}, error) + EthBlockByNumber(ctx context.Context, blockNum types.BlockNumber) (*ethtypes.Block, error) + EthBlockFromCometBlock(ctx context.Context, resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*ethtypes.Block, error) + GetBlockReceipts(ctx context.Context, blockNrOrHash types.BlockNumberOrHash) ([]map[string]interface{}, error) // Account Info - GetCode(address common.Address, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) - GetBalance(address common.Address, blockNrOrHash types.BlockNumberOrHash) (*hexutil.Big, error) - GetStorageAt(address common.Address, key string, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) - GetProof(address common.Address, storageKeys []string, blockNrOrHash types.BlockNumberOrHash) (*types.AccountResult, error) - GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) + GetCode(ctx context.Context, address common.Address, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) + GetBalance(ctx context.Context, address common.Address, blockNrOrHash types.BlockNumberOrHash) (*hexutil.Big, error) + GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) + GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash types.BlockNumberOrHash) (*types.AccountResult, error) + GetTransactionCount(ctx context.Context, address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) // Chain Info - ChainID() (*hexutil.Big, error) - ChainConfig() *params.ChainConfig - GlobalMinGasPrice() (*big.Int, error) - BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error) - CurrentHeader() (*ethtypes.Header, error) - PendingTransactions() ([]*sdk.Tx, error) - GetCoinbase() (sdk.AccAddress, error) - FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) - SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) + ChainID(ctx context.Context) (*hexutil.Big, error) + ChainConfig(ctx context.Context) *params.ChainConfig + GlobalMinGasPrice(ctx context.Context) (*big.Int, error) + BaseFee(ctx context.Context, blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error) + CurrentHeader(ctx context.Context) (*ethtypes.Header, error) + PendingTransactions(ctx context.Context) ([]*sdk.Tx, error) + GetCoinbase(ctx context.Context) (sdk.AccAddress, error) + FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) + SuggestGasTipCap(ctx context.Context, baseFee *big.Int) (*big.Int, error) // Tx Info - GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) - GetTxByEthHash(txHash common.Hash) (*servertypes.TxResult, error) - GetTxByTxIndex(height int64, txIndex uint) (*servertypes.TxResult, error) - GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*types.RPCTransaction, error) - GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) - GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) - GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*types.RPCTransaction, error) - GetTransactionByBlockNumberAndIndex(blockNum types.BlockNumber, idx hexutil.Uint) (*types.RPCTransaction, error) - CreateAccessList(args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, overrides *json.RawMessage) (*types.AccessListResult, error) + GetTransactionByHash(ctx context.Context, txHash common.Hash) (*types.RPCTransaction, error) + GetTxByEthHash(ctx context.Context, txHash common.Hash) (*servertypes.TxResult, error) + GetTxByTxIndex(ctx context.Context, height int64, txIndex uint) (*servertypes.TxResult, error) + GetTransactionByBlockAndIndex(ctx context.Context, block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*types.RPCTransaction, error) + GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) + GetTransactionLogs(ctx context.Context, hash common.Hash) ([]*ethtypes.Log, error) + GetTransactionByBlockHashAndIndex(ctx context.Context, hash common.Hash, idx hexutil.Uint) (*types.RPCTransaction, error) + GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNum types.BlockNumber, idx hexutil.Uint) (*types.RPCTransaction, error) + CreateAccessList(ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, overrides *json.RawMessage) (*types.AccessListResult, error) // Send Transaction - Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) - SendRawTransaction(data hexutil.Bytes) (common.Hash, error) - SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) - EstimateGas(args evmtypes.TransactionArgs, blockNrOrHash *types.BlockNumberOrHash, overrides *json.RawMessage) (hexutil.Uint64, error) - DoCall(args evmtypes.TransactionArgs, blockNr types.BlockNumber, overrides *json.RawMessage) (*evmtypes.MsgEthereumTxResponse, error) - GasPrice() (*hexutil.Big, error) + Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) + SendRawTransaction(ctx context.Context, data hexutil.Bytes) (common.Hash, error) + SetTxDefaults(ctx context.Context, args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) + EstimateGas(ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash *types.BlockNumberOrHash, overrides *json.RawMessage) (hexutil.Uint64, error) + DoCall(ctx context.Context, args evmtypes.TransactionArgs, blockNr types.BlockNumber, overrides *json.RawMessage) (*evmtypes.MsgEthereumTxResponse, error) + GasPrice(ctx context.Context) (*hexutil.Big, error) // Filter API - GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) - GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) - BloomStatus() (uint64, uint64) + GetLogs(ctx context.Context, hash common.Hash) ([][]*ethtypes.Log, error) + GetLogsByHeight(ctx context.Context, height *int64) ([][]*ethtypes.Log, error) + BloomStatus(ctx context.Context) (uint64, uint64) // TxPool API - Content() (map[string]map[string]map[string]*types.RPCTransaction, error) - ContentFrom(address common.Address) (map[string]map[string]*types.RPCTransaction, error) - Inspect() (map[string]map[string]map[string]string, error) - Status() (map[string]hexutil.Uint, error) + Content(ctx context.Context) (map[string]map[string]map[string]*types.RPCTransaction, error) + ContentFrom(ctx context.Context, address common.Address) (map[string]map[string]*types.RPCTransaction, error) + Inspect(ctx context.Context) (map[string]map[string]map[string]string, error) + Status(ctx context.Context) (map[string]hexutil.Uint, error) // Tracing - TraceTransaction(hash common.Hash, config *types.TraceConfig) (interface{}, error) - TraceBlock(height types.BlockNumber, config *types.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) - TraceCall(args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, config *types.TraceConfig) (interface{}, error) + TraceTransaction(ctx context.Context, hash common.Hash, config *types.TraceConfig) (interface{}, error) + TraceBlock(ctx context.Context, height types.BlockNumber, config *types.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) + TraceCall(ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, config *types.TraceConfig) (interface{}, error) } var _ BackendI = (*Backend)(nil) @@ -145,6 +145,7 @@ var _ BackendI = (*Backend)(nil) // block results, and a target fee history entry to populate. // // Parameters: +// - ctx: Context for the request // - tendermintBlock: The raw Tendermint block data // - ethBlock: The Ethereum-formatted block representation // - rewardPercentiles: Percentiles used for fee reward calculation @@ -153,6 +154,7 @@ var _ BackendI = (*Backend)(nil) // // Returns an error if block processing fails. type ProcessBlocker func( + ctx context.Context, tendermintBlock *tmrpctypes.ResultBlock, ethBlock *map[string]interface{}, rewardPercentiles []float64, @@ -162,7 +164,6 @@ type ProcessBlocker func( // Backend implements the BackendI interface type Backend struct { - Ctx context.Context ClientCtx client.Context RPCClient tmrpcclient.SignClient QueryClient *types.QueryClient // gRPC query client @@ -199,7 +200,6 @@ func NewBackend( } b := &Backend{ - Ctx: context.Background(), ClientCtx: clientCtx, RPCClient: rpcClient, QueryClient: types.NewQueryClient(clientCtx), diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index e3b8aa105..b594f6564 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -1,12 +1,15 @@ package backend import ( + "context" "fmt" "strconv" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -22,10 +25,14 @@ import ( // app state could lag behind from cometbft latest block, it's more stable for // the client to use the latest block number in abci app state than cometbft // rpc. -func (b *Backend) BlockNumber() (hexutil.Uint64, error) { +func (b *Backend) BlockNumber(ctx context.Context) (result hexutil.Uint64, err error) { + ctx, span := tracer.Start(ctx, "GetBlockNumber") + defer span.End() + defer func() { span.RecordError(err) }() + // do any grpc query, ignore the response and use the returned block height var header metadata.MD - _, err := b.QueryClient.Params(b.Ctx, &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) + _, err = b.QueryClient.Params(ctx, &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) if err != nil { return hexutil.Uint64(0), err } @@ -46,8 +53,12 @@ func (b *Backend) BlockNumber() (hexutil.Uint64, error) { // GetBlockByNumber returns the JSON-RPC compatible Ethereum block identified by // block number. Depending on fullTx it either returns the full transaction // objects or if false only the hashes of the transactions. -func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { - resBlock, err := b.CometBlockByNumber(blockNum) +func (b *Backend) GetBlockByNumber(ctx context.Context, blockNum types.BlockNumber, fullTx bool) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Bool("fullTx", fullTx))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { return nil, nil } @@ -57,25 +68,29 @@ func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map return nil, nil } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { b.Logger.Debug("failed to fetch block result from CometBFT", "height", blockNum, "error", err.Error()) return nil, nil } - res, err := b.RPCBlockFromCometBlock(resBlock, blockRes, fullTx) + result, err = b.RPCBlockFromCometBlock(ctx, resBlock, blockRes, fullTx) if err != nil { b.Logger.Debug("RPCBlockFromCometBlock failed", "height", blockNum, "error", err.Error()) return nil, err } - return res, nil + return result, nil } // GetBlockByHash returns the JSON-RPC compatible Ethereum block identified by // hash. -func (b *Backend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { - resBlock, err := b.CometBlockByHash(hash) +func (b *Backend) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetBlockByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Bool("fullTx", fullTx))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { return nil, err } @@ -85,25 +100,27 @@ func (b *Backend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]inte return nil, nil } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { b.Logger.Debug("failed to fetch block result from CometBFT", "block-hash", hash.String(), "error", err.Error()) return nil, nil } - res, err := b.RPCBlockFromCometBlock(resBlock, blockRes, fullTx) + result, err = b.RPCBlockFromCometBlock(ctx, resBlock, blockRes, fullTx) if err != nil { b.Logger.Debug("RPCBlockFromCometBlock failed", "hash", hash, "error", err.Error()) return nil, err } - return res, nil + return result, nil } // GetBlockTransactionCountByHash returns the number of Ethereum transactions in // the block identified by hash. -func (b *Backend) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint { - block, err := b.RPCClient.BlockByHash(b.Ctx, hash.Bytes()) +func (b *Backend) GetBlockTransactionCountByHash(ctx context.Context, hash common.Hash) *hexutil.Uint { + ctx, span := tracer.Start(ctx, "GetBlockTransactionCountByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + block, err := b.RPCClient.BlockByHash(ctx, hash.Bytes()) if err != nil { b.Logger.Debug("block not found", "hash", hash.Hex(), "error", err.Error()) return nil @@ -114,13 +131,15 @@ func (b *Backend) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint return nil } - return b.getBlockTransactionCount(block) + return b.getBlockTransactionCount(ctx, block) } // GetBlockTransactionCountByNumber returns the number of Ethereum transactions // in the block identified by number. -func (b *Backend) GetBlockTransactionCountByNumber(blockNum types.BlockNumber) *hexutil.Uint { - block, err := b.CometBlockByNumber(blockNum) +func (b *Backend) GetBlockTransactionCountByNumber(ctx context.Context, blockNum types.BlockNumber) *hexutil.Uint { + ctx, span := tracer.Start(ctx, "GetBlockTransactionCountByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + block, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { b.Logger.Debug("block not found", "height", blockNum.Int64(), "error", err.Error()) return nil @@ -131,25 +150,31 @@ func (b *Backend) GetBlockTransactionCountByNumber(blockNum types.BlockNumber) * return nil } - return b.getBlockTransactionCount(block) + return b.getBlockTransactionCount(ctx, block) } // getBlockTransactionCount returns the number of Ethereum transactions in a // given block. -func (b *Backend) getBlockTransactionCount(block *cmtrpctypes.ResultBlock) *hexutil.Uint { - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &block.Block.Height) +func (b *Backend) getBlockTransactionCount(ctx context.Context, block *cmtrpctypes.ResultBlock) *hexutil.Uint { + ctx, span := tracer.Start(ctx, "getBlockTransactionCount") + defer span.End() + blockRes, err := b.RPCClient.BlockResults(ctx, &block.Block.Height) if err != nil { return nil } - ethMsgs := b.EthMsgsFromCometBlock(block, blockRes) + ethMsgs := b.EthMsgsFromCometBlock(ctx, block, blockRes) n := hexutil.Uint(len(ethMsgs)) return &n } // EthBlockByNumber returns the Ethereum Block identified by number. -func (b *Backend) EthBlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) { - resBlock, err := b.CometBlockByNumber(blockNum) +func (b *Backend) EthBlockByNumber(ctx context.Context, blockNum types.BlockNumber) (result *ethtypes.Block, err error) { + ctx, span := tracer.Start(ctx, "EthBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { return nil, err } @@ -159,29 +184,34 @@ func (b *Backend) EthBlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, return nil, fmt.Errorf("block not found for height %d", blockNum) } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { return nil, fmt.Errorf("block result not found for height %d", resBlock.Block.Height) } - ethBlock, err := b.EthBlockFromCometBlock(resBlock, blockRes) + result, err = b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { return nil, fmt.Errorf("failed to get eth block from comet block: %w", err) } - return ethBlock, nil + return result, nil } // GetBlockReceipts returns the receipts for a given block number or hash. func (b *Backend) GetBlockReceipts( + ctx context.Context, blockNrOrHash types.BlockNumberOrHash, -) ([]map[string]interface{}, error) { - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) +) (result []map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetBlockReceipts", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, fmt.Errorf("failed to get block number from hash: %w", err) } - resBlock, err := b.CometBlockByNumber(blockNum) + resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { return nil, fmt.Errorf("failed to get block by number: %w", err) } @@ -190,19 +220,19 @@ func (b *Backend) GetBlockReceipts( return nil, fmt.Errorf("block not found for height %d", *blockNum.CmtHeight()) } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, blockNum.CmtHeight()) + blockRes, err := b.RPCClient.BlockResults(ctx, blockNum.CmtHeight()) if err != nil { return nil, fmt.Errorf("block result not found for height %d", resBlock.Block.Height) } - msgs := b.EthMsgsFromCometBlock(resBlock, blockRes) + msgs := b.EthMsgsFromCometBlock(ctx, resBlock, blockRes) - receipts, err := b.ReceiptsFromCometBlock(resBlock, blockRes, msgs) + receipts, err := b.ReceiptsFromCometBlock(ctx, resBlock, blockRes, msgs) if err != nil { return nil, fmt.Errorf("failed to get receipts from comet block: %w, ", err) } - result := make([]map[string]interface{}, len(msgs)) + result = make([]map[string]interface{}, len(msgs)) for i, msg := range msgs { var signer ethtypes.Signer tx := msg.AsTransaction() diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 61dfc0b34..7653bff5c 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -13,6 +13,8 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -28,19 +30,23 @@ import ( // Resend accepts an existing transaction and a new gas price and limit. It will remove // the given transaction from the pool and reinsert it with the new gas price and limit. -func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) { +func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (result common.Hash, err error) { + ctx, span := tracer.Start(ctx, "Resend", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + if args.Nonce == nil { return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec") } - args, err := b.SetTxDefaults(args) + args, err = b.SetTxDefaults(ctx, args) if err != nil { return common.Hash{}, err } // The signer used should always be the 'latest' known one because we expect // signers to be backwards-compatible with old transactions. - cfg := b.ChainConfig() + cfg := b.ChainConfig(ctx) if cfg == nil { cfg = evmtypes.DefaultChainConfig(b.EvmChainID.Uint64()).EthereumConfig(nil) } @@ -62,15 +68,15 @@ func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, g return common.Hash{}, err } - pending, err := b.PendingTransactions() + pending, err := b.PendingTransactions(ctx) if err != nil { return common.Hash{}, err } - for _, tx := range pending { + for _, txItem := range pending { // FIXME does Resend api possible at all? https://github.com/evmos/ethermint/issues/905 - p, err := evmtypes.UnwrapEthereumMsg(tx, common.Hash{}) - if err != nil { + p, unwrapErr := evmtypes.UnwrapEthereumMsg(txItem, common.Hash{}) + if unwrapErr != nil { // not valid ethereum tx continue } @@ -78,8 +84,8 @@ func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, g pTx := p.AsTransaction() wantSigHash := signer.Hash(matchTx) - pFrom, err := ethtypes.Sender(signer, pTx) - if err != nil { + pFrom, senderErr := ethtypes.Sender(signer, pTx) + if senderErr != nil { continue } @@ -92,7 +98,7 @@ func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, g args.Gas = gasLimit } - return b.SendTransaction(args) // TODO: this calls SetTxDefaults again, refactor to avoid calling it twice + return b.SendTransaction(ctx, args) // TODO: this calls SetTxDefaults again, refactor to avoid calling it twice } } @@ -100,7 +106,11 @@ func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, g } // SendRawTransaction send a raw Ethereum transaction. -func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { +func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (result common.Hash, err error) { + ctx, span := tracer.Start(ctx, "SendRawTransaction") + defer span.End() + defer func() { span.RecordError(err) }() + // RLP decode raw transaction bytes tx := ðtypes.Transaction{} if err := tx.UnmarshalBinary(data); err != nil { @@ -120,7 +130,7 @@ func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { } ethereumTx := &evmtypes.MsgEthereumTx{} - ethSigner := ethtypes.LatestSigner(b.ChainConfig()) + ethSigner := ethtypes.LatestSigner(b.ChainConfig(ctx)) if err := ethereumTx.FromSignedEthereumTx(tx, ethSigner); err != nil { b.Logger.Error("transaction converting failed", "error", err.Error()) return common.Hash{}, fmt.Errorf("failed to convert ethereum transaction: %w", err) @@ -165,7 +175,7 @@ func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { if err != nil { return common.Hash{}, fmt.Errorf("failed to get sender address: %w", err) } - nonce, err := b.getAccountNonce(from, false, b.ClientCtx.Height, b.Logger) + nonce, err := b.getAccountNonce(ctx, from, false, b.ClientCtx.Height, b.Logger) if err != nil { return common.Hash{}, fmt.Errorf("failed to get sender's current nonce: %w", err) } @@ -188,12 +198,16 @@ func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { // SetTxDefaults populates tx message with default values in case they are not // provided on the args -func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { +func (b *Backend) SetTxDefaults(ctx context.Context, args evmtypes.TransactionArgs) (result evmtypes.TransactionArgs, err error) { + ctx, span := tracer.Start(ctx, "SetTxDefaults") + defer span.End() + defer func() { span.RecordError(err) }() + if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { return args, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") } - head, _ := b.CurrentHeader() // #nosec G703 -- no need to check error cause we're already checking that head == nil + head, _ := b.CurrentHeader(ctx) // #nosec G703 -- no need to check error cause we're already checking that head == nil if head == nil { return args, errors.New("latest header is nil") } @@ -204,7 +218,7 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac // In this clause, user left some fields unspecified. if head.BaseFee != nil && args.GasPrice == nil { if args.MaxPriorityFeePerGas == nil { - tip, err := b.SuggestGasTipCap(head.BaseFee) + tip, err := b.SuggestGasTipCap(ctx, head.BaseFee) if err != nil { return args, err } @@ -228,7 +242,7 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac } if args.GasPrice == nil { - price, err := b.SuggestGasTipCap(head.BaseFee) + price, err := b.SuggestGasTipCap(ctx, head.BaseFee) if err != nil { return args, err } @@ -254,7 +268,7 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac if args.Nonce == nil { // get the nonce from the account retriever // ignore error in case tge account doesn't exist yet - nonce, _ := b.getAccountNonce(*args.From, true, 0, b.Logger) // #nosec G703s + nonce, _ := b.getAccountNonce(ctx, *args.From, true, 0, b.Logger) // #nosec G703s args.Nonce = (*hexutil.Uint64)(&nonce) } @@ -300,7 +314,7 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac blockNr := rpctypes.NewBlockNumber(big.NewInt(0)) blockNrOrHash := rpctypes.BlockNumberOrHash{BlockNumber: &blockNr} - estimated, err := b.EstimateGas(callArgs, &blockNrOrHash, nil) + estimated, err := b.EstimateGas(ctx, callArgs, &blockNrOrHash, nil) if err != nil { return args, err } @@ -317,14 +331,23 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac // EstimateGas returns an estimate of gas usage for the given smart contract call. func (b *Backend) EstimateGas( + ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, overrides *json.RawMessage, -) (hexutil.Uint64, error) { +) (result hexutil.Uint64, err error) { + var toAddr string + if args.To != nil { + toAddr = args.To.Hex() + } + ctx, span := tracer.Start(ctx, "EstimateGas", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) + defer span.End() + defer func() { span.RecordError(err) }() + blockNr := rpctypes.EthPendingBlockNumber if blockNrOrHash != nil { var err error - blockNr, err = b.BlockNumberFromComet(*blockNrOrHash) + blockNr, err = b.BlockNumberFromComet(ctx, *blockNrOrHash) if err != nil { return 0, err } @@ -335,7 +358,7 @@ func (b *Backend) EstimateGas( return 0, err } - header, err := b.CometHeaderByNumber(blockNr) + header, err := b.CometHeaderByNumber(ctx, blockNr) if err != nil { // the error message imitates geth behavior return 0, errors.New("header not found") @@ -357,7 +380,8 @@ func (b *Backend) EstimateGas( // From ContextWithHeight: if the provided height is 0, // it will return an empty context and the gRPC query will use // the latest block height for querying. - res, err := b.QueryClient.EstimateGas(rpctypes.ContextWithHeight(blockNr.Int64()), &req) + ctx = rpctypes.ContextWithHeight(blockNr.Int64(), ctx) + res, err := b.QueryClient.EstimateGas(ctx, &req) if err != nil { return 0, err } @@ -370,15 +394,24 @@ func (b *Backend) EstimateGas( // DoCall performs a simulated call operation through the evmtypes. It returns the // estimated gas used on the operation or an error if fails. func (b *Backend) DoCall( + ctx context.Context, args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber, overrides *json.RawMessage, -) (*evmtypes.MsgEthereumTxResponse, error) { +) (result *evmtypes.MsgEthereumTxResponse, err error) { + var toAddr string + if args.To != nil { + toAddr = args.To.Hex() + } + ctx, span := tracer.Start(ctx, "DoCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.Int64("blockNr", blockNr.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + bz, err := json.Marshal(&args) if err != nil { return nil, err } - header, err := b.CometHeaderByNumber(blockNr) + header, err := b.CometHeaderByNumber(ctx, blockNr) if err != nil { // the error message imitates geth behavior return nil, errors.New("header not found") @@ -400,7 +433,7 @@ func (b *Backend) DoCall( // From ContextWithHeight: if the provided height is 0, // it will return an empty context and the gRPC query will use // the latest block height for querying. - ctx := rpctypes.ContextWithHeight(blockNr.Int64()) + ctx = rpctypes.ContextWithHeight(blockNr.Int64(), ctx) timeout := b.RPCEVMTimeout() // Setup context so it may be canceled the call has completed @@ -429,37 +462,37 @@ func (b *Backend) DoCall( } // GasPrice returns the current gas price based on Cosmos EVM' gas price oracle. -func (b *Backend) GasPrice() (*hexutil.Big, error) { - var ( - result *big.Int - err error - ) +func (b *Backend) GasPrice(ctx context.Context) (result *hexutil.Big, err error) { + ctx, span := tracer.Start(ctx, "GasPrice") + defer span.End() + defer func() { span.RecordError(err) }() - head, err := b.CurrentHeader() + head, err := b.CurrentHeader(ctx) if err != nil { return nil, err } + var gasPrice *big.Int if head.BaseFee != nil { - result, err = b.SuggestGasTipCap(head.BaseFee) + gasPrice, err = b.SuggestGasTipCap(ctx, head.BaseFee) if err != nil { return nil, err } - result = result.Add(result, head.BaseFee) + gasPrice = gasPrice.Add(gasPrice, head.BaseFee) } else { - result = b.RPCMinGasPrice() + gasPrice = b.RPCMinGasPrice() } // return at least GlobalMinGasPrice from FeeMarket module - minGasPrice, err := b.GlobalMinGasPrice() + minGasPrice, err := b.GlobalMinGasPrice(ctx) if err != nil { return nil, err } - if result.Cmp(minGasPrice) < 0 { - result = minGasPrice + if gasPrice.Cmp(minGasPrice) < 0 { + gasPrice = minGasPrice } - return (*hexutil.Big)(result), nil + return (*hexutil.Big)(gasPrice), nil } // handleRevertError returns revert related error. diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 3686a3250..f7b972e9f 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" gomath "math" "math/big" @@ -12,6 +13,8 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" cmtrpcclient "github.com/cometbft/cometbft/rpc/client" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" @@ -27,15 +30,19 @@ import ( ) // ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config. -func (b *Backend) ChainID() (*hexutil.Big, error) { +func (b *Backend) ChainID(ctx context.Context) (result *hexutil.Big, err error) { + ctx, span := tracer.Start(ctx, "ChainID") + defer span.End() + defer func() { span.RecordError(err) }() + // if current block is at or past the EIP-155 replay-protection fork block, return EvmChainID from config - bn, err := b.BlockNumber() + bn, err := b.BlockNumber(ctx) if err != nil { b.Logger.Debug("failed to fetch latest block number", "error", err.Error()) return (*hexutil.Big)(b.EvmChainID), nil } - if config := b.ChainConfig(); config.IsEIP155(new(big.Int).SetUint64(uint64(bn))) { + if config := b.ChainConfig(ctx); config.IsEIP155(new(big.Int).SetUint64(uint64(bn))) { return (*hexutil.Big)(config.ChainID), nil } @@ -43,13 +50,19 @@ func (b *Backend) ChainID() (*hexutil.Big, error) { } // ChainConfig returns the latest ethereum chain configuration -func (b *Backend) ChainConfig() *params.ChainConfig { +func (b *Backend) ChainConfig(ctx context.Context) *params.ChainConfig { + _, span := tracer.Start(ctx, "ChainConfig") + defer span.End() return evmtypes.GetEthChainConfig() } // GlobalMinGasPrice returns MinGasPrice param from FeeMarket -func (b *Backend) GlobalMinGasPrice() (*big.Int, error) { - res, err := b.QueryClient.GlobalMinGasPrice(b.Ctx, &evmtypes.QueryGlobalMinGasPriceRequest{}) +func (b *Backend) GlobalMinGasPrice(ctx context.Context) (result *big.Int, err error) { + ctx, span := tracer.Start(ctx, "GlobalMinGasPrice") + defer span.End() + defer func() { span.RecordError(err) }() + + res, err := b.QueryClient.GlobalMinGasPrice(ctx, &evmtypes.QueryGlobalMinGasPriceRequest{}) if err != nil { return nil, err } @@ -63,9 +76,14 @@ func (b *Backend) GlobalMinGasPrice() (*big.Int, error) { // If the base fee is not enabled globally, the query returns nil. // If the London hard fork is not activated at the current height, the query will // return nil. -func (b *Backend) BaseFee(blockRes *cmtrpctypes.ResultBlockResults) (*big.Int, error) { +func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result *big.Int, err error) { + ctx, span := tracer.Start(ctx, "BaseFee", trace.WithAttributes(attribute.Int64("height", blockRes.Height))) + defer span.End() + defer func() { span.RecordError(err) }() + // return BaseFee if London hard fork is activated and feemarket is enabled - res, err := b.QueryClient.BaseFee(rpctypes.ContextWithHeight(blockRes.Height), &evmtypes.QueryBaseFeeRequest{}) + ctx = rpctypes.ContextWithHeight(blockRes.Height, ctx) + res, err := b.QueryClient.BaseFee(ctx, &evmtypes.QueryBaseFeeRequest{}) if err != nil || res.BaseFee == nil { // we can't tell if it's london HF not enabled or the state is pruned, // in either case, we'll fallback to parsing from begin blocker event, @@ -93,28 +111,36 @@ func (b *Backend) BaseFee(blockRes *cmtrpctypes.ResultBlockResults) (*big.Int, e // CurrentHeader returns the latest block header // This will return error as per node configuration // if the ABCI responses are discarded ('discard_abci_responses' config param) -func (b *Backend) CurrentHeader() (*ethtypes.Header, error) { - return b.HeaderByNumber(rpctypes.EthLatestBlockNumber) +func (b *Backend) CurrentHeader(ctx context.Context) (result *ethtypes.Header, err error) { + ctx, span := tracer.Start(ctx, "CurrentHeader") + defer span.End() + defer func() { span.RecordError(err) }() + + return b.HeaderByNumber(ctx, rpctypes.EthLatestBlockNumber) } // PendingTransactions returns the transactions that are in the transaction pool // and have a from address that is one of the accounts this node manages. -func (b *Backend) PendingTransactions() ([]*sdk.Tx, error) { +func (b *Backend) PendingTransactions(ctx context.Context) (result []*sdk.Tx, err error) { + ctx, span := tracer.Start(ctx, "PendingTransactions") + defer span.End() + defer func() { span.RecordError(err) }() + mc, ok := b.ClientCtx.Client.(cmtrpcclient.MempoolClient) if !ok { return nil, errors.New("invalid rpc client") } - res, err := mc.UnconfirmedTxs(b.Ctx, nil) + res, err := mc.UnconfirmedTxs(ctx, nil) if err != nil { return nil, err } - result := make([]*sdk.Tx, 0, len(res.Txs)) + result = make([]*sdk.Tx, 0, len(res.Txs)) for _, txBz := range res.Txs { - tx, err := b.ClientCtx.TxConfig.TxDecoder()(txBz) - if err != nil { - return nil, err + tx, decodeErr := b.ClientCtx.TxConfig.TxDecoder()(txBz) + if decodeErr != nil { + return nil, decodeErr } result = append(result, &tx) } @@ -123,13 +149,17 @@ func (b *Backend) PendingTransactions() ([]*sdk.Tx, error) { } // GetCoinbase is the address that staking rewards will be send to (alias for Etherbase). -func (b *Backend) GetCoinbase() (sdk.AccAddress, error) { +func (b *Backend) GetCoinbase(ctx context.Context) (result sdk.AccAddress, err error) { + ctx, span := tracer.Start(ctx, "GetCoinbase") + defer span.End() + defer func() { span.RecordError(err) }() + node, err := b.ClientCtx.GetNode() if err != nil { return nil, err } - status, err := node.Status(b.Ctx) + status, err := node.Status(ctx) if err != nil { return nil, err } @@ -138,7 +168,7 @@ func (b *Backend) GetCoinbase() (sdk.AccAddress, error) { ConsAddress: sdk.ConsAddress(status.ValidatorInfo.Address).String(), } - res, err := b.QueryClient.ValidatorAccount(b.Ctx, req) + res, err := b.QueryClient.ValidatorAccount(ctx, req) if err != nil { return nil, err } @@ -154,10 +184,13 @@ var ( // FeeHistory returns data relevant for fee estimation based on the specified range of blocks. func (b *Backend) FeeHistory( + ctx context.Context, userBlockCount math.HexOrDecimal64, // number blocks to fetch, maximum is 100 lastBlock rpc.BlockNumber, // the block to start search , to oldest rewardPercentiles []float64, // percentiles to fetch reward ) (*rpctypes.FeeHistoryResult, error) { + ctx, span := tracer.Start(ctx, "FeeHistory", trace.WithAttributes(attribute.Int64("blockCount", int64(userBlockCount)), attribute.Int64("lastBlock", int64(lastBlock)))) + defer span.End() for i, p := range rewardPercentiles { if p < 0 || p > 100 { return nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) @@ -166,7 +199,7 @@ func (b *Backend) FeeHistory( return nil, fmt.Errorf("%w: #%d:%f > #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p) } } - blkNumber, err := b.BlockNumber() + blkNumber, err := b.BlockNumber(ctx) if err != nil { return nil, err } @@ -241,21 +274,21 @@ func (b *Backend) FeeHistory( // fetch block // CometBFT block blockNum := rpctypes.BlockNumber(blockStart + int64(index)) - cometBlock, err := b.CometBlockByNumber(blockNum) + cometBlock, err := b.CometBlockByNumber(ctx, blockNum) if cometBlock == nil { chanErr <- err return } // eth block - ethBlock, err := b.GetBlockByNumber(blockNum, true) + ethBlock, err := b.GetBlockByNumber(ctx, blockNum, true) if ethBlock == nil { chanErr <- err return } // CometBFT block result - cometBlockResult, err := b.CometBlockResultByNumber(&cometBlock.Block.Height) + cometBlockResult, err := b.CometBlockResultByNumber(ctx, &cometBlock.Block.Height) if cometBlockResult == nil { b.Logger.Debug("block result not found", "height", cometBlock.Block.Height, "error", err.Error()) chanErr <- err @@ -263,7 +296,7 @@ func (b *Backend) FeeHistory( } oneFeeHistory := rpctypes.OneFeeHistory{} - err = b.ProcessBlocker(cometBlock, ðBlock, rewardPercentiles, cometBlockResult, &oneFeeHistory) + err = b.ProcessBlocker(ctx, cometBlock, ðBlock, rewardPercentiles, cometBlockResult, &oneFeeHistory) if err != nil { chanErr <- err return @@ -320,13 +353,15 @@ func (b *Backend) FeeHistory( // SuggestGasTipCap returns the suggested tip cap // Although we don't support tx prioritization yet, but we return a positive value to help client to // mitigate the base fee changes. -func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { +func (b *Backend) SuggestGasTipCap(ctx context.Context, baseFee *big.Int) (*big.Int, error) { + ctx, span := tracer.Start(ctx, "SuggestGasTipCap") + defer span.End() if baseFee == nil { // london hardfork not enabled or feemarket not enabled return big.NewInt(0), nil } - params, err := b.QueryClient.FeeMarket.Params(b.Ctx, &feemarkettypes.QueryParamsRequest{}) + params, err := b.QueryClient.FeeMarket.Params(ctx, &feemarkettypes.QueryParamsRequest{}) if err != nil { return nil, err } diff --git a/rpc/backend/comet.go b/rpc/backend/comet.go index 3b295b08b..860d8bcc5 100644 --- a/rpc/backend/comet.go +++ b/rpc/backend/comet.go @@ -1,10 +1,13 @@ package backend import ( + "context" "fmt" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" @@ -14,12 +17,16 @@ import ( // CometBlockByNumber returns a CometBFT-formatted block for a given // block number -func (b *Backend) CometBlockByNumber(blockNum rpctypes.BlockNumber) (*cmtrpctypes.ResultBlock, error) { - height, err := b.getHeightByBlockNum(blockNum) +func (b *Backend) CometBlockByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultBlock, err error) { + ctx, span := tracer.Start(ctx, "CometBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + + height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { return nil, err } - resBlock, err := b.RPCClient.Block(b.Ctx, &height) + resBlock, err := b.RPCClient.Block(ctx, &height) if err != nil { b.Logger.Debug("cometbft client failed to get block", "height", height, "error", err.Error()) return nil, err @@ -35,21 +42,33 @@ func (b *Backend) CometBlockByNumber(blockNum rpctypes.BlockNumber) (*cmtrpctype // CometHeaderByNumber returns a CometBFT-formatted header for a given // block number -func (b *Backend) CometHeaderByNumber(blockNum rpctypes.BlockNumber) (*cmtrpctypes.ResultHeader, error) { - height, err := b.getHeightByBlockNum(blockNum) +func (b *Backend) CometHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultHeader, err error) { + ctx, span := tracer.Start(ctx, "CometHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + + height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { return nil, err } - return b.RPCClient.Header(b.Ctx, &height) + return b.RPCClient.Header(ctx, &height) } // CometBlockResultByNumber returns a CometBFT-formatted block result // by block number -func (b *Backend) CometBlockResultByNumber(height *int64) (*cmtrpctypes.ResultBlockResults, error) { +func (b *Backend) CometBlockResultByNumber(ctx context.Context, height *int64) (result *cmtrpctypes.ResultBlockResults, err error) { + var heightAttr int64 + if height != nil { + heightAttr = *height + } + ctx, span := tracer.Start(ctx, "CometBlockResultByNumber", trace.WithAttributes(attribute.Int64("height", heightAttr))) + defer span.End() + defer func() { span.RecordError(err) }() + if height != nil && *height == 0 { height = nil } - res, err := b.RPCClient.BlockResults(b.Ctx, height) + res, err := b.RPCClient.BlockResults(ctx, height) if err != nil { return nil, fmt.Errorf("failed to fetch block result from CometBFT %d: %w", *height, err) } @@ -58,8 +77,12 @@ func (b *Backend) CometBlockResultByNumber(height *int64) (*cmtrpctypes.ResultBl } // CometBlockByHash returns a CometBFT-formatted block by block number -func (b *Backend) CometBlockByHash(blockHash common.Hash) (*cmtrpctypes.ResultBlock, error) { - resBlock, err := b.RPCClient.BlockByHash(b.Ctx, blockHash.Bytes()) +func (b *Backend) CometBlockByHash(ctx context.Context, blockHash common.Hash) (result *cmtrpctypes.ResultBlock, err error) { + ctx, span := tracer.Start(ctx, "CometBlockByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.RPCClient.BlockByHash(ctx, blockHash.Bytes()) if err != nil { b.Logger.Debug("CometBFT client failed to get block", "blockHash", blockHash.Hex(), "error", err.Error()) return nil, err @@ -73,9 +96,13 @@ func (b *Backend) CometBlockByHash(blockHash common.Hash) (*cmtrpctypes.ResultBl return resBlock, nil } -func (b *Backend) getHeightByBlockNum(blockNum rpctypes.BlockNumber) (int64, error) { +func (b *Backend) getHeightByBlockNum(ctx context.Context, blockNum rpctypes.BlockNumber) (height int64, err error) { + ctx, span := tracer.Start(ctx, "getHeightByBlockNum", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + if blockNum == rpctypes.EthEarliestBlockNumber { - status, err := b.ClientCtx.Client.Status(b.Ctx) + status, err := b.ClientCtx.Client.Status(ctx) if err != nil { return 0, errors.New("failed to get earliest block height") } @@ -83,7 +110,7 @@ func (b *Backend) getHeightByBlockNum(blockNum rpctypes.BlockNumber) (int64, err return status.SyncInfo.EarliestBlockHeight, nil } - height := blockNum.Int64() + height = blockNum.Int64() if height <= 0 { // In cometBFT, LatestBlockNumber, FinalizedBlockNumber, SafeBlockNumber all map to the latest block height. // Fetch the latest block number from the app state, more accurate than the CometBFT block store state. @@ -91,7 +118,7 @@ func (b *Backend) getHeightByBlockNum(blockNum rpctypes.BlockNumber) (int64, err // For PendingBlockNumber, we alsoe returns the latest block height. // The reason is that CometBFT does not have the concept of pending block, // and the application state is only updated when a block is committed. - n, err := b.BlockNumber() + n, err := b.BlockNumber(ctx) if err != nil { return 0, err } diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index 8b4847726..f18304800 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" "math/big" @@ -10,6 +11,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/trie" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" @@ -22,10 +25,15 @@ import ( // RPCBlockFromCometBlock returns a JSON-RPC compatible Ethereum block from a // given CometBFT block and its block result. func (b *Backend) RPCHeaderFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, blockRes *cmtrpctypes.ResultBlockResults, -) (map[string]interface{}, error) { - ethBlock, err := b.EthBlockFromCometBlock(resBlock, blockRes) +) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "RPCHeaderFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + + ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { return nil, fmt.Errorf("failed to get rpc block from comet block: %w", err) } @@ -36,26 +44,35 @@ func (b *Backend) RPCHeaderFromCometBlock( // RPCBlockFromCometBlock returns a JSON-RPC compatible Ethereum block from a // given CometBFT block and its block result. func (b *Backend) RPCBlockFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, blockRes *cmtrpctypes.ResultBlockResults, fullTx bool, -) (map[string]interface{}, error) { - msgs := b.EthMsgsFromCometBlock(resBlock, blockRes) - ethBlock, err := b.EthBlockFromCometBlock(resBlock, blockRes) +) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "RPCBlockFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + + msgs := b.EthMsgsFromCometBlock(ctx, resBlock, blockRes) + ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { return nil, fmt.Errorf("failed to get rpc block from comet block: %w", err) } - return rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, b.ChainConfig()) + return rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, b.ChainConfig(ctx)) } // BlockNumberFromComet returns the BlockNumber from BlockNumberOrHash -func (b *Backend) BlockNumberFromComet(blockNrOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) { +func (b *Backend) BlockNumberFromComet(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (result rpctypes.BlockNumber, err error) { + ctx, span := tracer.Start(ctx, "BlockNumberFromComet", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + switch { case blockNrOrHash.BlockHash == nil && blockNrOrHash.BlockNumber == nil: return rpctypes.EthEarliestBlockNumber, fmt.Errorf("types BlockHash and BlockNumber cannot be both nil") case blockNrOrHash.BlockHash != nil: - blockNumber, err := b.BlockNumberFromCometByHash(*blockNrOrHash.BlockHash) + blockNumber, err := b.BlockNumberFromCometByHash(ctx, *blockNrOrHash.BlockHash) if err != nil { return rpctypes.EthEarliestBlockNumber, err } @@ -68,8 +85,12 @@ func (b *Backend) BlockNumberFromComet(blockNrOrHash rpctypes.BlockNumberOrHash) } // BlockNumberFromCometByHash returns the block height of given block hash -func (b *Backend) BlockNumberFromCometByHash(blockHash common.Hash) (*big.Int, error) { - resHeader, err := b.RPCClient.HeaderByHash(b.Ctx, blockHash.Bytes()) +func (b *Backend) BlockNumberFromCometByHash(ctx context.Context, blockHash common.Hash) (result *big.Int, err error) { + ctx, span := tracer.Start(ctx, "BlockNumberFromCometByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resHeader, err := b.RPCClient.HeaderByHash(ctx, blockHash.Bytes()) if err != nil { return nil, err } @@ -85,9 +106,12 @@ func (b *Backend) BlockNumberFromCometByHash(blockHash common.Hash) (*big.Int, e // CometBFT block. It also ensures consistency over the correct txs indexes // across RPC endpoints func (b *Backend) EthMsgsFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, blockRes *cmtrpctypes.ResultBlockResults, ) []*evmtypes.MsgEthereumTx { + ctx, span := tracer.Start(ctx, "EthMsgsFromCometBlock") + defer span.End() var result []*evmtypes.MsgEthereumTx block := resBlock.Block @@ -125,26 +149,31 @@ func (b *Backend) EthMsgsFromCometBlock( // RPCBlockFromCometBlock returns a JSON-RPC compatible Ethereum block from a // given CometBFT block and its block result. func (b *Backend) EthBlockFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, blockRes *cmtrpctypes.ResultBlockResults, -) (*ethtypes.Block, error) { +) (result *ethtypes.Block, err error) { + ctx, span := tracer.Start(ctx, "EthBlockFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + cmtBlock := resBlock.Block // 1. get base fee - baseFee, err := b.BaseFee(blockRes) + baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { // handle the error for pruned node. b.Logger.Error("failed to fetch Base Fee from prunned block. Check node prunning configuration", "height", cmtBlock.Height, "error", err) } // 2. get miner - miner, err := b.MinerFromCometBlock(resBlock) + miner, err := b.MinerFromCometBlock(ctx, resBlock) if err != nil { return nil, fmt.Errorf("failed to get miner(block proposer) address from comet block") } // 3. get block gasLimit - ctx := rpctypes.ContextWithHeight(cmtBlock.Height) + ctx = rpctypes.ContextWithHeight(cmtBlock.Height, ctx) gasLimit, err := rpctypes.BlockMaxGasFromConsensusParams(ctx, b.ClientCtx, cmtBlock.Height) if err != nil { b.Logger.Error("failed to query consensus params", "error", err.Error()) @@ -154,7 +183,7 @@ func (b *Backend) EthBlockFromCometBlock( ethHeader := rpctypes.MakeHeader(cmtBlock.Header, gasLimit, miner, baseFee) // 5. get MsgEthereumTxs - msgs := b.EthMsgsFromCometBlock(resBlock, blockRes) + msgs := b.EthMsgsFromCometBlock(ctx, resBlock, blockRes) txs := make([]*ethtypes.Transaction, len(msgs)) for i, ethMsg := range msgs { txs[i] = ethMsg.AsTransaction() @@ -168,7 +197,7 @@ func (b *Backend) EthBlockFromCometBlock( } // 7. receipts - receipts, err := b.ReceiptsFromCometBlock(resBlock, blockRes, msgs) + receipts, err := b.ReceiptsFromCometBlock(ctx, resBlock, blockRes, msgs) if err != nil { return nil, fmt.Errorf("failed to get receipts from comet block: %w", err) } @@ -191,8 +220,13 @@ func (b *Backend) EthBlockFromCometBlock( } func (b *Backend) MinerFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, -) (common.Address, error) { +) (result common.Address, err error) { + ctx, span := tracer.Start(ctx, "MinerFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + cmtBlock := resBlock.Block req := &evmtypes.QueryValidatorAccountRequest{ @@ -201,7 +235,7 @@ func (b *Backend) MinerFromCometBlock( var validatorAccAddr sdk.AccAddress - ctx := rpctypes.ContextWithHeight(cmtBlock.Height) + ctx = rpctypes.ContextWithHeight(cmtBlock.Height, ctx) res, err := b.QueryClient.ValidatorAccount(ctx, req) if err != nil { b.Logger.Debug( @@ -223,11 +257,16 @@ func (b *Backend) MinerFromCometBlock( } func (b *Backend) ReceiptsFromCometBlock( + ctx context.Context, resBlock *cmtrpctypes.ResultBlock, blockRes *cmtrpctypes.ResultBlockResults, msgs []*evmtypes.MsgEthereumTx, -) ([]*ethtypes.Receipt, error) { - baseFee, err := b.BaseFee(blockRes) +) (result []*ethtypes.Receipt, err error) { + ctx, span := tracer.Start(ctx, "ReceiptsFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + + baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { // handle the error for pruned node. b.Logger.Error("failed to fetch Base Fee from prunned block. Check node prunning configuration", "height", resBlock.Block.Height, "error", err) @@ -237,7 +276,7 @@ func (b *Backend) ReceiptsFromCometBlock( receipts := make([]*ethtypes.Receipt, len(msgs)) cumulatedGasUsed := uint64(0) for i, ethMsg := range msgs { - txResult, err := b.GetTxByEthHash(ethMsg.Hash()) + txResult, err := b.GetTxByEthHash(ctx, ethMsg.Hash()) if err != nil { return nil, fmt.Errorf("tx not found: hash=%s, error=%s", ethMsg.Hash(), err.Error()) } @@ -306,7 +345,11 @@ func (b *Backend) ReceiptsFromCometBlock( } // BlockBloom query block bloom filter from block results -func (b *Backend) BlockBloomFromCometBlock(blockRes *cmtrpctypes.ResultBlockResults) (ethtypes.Bloom, error) { +func (b *Backend) BlockBloomFromCometBlock(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result ethtypes.Bloom, err error) { + ctx, span := tracer.Start(ctx, "BlockBloomFromCometBlock") + defer span.End() + defer func() { span.RecordError(err) }() + for _, event := range blockRes.FinalizeBlockEvents { if event.Type != evmtypes.EventTypeBlockBloom { continue diff --git a/rpc/backend/filters.go b/rpc/backend/filters.go index fe44ddee3..f733559f2 100644 --- a/rpc/backend/filters.go +++ b/rpc/backend/filters.go @@ -1,27 +1,43 @@ package backend import ( + "context" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" ) // GetLogs returns all the logs from all the ethereum transactions in a block. -func (b *Backend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) { - resBlock, err := b.CometBlockByHash(hash) +func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) (result [][]*ethtypes.Log, err error) { + ctx, span := tracer.Start(ctx, "GetLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { return nil, err } if resBlock == nil { return nil, errors.Errorf("block not found for hash %s", hash) } - return b.GetLogsByHeight(&resBlock.Block.Height) + return b.GetLogsByHeight(ctx, &resBlock.Block.Height) } // GetLogsByHeight returns all the logs from all the ethereum transactions in a block. -func (b *Backend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { +func (b *Backend) GetLogsByHeight(ctx context.Context, height *int64) (result [][]*ethtypes.Log, err error) { + var heightAttr int64 + if height != nil { + heightAttr = *height + } + ctx, span := tracer.Start(ctx, "GetLogsByHeight", trace.WithAttributes(attribute.Int64("height", heightAttr))) + defer span.End() + defer func() { span.RecordError(err) }() + // NOTE: we query the state in case the tx result logs are not persisted after an upgrade. - blockRes, err := b.RPCClient.BlockResults(b.Ctx, height) + blockRes, err := b.RPCClient.BlockResults(ctx, height) if err != nil { return nil, err } @@ -31,6 +47,8 @@ func (b *Backend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { // BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained // by the chain indexer. -func (b *Backend) BloomStatus() (uint64, uint64) { +func (b *Backend) BloomStatus(ctx context.Context) (uint64, uint64) { + ctx, span := tracer.Start(ctx, "BloomStatus") + defer span.End() return 4096, 0 } diff --git a/rpc/backend/headers.go b/rpc/backend/headers.go index 14e466f4f..c448160ad 100644 --- a/rpc/backend/headers.go +++ b/rpc/backend/headers.go @@ -1,10 +1,13 @@ package backend import ( + "context" "fmt" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" rpctypes "github.com/cosmos/evm/rpc/types" ) @@ -12,8 +15,12 @@ import ( // GetBlockByNumber returns the JSON-RPC compatible Ethereum block identified by // block number. Depending on fullTx it either returns the full transaction // objects or if false only the hashes of the transactions. -func (b *Backend) GetHeaderByNumber(blockNum rpctypes.BlockNumber) (map[string]interface{}, error) { - resBlock, err := b.CometBlockByNumber(blockNum) +func (b *Backend) GetHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { return nil, nil } @@ -23,13 +30,13 @@ func (b *Backend) GetHeaderByNumber(blockNum rpctypes.BlockNumber) (map[string]i return nil, nil } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { b.Logger.Debug("failed to fetch block result from CometBFT", "height", blockNum, "error", err.Error()) return nil, nil } - res, err := b.RPCHeaderFromCometBlock(resBlock, blockRes) + res, err := b.RPCHeaderFromCometBlock(ctx, resBlock, blockRes) if err != nil { b.Logger.Debug("RPCBlockFromCometBlock failed", "height", blockNum, "error", err.Error()) return nil, err @@ -40,8 +47,12 @@ func (b *Backend) GetHeaderByNumber(blockNum rpctypes.BlockNumber) (map[string]i // GetBlockByHash returns the JSON-RPC compatible Ethereum block identified by // hash. -func (b *Backend) GetHeaderByHash(hash common.Hash) (map[string]interface{}, error) { - resBlock, err := b.CometBlockByHash(hash) +func (b *Backend) GetHeaderByHash(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetHeaderByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { return nil, err } @@ -51,13 +62,13 @@ func (b *Backend) GetHeaderByHash(hash common.Hash) (map[string]interface{}, err return nil, nil } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { b.Logger.Debug("failed to fetch block result from CometBFT", "block-hash", hash.String(), "error", err.Error()) return nil, nil } - res, err := b.RPCHeaderFromCometBlock(resBlock, blockRes) + res, err := b.RPCHeaderFromCometBlock(ctx, resBlock, blockRes) if err != nil { b.Logger.Debug("RPCBlockFromCometBlock failed", "hash", hash, "error", err.Error()) return nil, err @@ -67,8 +78,12 @@ func (b *Backend) GetHeaderByHash(hash common.Hash) (map[string]interface{}, err } // HeaderByNumber returns the block header identified by height. -func (b *Backend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error) { - resBlock, err := b.CometBlockByNumber(blockNum) +func (b *Backend) HeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *ethtypes.Header, err error) { + ctx, span := tracer.Start(ctx, "HeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { return nil, err } @@ -78,12 +93,12 @@ func (b *Backend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Heade return nil, nil } - blockRes, err := b.CometBlockResultByNumber(&resBlock.Block.Height) + blockRes, err := b.CometBlockResultByNumber(ctx, &resBlock.Block.Height) if err != nil { return nil, fmt.Errorf("header result not found for height %d", resBlock.Block.Height) } - ethBlock, err := b.EthBlockFromCometBlock(resBlock, blockRes) + ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { return nil, fmt.Errorf("failed to get rpc block from comet block: %w", err) } @@ -92,8 +107,12 @@ func (b *Backend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Heade } // HeaderByHash returns the block header identified by hash. -func (b *Backend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) { - resBlock, err := b.CometBlockByHash(blockHash) +func (b *Backend) HeaderByHash(ctx context.Context, blockHash common.Hash) (result *ethtypes.Header, err error) { + ctx, span := tracer.Start(ctx, "HeaderByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + resBlock, err := b.CometBlockByHash(ctx, blockHash) if err != nil { return nil, err } @@ -103,13 +122,13 @@ func (b *Backend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) return nil, nil } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &resBlock.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &resBlock.Block.Height) if err != nil { b.Logger.Debug("failed to fetch block result from CometBFT", "block-hash", blockHash.String(), "error", err.Error()) return nil, nil } - ethBlock, err := b.EthBlockFromCometBlock(resBlock, blockRes) + ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { return nil, fmt.Errorf("failed to get rpc block from comet block: %w", err) } diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index dcdf28a68..62ea917eb 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" "math/big" "time" @@ -31,7 +32,7 @@ import ( ) // Accounts returns the list of accounts available to this node. -func (b *Backend) Accounts() ([]common.Address, error) { +func (b *Backend) Accounts(_ context.Context) ([]common.Address, error) { addresses := make([]common.Address, 0) // return [] instead of nil if empty if !b.Cfg.JSONRPC.AllowInsecureUnlock { @@ -63,8 +64,12 @@ func (b *Backend) Accounts() ([]common.Address, error) { // - highestBlock: block number of the highest block header this node has received from peers // - pulledStates: number of state entries processed until now // - knownStates: number of known state entries that still need to be pulled -func (b *Backend) Syncing() (interface{}, error) { - status, err := b.ClientCtx.Client.Status(b.Ctx) +func (b *Backend) Syncing(ctx context.Context) (result interface{}, err error) { + ctx, span := tracer.Start(ctx, "Syncing") + defer span.End() + defer func() { span.RecordError(err) }() + + status, err := b.ClientCtx.Client.Status(ctx) if err != nil { return false, err } @@ -83,13 +88,15 @@ func (b *Backend) Syncing() (interface{}, error) { } // SetEtherbase sets the etherbase of the miner -func (b *Backend) SetEtherbase(etherbase common.Address) bool { +func (b *Backend) SetEtherbase(ctx context.Context, etherbase common.Address) bool { + ctx, span := tracer.Start(ctx, "SetEtherbase") + defer span.End() if !b.Cfg.JSONRPC.AllowInsecureUnlock { b.Logger.Debug("account unlock with HTTP access is forbidden") return false } - delAddr, err := b.GetCoinbase() + delAddr, err := b.GetCoinbase(ctx) if err != nil { b.Logger.Debug("failed to get coinbase address", "error", err.Error()) return false @@ -121,7 +128,7 @@ func (b *Backend) SetEtherbase(etherbase common.Address) bool { denom := minGasPrices[0].Denom delCommonAddr := common.BytesToAddress(delAddr.Bytes()) - nonce, err := b.GetTransactionCount(delCommonAddr, rpctypes.EthPendingBlockNumber) + nonce, err := b.GetTransactionCount(ctx, delCommonAddr, rpctypes.EthPendingBlockNumber) if err != nil { b.Logger.Debug("failed to get nonce", "error", err.Error()) return false @@ -154,7 +161,7 @@ func (b *Backend) SetEtherbase(etherbase common.Address) bool { return false } - if err := tx.Sign(b.ClientCtx.CmdContext, txFactory, keyInfo.Name, builder, false); err != nil { + if err := tx.Sign(ctx, txFactory, keyInfo.Name, builder, false); err != nil { b.Logger.Debug("failed to sign tx", "error", err.Error()) return false } @@ -190,7 +197,7 @@ func (b *Backend) SetEtherbase(etherbase common.Address) bool { // keys stored on the keyring. // // NOTE: The key will be both armored and encrypted using the same passphrase. -func (b *Backend) ImportRawKey(privkey, password string) (common.Address, error) { +func (b *Backend) ImportRawKey(_ context.Context, privkey, password string) (common.Address, error) { priv, err := crypto.HexToECDSA(privkey) if err != nil { return common.Address{}, err @@ -222,7 +229,7 @@ func (b *Backend) ImportRawKey(privkey, password string) (common.Address, error) } // ListAccounts will return a list of addresses for accounts this node manages. -func (b *Backend) ListAccounts() ([]common.Address, error) { +func (b *Backend) ListAccounts(ctx context.Context) ([]common.Address, error) { addrs := []common.Address{} if !b.Cfg.JSONRPC.AllowInsecureUnlock { @@ -247,7 +254,7 @@ func (b *Backend) ListAccounts() ([]common.Address, error) { } // NewAccount will create a new account and returns the address for the new account. -func (b *Backend) NewMnemonic(uid string, +func (b *Backend) NewMnemonic(ctx context.Context, uid string, _ keyring.Language, hdPath, bip39Passphrase string, @@ -263,7 +270,7 @@ func (b *Backend) NewMnemonic(uid string, // SetGasPrice sets the minimum accepted gas price for the miner. // NOTE: this function accepts only integers to have the same interface than go-eth // to use float values, the gas prices must be configured using the configuration file -func (b *Backend) SetGasPrice(gasPrice hexutil.Big) bool { +func (b *Backend) SetGasPrice(ctx context.Context, gasPrice hexutil.Big) bool { appConf, err := config.GetConfig(b.ClientCtx.Viper) if err != nil { b.Logger.Debug("could not get the server config", "error", err.Error()) diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 859c2c3a8..5137ce38d 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -1,6 +1,7 @@ package backend import ( + "context" "errors" "fmt" "math/big" @@ -12,6 +13,8 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/mempool" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -24,14 +27,22 @@ import ( ) // SendTransaction sends transaction based on received args using Node's key to sign it -func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { +func (b *Backend) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs) (result common.Hash, err error) { + var toAddr string + if args.To != nil { + toAddr = args.To.Hex() + } + ctx, span := tracer.Start(ctx, "SendTransaction", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) + defer span.End() + defer func() { span.RecordError(err) }() + // Look up the wallet containing the requested signer if !b.Cfg.JSONRPC.AllowInsecureUnlock { b.Logger.Debug("account unlock with HTTP access is forbidden") return common.Hash{}, fmt.Errorf("account unlock with HTTP access is forbidden") } - _, err := b.ClientCtx.Keyring.KeyByAddress(sdk.AccAddress(args.GetFrom().Bytes())) + _, err = b.ClientCtx.Keyring.KeyByAddress(sdk.AccAddress(args.GetFrom().Bytes())) if err != nil { b.Logger.Error("failed to find key in keyring", "address", args.GetFrom(), "error", err.Error()) return common.Hash{}, fmt.Errorf("failed to find key in the node's keyring; %s; %s", keystore.ErrNoMatch, err.Error()) @@ -41,23 +52,23 @@ func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, e return common.Hash{}, fmt.Errorf("chainId does not match node's (have=%v, want=%v)", args.ChainID, (*hexutil.Big)(b.EvmChainID)) } - args, err = b.SetTxDefaults(args) + args, err = b.SetTxDefaults(ctx, args) if err != nil { return common.Hash{}, err } - bn, err := b.BlockNumber() + bn, err := b.BlockNumber(ctx) if err != nil { b.Logger.Debug("failed to fetch latest block number", "error", err.Error()) return common.Hash{}, err } - header, err := b.CurrentHeader() + header, err := b.CurrentHeader(ctx) if err != nil { return common.Hash{}, err } - signer := ethtypes.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn)), header.Time) + signer := ethtypes.MakeSigner(b.ChainConfig(ctx), new(big.Int).SetUint64(uint64(bn)), header.Time) // LegacyTx derives EvmChainID from the signature. To make sure the msg.ValidateBasic makes // the corresponding EvmChainID validation, we need to sign the transaction before calling it @@ -124,7 +135,7 @@ func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, e } // Sign signs the provided data using the private key of address via Geth's signature standard. -func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { +func (b *Backend) Sign(_ context.Context, address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { from := sdk.AccAddress(address.Bytes()) _, err := b.ClientCtx.Keyring.KeyByAddress(from) @@ -145,7 +156,7 @@ func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Byte } // SignTypedData signs EIP-712 conformant typed data -func (b *Backend) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { +func (b *Backend) SignTypedData(_ context.Context, address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { from := sdk.AccAddress(address.Bytes()) _, err := b.ClientCtx.Keyring.KeyByAddress(from) diff --git a/rpc/backend/tracer.go b/rpc/backend/tracer.go new file mode 100644 index 000000000..9555ca47a --- /dev/null +++ b/rpc/backend/tracer.go @@ -0,0 +1,5 @@ +package backend + +import "go.opentelemetry.io/otel" + +var tracer = otel.Tracer("evm/rpc/backend") diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index fa1ee67c4..765857fbc 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -1,6 +1,7 @@ package backend import ( + "context" "encoding/json" "fmt" "math" @@ -8,6 +9,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" tmrpcclient "github.com/cometbft/cometbft/rpc/client" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" @@ -20,9 +23,13 @@ import ( // TraceTransaction returns the structured logs created during the execution of EVM // and returns them as a JSON object. -func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfig) (interface{}, error) { +func (b *Backend) TraceTransaction(ctx context.Context, hash common.Hash, config *rpctypes.TraceConfig) (result interface{}, err error) { + ctx, span := tracer.Start(ctx, "TraceTransaction", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + // Get transaction by hash - transaction, err := b.GetTxByEthHash(hash) + transaction, err := b.GetTxByEthHash(ctx, hash) if err != nil { b.Logger.Debug("tx not found", "hash", hash) return nil, err @@ -33,7 +40,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfi return nil, errors.New("genesis is not traceable") } - blk, err := b.CometBlockByNumber(rpctypes.BlockNumber(transaction.Height)) + blk, err := b.CometBlockByNumber(ctx, rpctypes.BlockNumber(transaction.Height)) if err != nil { b.Logger.Debug("block not found", "height", transaction.Height) return nil, err @@ -93,7 +100,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfi return nil, errors.New("invalid rpc client") } - cp, err := nc.ConsensusParams(b.Ctx, &blk.Block.Height) + cp, err := nc.ConsensusParams(ctx, &blk.Block.Height) if err != nil { return nil, err } @@ -120,7 +127,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfi // So here we set the minimum requested height to 1. contextHeight = 1 } - traceResult, err := b.QueryClient.TraceTx(rpctypes.ContextWithHeight(contextHeight), &traceTxRequest) + traceResult, err := b.QueryClient.TraceTx(rpctypes.ContextWithHeight(contextHeight, ctx), &traceTxRequest) if err != nil { return nil, err } @@ -148,10 +155,14 @@ func (b *Backend) convertConfig(config *rpctypes.TraceConfig) *evmtypes.TraceCon // TraceBlock configures a new tracer according to the provided configuration, and // executes all the transactions contained within. The return value will be one item // per transaction, dependent on the requested tracer. -func (b *Backend) TraceBlock(height rpctypes.BlockNumber, +func (b *Backend) TraceBlock(ctx context.Context, height rpctypes.BlockNumber, config *rpctypes.TraceConfig, block *tmrpctypes.ResultBlock, -) ([]*evmtypes.TxTraceResult, error) { +) (result []*evmtypes.TxTraceResult, err error) { + ctx, span := tracer.Start(ctx, "TraceBlock", trace.WithAttributes(attribute.Int64("height", height.Int64()), attribute.String("blockHash", common.BytesToHash(block.BlockID.Hash).Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + txs := block.Block.Txs txsLength := len(txs) @@ -160,7 +171,7 @@ func (b *Backend) TraceBlock(height rpctypes.BlockNumber, return []*evmtypes.TxTraceResult{}, nil } - blockRes, err := b.CometBlockResultByNumber(&block.Block.Height) + blockRes, err := b.CometBlockResultByNumber(ctx, &block.Block.Height) if err != nil { b.Logger.Debug("block result not found", "height", block.Block.Height, "error", err.Error()) return nil, nil @@ -195,14 +206,14 @@ func (b *Backend) TraceBlock(height rpctypes.BlockNumber, // 0 is a special value for `ContextWithHeight`. contextHeight = 1 } - ctxWithHeight := rpctypes.ContextWithHeight(int64(contextHeight)) + ctxWithHeight := rpctypes.ContextWithHeight(int64(contextHeight), ctx) nc, ok := b.ClientCtx.Client.(tmrpcclient.NetworkClient) if !ok { return nil, errors.New("invalid rpc client") } - cp, err := nc.ConsensusParams(b.Ctx, &block.Block.Height) + cp, err := nc.ConsensusParams(ctx, &block.Block.Height) if err != nil { return nil, err } @@ -234,10 +245,19 @@ func (b *Backend) TraceBlock(height rpctypes.BlockNumber, // TraceCall executes a call with the given arguments and returns the structured logs // created during the execution of EVM. It returns them as a JSON object. func (b *Backend) TraceCall( + ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, config *rpctypes.TraceConfig, -) (interface{}, error) { +) (result interface{}, err error) { + var toAddr string + if args.To != nil { + toAddr = args.To.Hex() + } + ctx, span := tracer.Start(ctx, "TraceCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + // Marshal tx args bz, err := json.Marshal(&args) if err != nil { @@ -245,13 +265,13 @@ func (b *Backend) TraceCall( } // Get block number from blockNrOrHash - blockNr, err := b.BlockNumberFromComet(blockNrOrHash) + blockNr, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } // Get the block to get necessary context - header, err := b.CometHeaderByNumber(blockNr) + header, err := b.CometHeaderByNumber(ctx, blockNr) if err != nil { b.Logger.Debug("block not found", "number", blockNr) return nil, err @@ -280,7 +300,7 @@ func (b *Backend) TraceCall( } // Use the block height as context for the query - ctxWithHeight := rpctypes.ContextWithHeight(contextHeight) + ctxWithHeight := rpctypes.ContextWithHeight(contextHeight, ctx) traceResult, err := b.QueryClient.TraceCall(ctxWithHeight, &traceCallRequest) if err != nil { return nil, err diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index 9c84198ff..a2ae78780 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -1,6 +1,7 @@ package backend import ( + "context" "encoding/json" "fmt" "math" @@ -14,6 +15,8 @@ import ( "github.com/ethereum/go-ethereum/eth/tracers/logger" "github.com/ethereum/go-ethereum/params" "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" cmtrpcclient "github.com/cometbft/cometbft/rpc/client" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" @@ -30,13 +33,17 @@ import ( ) // GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash -func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error) { - res, err := b.GetTxByEthHash(txHash) +func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionByHash", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + + res, err := b.GetTxByEthHash(ctx, txHash) if err != nil { - return b.GetTransactionByHashPending(txHash) + return b.GetTransactionByHashPending(ctx, txHash) } - block, err := b.CometBlockByNumber(rpctypes.BlockNumber(res.Height)) + block, err := b.CometBlockByNumber(ctx, rpctypes.BlockNumber(res.Height)) if err != nil { return nil, err } @@ -52,7 +59,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac return nil, errors.New("invalid ethereum tx") } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &block.Block.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &block.Block.Height) if err != nil { b.Logger.Debug("block result not found", "height", block.Block.Height, "error", err.Error()) return nil, fmt.Errorf("block result not found: %w", err) @@ -60,7 +67,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac if res.EthTxIndex == -1 { // Fallback to find tx index by iterating all valid eth transactions - msgs := b.EthMsgsFromCometBlock(block, blockRes) + msgs := b.EthMsgsFromCometBlock(ctx, block, blockRes) for i := range msgs { if msgs[i].Hash() == txHash { if i > math.MaxInt32 { @@ -76,7 +83,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac return nil, errors.New("can't find index of ethereum tx") } - baseFee, err := b.BaseFee(blockRes) + baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { // handle the error for pruned node. b.Logger.Error("failed to fetch Base Fee from prunned block. Check node prunning configuration", "height", blockRes.Height, "error", err) @@ -92,15 +99,19 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac blockTime, index, baseFee, - b.ChainConfig(), + b.ChainConfig(ctx), ), nil } // GetTransactionByHashPending find pending tx from mempool -func (b *Backend) GetTransactionByHashPending(txHash common.Hash) (*rpctypes.RPCTransaction, error) { +func (b *Backend) GetTransactionByHashPending(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionByHashPending", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + hexTx := txHash.Hex() // try to find tx in mempool - txs, err := b.PendingTransactions() + txs, err := b.PendingTransactions(ctx) if err != nil { b.Logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) return nil, nil @@ -122,7 +133,7 @@ func (b *Backend) GetTransactionByHashPending(txHash common.Hash) (*rpctypes.RPC uint64(0), uint64(0), nil, - b.ChainConfig(), + b.ChainConfig(ctx), ), nil } } @@ -132,12 +143,16 @@ func (b *Backend) GetTransactionByHashPending(txHash common.Hash) (*rpctypes.RPC } // GetGasUsed returns gasUsed from transaction -func (b *Backend) GetGasUsed(res *servertypes.TxResult, price *big.Int, gas uint64) uint64 { +func (b *Backend) GetGasUsed(res *servertypes.TxResult, _ *big.Int, _ uint64) uint64 { return res.GasUsed } // GetTransactionReceipt returns the transaction receipt identified by hash. -func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { +func (b *Backend) GetTransactionReceipt(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionReceipt", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + hexTx := hash.Hex() b.Logger.Debug("eth_getTransactionReceipt", "hash", hexTx) @@ -146,10 +161,9 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ baseDelay := 50 * time.Millisecond var res *servertypes.TxResult - var err error for attempt := 0; attempt <= maxRetries; attempt++ { - res, err = b.GetTxByEthHash(hash) + res, err = b.GetTxByEthHash(ctx, hash) if err == nil { break // Found the transaction } @@ -174,7 +188,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ return nil, nil } - resBlock, err := b.CometBlockByNumber(rpctypes.BlockNumber(res.Height)) + resBlock, err := b.CometBlockByNumber(ctx, rpctypes.BlockNumber(res.Height)) if err != nil { b.Logger.Debug("block not found", "height", res.Height, "error", err.Error()) return nil, fmt.Errorf("block not found at height %d: %w", res.Height, err) @@ -186,14 +200,14 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ return nil, fmt.Errorf("failed to decode tx: %w", err) } - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &res.Height) + blockRes, err := b.RPCClient.BlockResults(ctx, &res.Height) if err != nil { b.Logger.Debug("failed to retrieve block results", "height", res.Height, "error", err.Error()) return nil, fmt.Errorf("block result not found at height %d: %w", res.Height, err) } ethMsg := tx.GetMsgs()[res.MsgIndex].(*evmtypes.MsgEthereumTx) - receipts, err := b.ReceiptsFromCometBlock(resBlock, blockRes, []*evmtypes.MsgEthereumTx{ethMsg}) + receipts, err := b.ReceiptsFromCometBlock(ctx, resBlock, blockRes, []*evmtypes.MsgEthereumTx{ethMsg}) if err != nil { return nil, fmt.Errorf("failed to get receipts from comet block") } @@ -214,10 +228,14 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ } // GetTransactionLogs returns the transaction logs identified by hash. -func (b *Backend) GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) { +func (b *Backend) GetTransactionLogs(ctx context.Context, hash common.Hash) (result []*ethtypes.Log, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + hexTx := hash.Hex() - res, err := b.GetTxByEthHash(hash) + res, err := b.GetTxByEthHash(ctx, hash) if err != nil { b.Logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) return nil, nil @@ -228,7 +246,7 @@ func (b *Backend) GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) return nil, nil } - resBlockResult, err := b.RPCClient.BlockResults(b.Ctx, &res.Height) + resBlockResult, err := b.RPCClient.BlockResults(ctx, &res.Height) if err != nil { b.Logger.Debug("block result not found", "number", res.Height, "error", err.Error()) return nil, nil @@ -252,14 +270,18 @@ func (b *Backend) GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) } // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. -func (b *Backend) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { +func (b *Backend) GetTransactionByBlockHashAndIndex(ctx context.Context, hash common.Hash, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionByBlockHashAndIndex", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Int64("idx", int64(idx)))) + defer span.End() + defer func() { span.RecordError(err) }() + b.Logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) sc, ok := b.ClientCtx.Client.(cmtrpcclient.SignClient) if !ok { return nil, errors.New("invalid rpc client") } - block, err := sc.BlockByHash(b.Ctx, hash.Bytes()) + block, err := sc.BlockByHash(ctx, hash.Bytes()) if err != nil { b.Logger.Debug("block not found", "hash", hash.Hex(), "error", err.Error()) return nil, nil @@ -270,14 +292,18 @@ func (b *Backend) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexuti return nil, nil } - return b.GetTransactionByBlockAndIndex(block, idx) + return b.GetTransactionByBlockAndIndex(ctx, block, idx) } // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. -func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { +func (b *Backend) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNum rpctypes.BlockNumber, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionByBlockNumberAndIndex", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Int64("idx", int64(idx)))) + defer span.End() + defer func() { span.RecordError(err) }() + b.Logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) - block, err := b.CometBlockByNumber(blockNum) + block, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { b.Logger.Debug("block not found", "height", blockNum.Int64(), "error", err.Error()) return nil, nil @@ -288,20 +314,24 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNum return nil, nil } - return b.GetTransactionByBlockAndIndex(block, idx) + return b.GetTransactionByBlockAndIndex(ctx, block, idx) } // GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash // TODO: Don't need to convert once hashing is fixed on CometBFT // https://github.com/cometbft/cometbft/issues/6539 -func (b *Backend) GetTxByEthHash(hash common.Hash) (*servertypes.TxResult, error) { +func (b *Backend) GetTxByEthHash(ctx context.Context, hash common.Hash) (result *servertypes.TxResult, err error) { + ctx, span := tracer.Start(ctx, "GetTxByEthHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + if b.Indexer != nil { return b.Indexer.GetByTxHash(hash) } // fallback to CometBFT tx indexer query := fmt.Sprintf("%s.%s='%s'", evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyEthereumTxHash, hash.Hex()) - txResult, err := b.QueryCometTxIndexer(query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx { + txResult, err := b.QueryCometTxIndexer(ctx, query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx { return txs.GetTxByHash(hash) }) if err != nil { @@ -311,7 +341,11 @@ func (b *Backend) GetTxByEthHash(hash common.Hash) (*servertypes.TxResult, error } // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs -func (b *Backend) GetTxByTxIndex(height int64, index uint) (*servertypes.TxResult, error) { +func (b *Backend) GetTxByTxIndex(ctx context.Context, height int64, index uint) (result *servertypes.TxResult, err error) { + ctx, span := tracer.Start(ctx, "GetTxByTxIndex", trace.WithAttributes(attribute.Int64("height", height), attribute.Int64("index", int64(index)))) + defer span.End() + defer func() { span.RecordError(err) }() + int32Index := int32(index) //#nosec G115 -- checked for int overflow already if b.Indexer != nil { return b.Indexer.GetByBlockAndIndex(height, int32Index) @@ -322,7 +356,7 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*servertypes.TxResul height, evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyTxIndex, index, ) - txResult, err := b.QueryCometTxIndexer(query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx { + txResult, err := b.QueryCometTxIndexer(ctx, query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx { return txs.GetTxByTxIndex(int(index)) // #nosec G115 -- checked for int overflow already }) if err != nil { @@ -332,8 +366,12 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*servertypes.TxResul } // QueryCometTxIndexer query tx in CometBFT tx indexer -func (b *Backend) QueryCometTxIndexer(query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (*servertypes.TxResult, error) { - resTxs, err := b.ClientCtx.Client.TxSearch(b.Ctx, query, false, nil, nil, "") +func (b *Backend) QueryCometTxIndexer(ctx context.Context, query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (result *servertypes.TxResult, err error) { + ctx, span := tracer.Start(ctx, "QueryCometTxIndexer") + defer span.End() + defer func() { span.RecordError(err) }() + + resTxs, err := b.ClientCtx.Client.TxSearch(ctx, query, false, nil, nil, "") if err != nil { return nil, err } @@ -358,15 +396,19 @@ func (b *Backend) QueryCometTxIndexer(query string, txGetter func(*rpctypes.Pars } // GetTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`. -func (b *Backend) GetTransactionByBlockAndIndex(block *cmtrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { - blockRes, err := b.RPCClient.BlockResults(b.Ctx, &block.Block.Height) +func (b *Backend) GetTransactionByBlockAndIndex(ctx context.Context, block *cmtrpctypes.ResultBlock, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "GetTransactionByBlockAndIndex", trace.WithAttributes(attribute.Int64("blockHeight", block.Block.Height), attribute.Int64("idx", int64(idx)))) + defer span.End() + defer func() { span.RecordError(err) }() + + blockRes, err := b.RPCClient.BlockResults(ctx, &block.Block.Height) if err != nil { return nil, nil } var msg *evmtypes.MsgEthereumTx // find in tx indexer - res, err := b.GetTxByTxIndex(block.Block.Height, uint(idx)) + res, err := b.GetTxByTxIndex(ctx, block.Block.Height, uint(idx)) if err == nil { tx, err := b.ClientCtx.TxConfig.TxDecoder()(block.Block.Txs[res.TxIndex]) if err != nil { @@ -383,7 +425,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *cmtrpctypes.ResultBlock, } } else { i := int(idx) // #nosec G115 - ethMsgs := b.EthMsgsFromCometBlock(block, blockRes) + ethMsgs := b.EthMsgsFromCometBlock(ctx, block, blockRes) if i >= len(ethMsgs) { b.Logger.Debug("block txs index out of bound", "index", i) return nil, nil @@ -392,7 +434,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *cmtrpctypes.ResultBlock, msg = ethMsgs[i] } - baseFee, err := b.BaseFee(blockRes) + baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { // handle the error for pruned node. b.Logger.Error("failed to fetch Base Fee from prunned block. Check node prunning configuration", "height", block.Block.Height, "error", err) @@ -408,31 +450,36 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *cmtrpctypes.ResultBlock, blockTime, index, baseFee, - b.ChainConfig(), + b.ChainConfig(ctx), ), nil } // CreateAccessList returns the list of addresses and storage keys used by the transaction (except for the // sender account and precompiles), plus the estimated gas if the access list were added to the transaction. func (b *Backend) CreateAccessList( + ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, -) (*rpctypes.AccessListResult, error) { - accessList, gasUsed, vmErr, err := b.createAccessList(args, blockNrOrHash, overrides) +) (result *rpctypes.AccessListResult, err error) { + ctx, span := tracer.Start(ctx, "CreateAccessList", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) + defer span.End() + defer func() { span.RecordError(err) }() + + accessList, gasUsed, vmErr, err := b.createAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { return nil, err } hexGasUsed := hexutil.Uint64(gasUsed) - result := rpctypes.AccessListResult{ + res := rpctypes.AccessListResult{ AccessList: &accessList, GasUsed: &hexGasUsed, } if vmErr != nil { - result.Error = vmErr.Error() + res.Error = vmErr.Error() } - return &result, nil + return &res, nil } // createAccessList creates the access list for the transaction. @@ -441,29 +488,32 @@ func (b *Backend) CreateAccessList( // If the access list has not converged, an error is returned. // If the transaction itself fails, an vmErr is returned. func (b *Backend) createAccessList( + ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, ) (ethtypes.AccessList, uint64, error, error) { - args, err := b.SetTxDefaults(args) + ctx, span := tracer.Start(ctx, "createAccessList") + defer span.End() + args, err := b.SetTxDefaults(ctx, args) if err != nil { b.Logger.Error("failed to set tx defaults", "error", err) return nil, 0, nil, err } - blockNum, err := b.BlockNumberFromComet(blockNrOrHash) + blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { b.Logger.Error("failed to get block number", "error", err) return nil, 0, nil, err } - addressesToExclude, err := b.getAccessListExcludes(args, blockNum) + addressesToExclude, err := b.getAccessListExcludes(ctx, args, blockNum) if err != nil { b.Logger.Error("failed to get access list excludes", "error", err) return nil, 0, nil, err } - prevTracer, traceArgs, err := b.initAccessListTracer(args, blockNum, addressesToExclude) + prevTracer, traceArgs, err := b.initAccessListTracer(ctx, args, blockNum, addressesToExclude) if err != nil { b.Logger.Error("failed to init access list tracer", "error", err) return nil, 0, nil, err @@ -473,7 +523,7 @@ func (b *Backend) createAccessList( for { accessList := prevTracer.AccessList() traceArgs.AccessList = &accessList - res, err := b.DoCall(*traceArgs, blockNum, overrides) + res, err := b.DoCall(ctx, *traceArgs, blockNum, overrides) if err != nil { b.Logger.Error("failed to apply transaction", "error", err) return nil, 0, nil, fmt.Errorf("failed to apply transaction: %v err: %v", traceArgs.ToTransaction(ethtypes.LegacyTxType).Hash(), err) @@ -497,8 +547,10 @@ func (b *Backend) createAccessList( // getAccessListExcludes returns the addresses to exclude from the access list. // This includes the sender account, the target account (if provided), precompiles, // and any addresses in the authorization list. -func (b *Backend) getAccessListExcludes(args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber) (map[common.Address]struct{}, error) { - header, err := b.HeaderByNumber(blockNum) +func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber) (map[common.Address]struct{}, error) { + ctx, span := tracer.Start(ctx, "getAccessListExcludes") + defer span.End() + header, err := b.HeaderByNumber(ctx, blockNum) if err != nil { b.Logger.Error("failed to get header by number", "error", err) return nil, err @@ -511,8 +563,8 @@ func (b *Backend) getAccessListExcludes(args evmtypes.TransactionArgs, blockNum addressesToExclude[*args.To] = struct{}{} } - isMerge := b.ChainConfig().MergeNetsplitBlock != nil - precompiles := vm.ActivePrecompiles(b.ChainConfig().Rules(header.Number, isMerge, header.Time)) + isMerge := b.ChainConfig(ctx).MergeNetsplitBlock != nil + precompiles := vm.ActivePrecompiles(b.ChainConfig(ctx).Rules(header.Number, isMerge, header.Time)) for _, addr := range precompiles { addressesToExclude[addr] = struct{}{} } @@ -527,7 +579,7 @@ func (b *Backend) getAccessListExcludes(args evmtypes.TransactionArgs, blockNum for _, auth := range args.AuthorizationList { // validate authorization (duplicating stateTransition.validateAuthorization() logic from geth: https://github.com/ethereum/go-ethereum/blob/bf8f63dcd27e178bd373bfe41ea718efee2851dd/core/state_transition.go#L575) nonceOverflow := auth.Nonce+1 < auth.Nonce - invalidChainID := !auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0 + invalidChainID := !auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig(ctx).ChainID) != 0 if nonceOverflow || invalidChainID { b.Logger.Error("invalid authorization", "auth", auth) continue @@ -544,8 +596,10 @@ func (b *Backend) getAccessListExcludes(args evmtypes.TransactionArgs, blockNum // initAccessListTracer initializes the access list tracer for the transaction. // It sets the default call arguments and creates a new access list tracer. // If an access list is provided in args, it uses that instead of creating a new one. -func (b *Backend) initAccessListTracer(args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber, addressesToExclude map[common.Address]struct{}) (*logger.AccessListTracer, *evmtypes.TransactionArgs, error) { - header, err := b.HeaderByNumber(blockNum) +func (b *Backend) initAccessListTracer(ctx context.Context, args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber, addressesToExclude map[common.Address]struct{}) (*logger.AccessListTracer, *evmtypes.TransactionArgs, error) { + ctx, span := tracer.Start(ctx, "initAccessListTracer") + defer span.End() + header, err := b.HeaderByNumber(ctx, blockNum) if err != nil { b.Logger.Error("failed to get header by number", "error", err) return nil, nil, err @@ -553,7 +607,7 @@ func (b *Backend) initAccessListTracer(args evmtypes.TransactionArgs, blockNum r if args.Nonce == nil { pending := blockNum == rpctypes.EthPendingBlockNumber - nonce, err := b.getAccountNonce(args.GetFrom(), pending, blockNum.Int64(), b.Logger) + nonce, err := b.getAccountNonce(ctx, args.GetFrom(), pending, blockNum.Int64(), b.Logger) if err != nil { b.Logger.Error("failed to get account nonce", "error", err) return nil, nil, err @@ -561,7 +615,7 @@ func (b *Backend) initAccessListTracer(args evmtypes.TransactionArgs, blockNum r nonce64 := hexutil.Uint64(nonce) args.Nonce = &nonce64 } - if err = args.CallDefaults(b.RPCGasCap(), header.BaseFee, b.ChainConfig().ChainID); err != nil { + if err = args.CallDefaults(b.RPCGasCap(), header.BaseFee, b.ChainConfig(ctx).ChainID); err != nil { b.Logger.Error("failed to set default call args", "error", err) return nil, nil, err } diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index 01bc77791..c8bbded75 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -77,7 +77,6 @@ func setupMockBackend(t *testing.T) *Backend { mockFeeMarketQueryClient := mocks.NewFeeMarketQueryClient(t) backend.QueryClient.QueryClient = mockEVMQueryClient backend.QueryClient.FeeMarket = mockFeeMarketQueryClient - backend.Ctx = rpctypes.ContextWithHeight(1) mockClient := backend.ClientCtx.Client.(*mocks.Client) mockClient.On("Status", context.Background()).Return(&tmrpctypes.ResultStatus{ @@ -376,7 +375,7 @@ func TestCreateAccessList(t *testing.T) { require.NotEqual(t, common.Address{}, args.GetFrom(), "From address should not be zero") } - result, err := backend.CreateAccessList(args, blockNumOrHash, tc.overrides) + result, err := backend.CreateAccessList(rpctypes.ContextWithHeight(1), args, blockNumOrHash, tc.overrides) if tc.expectError { require.Error(t, err) @@ -491,7 +490,7 @@ func TestReceiptsFromCometBlock(t *testing.T) { backend.Indexer = mockIndexer mockEVMQueryClient := backend.QueryClient.QueryClient.(*mocks.EVMQueryClient) mockEVMQueryClient.On("BaseFee", mock.Anything, mock.Anything).Return(&evmtypes.QueryBaseFeeResponse{}, nil) - receipts, err := backend.ReceiptsFromCometBlock(resBlock, blockRes, msgs) + receipts, err := backend.ReceiptsFromCometBlock(rpctypes.ContextWithHeight(1), resBlock, blockRes, msgs) require.NoError(t, err) require.Len(t, receipts, 1) actualTxIndex := receipts[0].TransactionIndex diff --git a/rpc/backend/tx_pool.go b/rpc/backend/tx_pool.go index 61b980e3b..c707be3c2 100644 --- a/rpc/backend/tx_pool.go +++ b/rpc/backend/tx_pool.go @@ -1,12 +1,15 @@ package backend import ( + "context" "fmt" "strconv" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/rpc/types" ) @@ -19,14 +22,18 @@ const ( // The code style for this API is based off of the Go-Ethereum implementation: // Content returns the transactions contained within the transaction pool. -func (b *Backend) Content() (map[string]map[string]map[string]*types.RPCTransaction, error) { +func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map[string]*types.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "Content") + defer span.End() + defer func() { span.RecordError(err) }() + content := map[string]map[string]map[string]*types.RPCTransaction{ StatusPending: make(map[string]map[string]*types.RPCTransaction), StatusQueued: make(map[string]map[string]*types.RPCTransaction), } // Get current block header - curHeader, err := b.CurrentHeader() + curHeader, err := b.CurrentHeader(ctx) if err != nil { return content, fmt.Errorf("failed to get current header: %w", err) } @@ -48,7 +55,7 @@ func (b *Backend) Content() (map[string]map[string]map[string]*types.RPCTransact } for _, tx := range txList { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) content[StatusPending][addrStr][strconv.FormatUint(tx.Nonce(), 10)] = rpcTx } } @@ -61,7 +68,7 @@ func (b *Backend) Content() (map[string]map[string]map[string]*types.RPCTransact } for _, tx := range txList { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) content[StatusQueued][addrStr][strconv.FormatUint(tx.Nonce(), 10)] = rpcTx } } @@ -70,11 +77,15 @@ func (b *Backend) Content() (map[string]map[string]map[string]*types.RPCTransact } // ContentFrom returns the transactions contained within the transaction pool -func (b *Backend) ContentFrom(addr common.Address) (map[string]map[string]*types.RPCTransaction, error) { +func (b *Backend) ContentFrom(ctx context.Context, addr common.Address) (result map[string]map[string]*types.RPCTransaction, err error) { + ctx, span := tracer.Start(ctx, "ContentFrom", trace.WithAttributes(attribute.String("address", addr.Hex()))) + defer span.End() + defer func() { span.RecordError(err) }() + content := make(map[string]map[string]*types.RPCTransaction, 2) // Get current block header - curHeader, err := b.CurrentHeader() + curHeader, err := b.CurrentHeader(ctx) if err != nil { return content, fmt.Errorf("failed to get current header: %w", err) } @@ -91,7 +102,7 @@ func (b *Backend) ContentFrom(addr common.Address) (map[string]map[string]*types // Build the pending transactions dump := make(map[string]*types.RPCTransaction, len(pending)) // variable name comes from go-ethereum: https://github.com/ethereum/go-ethereum/blob/0dacfef8ac42e7be5db26c2956f2b238ba7c75e8/internal/ethapi/api.go#L221 for _, tx := range pending { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) dump[fmt.Sprintf("%d", tx.Nonce())] = rpcTx } content[StatusPending] = dump @@ -99,7 +110,7 @@ func (b *Backend) ContentFrom(addr common.Address) (map[string]map[string]*types // Build the queued transactions dump = make(map[string]*types.RPCTransaction, len(queue)) // variable name comes from go-ethereum: https://github.com/ethereum/go-ethereum/blob/0dacfef8ac42e7be5db26c2956f2b238ba7c75e8/internal/ethapi/api.go#L221 for _, tx := range queue { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) dump[fmt.Sprintf("%d", tx.Nonce())] = rpcTx } content[StatusQueued] = dump @@ -108,7 +119,7 @@ func (b *Backend) ContentFrom(addr common.Address) (map[string]map[string]*types } // Inspect returns the content of the transaction pool and flattens it into an easily inspectable list. -func (b *Backend) Inspect() (map[string]map[string]map[string]string, error) { +func (b *Backend) Inspect(_ context.Context) (map[string]map[string]map[string]string, error) { inspect := map[string]map[string]map[string]string{ StatusPending: make(map[string]map[string]string), StatusQueued: make(map[string]map[string]string), @@ -155,7 +166,7 @@ func (b *Backend) Inspect() (map[string]map[string]map[string]string, error) { } // Status returns the number of pending and queued transaction in the pool. -func (b *Backend) Status() (map[string]hexutil.Uint, error) { +func (b *Backend) Status(_ context.Context) (map[string]hexutil.Uint, error) { // Get the global mempool instance evmMempool := b.Mempool if evmMempool == nil { diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index ca46109b0..777cf355e 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" "math" "math/big" @@ -49,10 +50,12 @@ func (s sortGasAndReward) Less(i, j int) bool { // If the pending value is true, it will iterate over the mempool (pending) // txs in order to compute and return the pending tx sequence. // Todo: include the ability to specify a blockNumber -func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { +func (b *Backend) getAccountNonce(ctx context.Context, accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { + ctx, span := tracer.Start(ctx, "getAccountNonce") + defer span.End() queryClient := authtypes.NewQueryClient(b.ClientCtx) adr := sdk.AccAddress(accAddr.Bytes()).String() - ctx := types.ContextWithHeight(height) + ctx = types.ContextWithHeight(height, ctx) res, err := queryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: adr}) if err != nil { st, ok := status.FromError(err) @@ -81,7 +84,7 @@ func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height i // the account retriever doesn't include the uncommitted transactions on the nonce so we need to // to manually add them. - pendingTxs, err := b.PendingTransactions() + pendingTxs, err := b.PendingTransactions(ctx) if err != nil { logger.Error("failed to fetch pending transactions", "error", err.Error()) return nonce, nil @@ -122,6 +125,7 @@ func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height i // - Transaction reward percentiles based on effective gas tip values // // Parameters: +// - ctx: Context for the request // - cometBlock: The raw CometBFT block containing transaction data // - ethBlock: Ethereum-formatted block with gas limit and usage information // - rewardPercentiles: Percentile values (0-100) for reward calculation @@ -130,20 +134,23 @@ func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height i // // Returns an error if block processing fails due to invalid data types or calculation errors. func (b *Backend) ProcessBlock( + ctx context.Context, cometBlock *cmtrpctypes.ResultBlock, ethBlock *map[string]interface{}, rewardPercentiles []float64, cometBlockResult *cmtrpctypes.ResultBlockResults, targetOneFeeHistory *types.OneFeeHistory, ) error { + ctx, span := tracer.Start(ctx, "ProcessBlock") + defer span.End() blockHeight := cometBlock.Block.Height - blockBaseFee, err := b.BaseFee(cometBlockResult) + blockBaseFee, err := b.BaseFee(ctx, cometBlockResult) if err != nil || blockBaseFee == nil { targetOneFeeHistory.BaseFee = big.NewInt(0) } else { targetOneFeeHistory.BaseFee = blockBaseFee } - cfg := b.ChainConfig() + cfg := b.ChainConfig(ctx) gasLimitUint64, ok := (*ethBlock)["gasLimit"].(hexutil.Uint64) if !ok { return fmt.Errorf("invalid gas limit type: %T", (*ethBlock)["gasLimit"]) @@ -176,7 +183,7 @@ func (b *Backend) ProcessBlock( targetOneFeeHistory.BlobGasUsedRatio = 0 if cfg.IsLondon(big.NewInt(blockHeight + 1)) { - ctx := types.ContextWithHeight(blockHeight) + ctx = types.ContextWithHeight(blockHeight, ctx) params, err := b.QueryClient.FeeMarket.Params(ctx, &feemarkettypes.QueryParamsRequest{}) if err != nil { return err diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 65ff0c5e7..79231b6f4 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -2,6 +2,7 @@ package debug import ( "bytes" + "context" "errors" "fmt" "io" @@ -19,6 +20,9 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" stderrors "github.com/pkg/errors" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/rpc/backend" rpctypes "github.com/cosmos/evm/rpc/types" @@ -29,6 +33,8 @@ import ( "github.com/cosmos/cosmos-sdk/server" ) +var tracer = otel.Tracer("evm/rpc/namespaces/ethereum/debug") + // HandlerT keeps track of the cpu profiler and trace execution type HandlerT struct { cpuFilename string @@ -66,32 +72,38 @@ func NewAPI( // and returns them as a JSON object. func (a *API) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfig) (interface{}, error) { a.logger.Debug("debug_traceTransaction", "hash", hash) - return a.backend.TraceTransaction(hash, config) + ctx, span := tracer.Start(context.Background(), "eth_traceTransaction", trace.WithAttributes(attribute.String("hash", hash.String()))) + defer span.End() + return a.backend.TraceTransaction(ctx, hash, config) } // TraceBlockByNumber returns the structured logs created during the execution of // EVM and returns them as a JSON object. -func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *rpctypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { +func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *rpctypes.TraceConfig) (res []*evmtypes.TxTraceResult, err error) { a.logger.Debug("debug_traceBlockByNumber", "height", height) + ctx, span := tracer.Start(context.Background(), "eth_traceBlockByNumber", trace.WithAttributes(attribute.Int64("height", int64(height)))) + defer span.End() if height == 0 { return nil, errors.New("genesis is not traceable") } // Get CometBFT Block - resBlock, err := a.backend.CometBlockByNumber(height) + resBlock, err := a.backend.CometBlockByNumber(ctx, height) if err != nil { a.logger.Debug("get block failed", "height", height, "error", err.Error()) return nil, err } - return a.backend.TraceBlock(rpctypes.BlockNumber(resBlock.Block.Height), config, resBlock) + return a.backend.TraceBlock(ctx, rpctypes.BlockNumber(resBlock.Block.Height), config, resBlock) } // TraceBlockByHash returns the structured logs created during the execution of // EVM and returns them as a JSON object. func (a *API) TraceBlockByHash(hash common.Hash, config *rpctypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { a.logger.Debug("debug_traceBlockByHash", "hash", hash) + ctx, span := tracer.Start(context.Background(), "eth_traceBlockByHash") + defer span.End() // Get CometBFT Block - resBlock, err := a.backend.CometBlockByHash(hash) + resBlock, err := a.backend.CometBlockByHash(ctx, hash) if err != nil { a.logger.Debug("get block failed", "hash", hash.Hex(), "error", err.Error()) return nil, err @@ -102,13 +114,15 @@ func (a *API) TraceBlockByHash(hash common.Hash, config *rpctypes.TraceConfig) ( return nil, errors.New("block not found") } - return a.backend.TraceBlock(rpctypes.BlockNumber(resBlock.Block.Height), config, resBlock) + return a.backend.TraceBlock(ctx, rpctypes.BlockNumber(resBlock.Block.Height), config, resBlock) } // TraceBlock returns the structured logs created during the execution of // EVM and returns them as a JSON object. It accepts an RLP-encoded block. -func (a *API) TraceBlock(tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { +func (a *API) TraceBlock(ctx context.Context, tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { a.logger.Debug("debug_traceBlock", "size", len(tblockRlp)) + ctx, span := tracer.Start(ctx, "eth_traceBlock") + defer span.End() // Decode RLP-encoded block var block types.Block if err := rlp.DecodeBytes(tblockRlp, &block); err != nil { @@ -125,7 +139,7 @@ func (a *API) TraceBlock(tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) a.logger.Debug("decoded block", "number", blockNumber, "hash", block.Hash().Hex()) // Get CometBFT block by number (not hash, as Ethereum block hash may differ from CometBFT hash) - resBlock, err := a.backend.CometBlockByNumber(blockNumber) + resBlock, err := a.backend.CometBlockByNumber(ctx, blockNumber) if err != nil { a.logger.Debug("get block failed", "number", blockNumber, "error", err.Error()) return nil, err @@ -136,29 +150,32 @@ func (a *API) TraceBlock(tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) return nil, errors.New("block not found") } - return a.backend.TraceBlock(blockNumber, config, resBlock) + return a.backend.TraceBlock(ctx, blockNumber, config, resBlock) } // TraceCall lets you trace a given eth_call. It collects the structured logs // created during the execution of EVM if the given transaction was added on // top of the provided block and returns them as a JSON object. -func (a *API) TraceCall(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, config *rpctypes.TraceConfig) (interface{}, error) { +func (a *API) TraceCall(ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, config *rpctypes.TraceConfig) (interface{}, error) { a.logger.Debug("debug_traceCall", "args", args, "block number or hash", blockNrOrHash) - return a.backend.TraceCall(args, blockNrOrHash, config) + ctx, span := tracer.Start(context.Background(), "eth_traceCall") + defer span.End() + return a.backend.TraceCall(ctx, args, blockNrOrHash, config) } // GetRawBlock retrieves the RLP-encoded block by block number or hash. -func (a *API) GetRawBlock(blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { +func (a *API) GetRawBlock(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { a.logger.Debug("debug_getRawBlock", "block number or hash", blockNrOrHash) - + ctx, span := tracer.Start(ctx, "eth_getRawBlock") + defer span.End() // Get block number from blockNrOrHash - blockNum, err := a.backend.BlockNumberFromComet(blockNrOrHash) + blockNum, err := a.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } // Get Ethereum block by number - block, err := a.backend.EthBlockByNumber(blockNum) + block, err := a.backend.EthBlockByNumber(ctx, blockNum) if err != nil { return nil, err } @@ -407,10 +424,12 @@ func (a *API) SetGCPercent(v int) (int, error) { // GetHeaderRlp retrieves the RLP encoded for of a single header. func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_getHeaderRlp") + defer span.End() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled } - header, err := a.backend.HeaderByNumber(rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value + header, err := a.backend.HeaderByNumber(ctx, rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value if err != nil { return nil, err } @@ -420,10 +439,12 @@ func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { // GetBlockRlp retrieves the RLP encoded for of a single block. func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_getBlockRlp") + defer span.End() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled } - block, err := a.backend.EthBlockByNumber(rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value + block, err := a.backend.EthBlockByNumber(ctx, rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value if err != nil { return nil, err } @@ -433,10 +454,12 @@ func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { // PrintBlock retrieves a block and returns its pretty printed form. func (a *API) PrintBlock(number uint64) (string, error) { + ctx, span := tracer.Start(context.Background(), "eth_printBlock") + defer span.End() if !a.profilingEnabled { return "", rpctypes.ErrProfilingDisabled } - block, err := a.backend.EthBlockByNumber(rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value + block, err := a.backend.EthBlockByNumber(ctx, rpctypes.BlockNumber(number)) //#nosec G115 -- int overflow is not a concern here -- block number is not likely to exceed int64 max value if err != nil { return "", err } diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 9521f41b0..787283def 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -4,20 +4,22 @@ import ( "context" "encoding/json" + "github.com/cosmos/evm/rpc/backend" + rpctypes "github.com/cosmos/evm/rpc/types" + evmtypes "github.com/cosmos/evm/x/vm/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/signer/core/apitypes" - - "github.com/cosmos/evm/rpc/backend" - rpctypes "github.com/cosmos/evm/rpc/types" - evmtypes "github.com/cosmos/evm/x/vm/types" + "go.opentelemetry.io/otel" "cosmossdk.io/log" ) +var tracer = otel.Tracer("evm/rpc/namespaces/ethereum/eth") + // The Ethereum API allows applications to connect to an node of any Cosmos EVM based blockchain. // Developers can interact with on-chain EVM data // and send different types of transactions to the network by utilizing the @@ -134,14 +136,18 @@ func NewPublicAPI(logger log.Logger, backend backend.EVMBackend) *PublicAPI { // - When blockNr is -3 the chain finalized header is returned. // - When blockNr is -4 the chain safe header is returned. func (e *PublicAPI) GetHeaderByNumber(ethBlockNum rpctypes.BlockNumber) (map[string]interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_getHeaderByNumber") + defer span.End() e.logger.Debug("eth_getHeaderByNumber", "number", ethBlockNum) - return e.backend.GetHeaderByNumber(ethBlockNum) + return e.backend.GetHeaderByNumber(ctx, ethBlockNum) } // GetHeaderByHash returns the requested header by hash. func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (map[string]interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_getHeaderByHash") + defer span.End() e.logger.Debug("eth_getHeaderByHash", "hash", hash.Hex()) - return e.backend.GetHeaderByHash(hash) + return e.backend.GetHeaderByHash(ctx, hash) } //////////////////////////////////////////////////////////////////////////////////////// @@ -150,26 +156,34 @@ func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (map[string]interface{}, e // BlockNumber returns the current block number. func (e *PublicAPI) BlockNumber() (hexutil.Uint64, error) { + ctx, span := tracer.Start(context.Background(), "eth_blockNumber") + defer span.End() e.logger.Debug("eth_blockNumber") - return e.backend.BlockNumber() + return e.backend.BlockNumber(ctx) } // GetBlockByNumber returns the block identified by number. func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_getBlockByNumber") + defer span.End() e.logger.Debug("eth_getBlockByNumber", "number", ethBlockNum, "full", fullTx) - return e.backend.GetBlockByNumber(ethBlockNum, fullTx) + return e.backend.GetBlockByNumber(ctx, ethBlockNum, fullTx) } // GetBlockByHash returns the block identified by hash. func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_getBlockByHash") + defer span.End() e.logger.Debug("eth_getBlockByHash", "hash", hash.Hex(), "full", fullTx) - return e.backend.GetBlockByHash(hash, fullTx) + return e.backend.GetBlockByHash(ctx, hash, fullTx) } // GetBlockReceipts returns the block receipts for the given block hash or number or tag. func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) ([]map[string]interface{}, error) { + ctx, span := tracer.Start(ctx, "eth_getBlockReceipts") + defer span.End() e.logger.Debug("eth_getBlockReceipts", "block number or hash", blockNrOrHash) - return e.backend.GetBlockReceipts(blockNrOrHash) + return e.backend.GetBlockReceipts(ctx, blockNrOrHash) } /////////////////////////////////////////////////////////////////////////////// @@ -178,49 +192,63 @@ func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes // GetTransactionByHash returns the transaction identified by hash. func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTransaction, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionByHash") + defer span.End() e.logger.Debug("eth_getTransactionByHash", "hash", hash.Hex()) - return e.backend.GetTransactionByHash(hash) + return e.backend.GetTransactionByHash(ctx, hash) } // GetTransactionCount returns the number of transactions at the given address up to the given block number. func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Uint64, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionCount") + defer span.End() e.logger.Debug("eth_getTransactionCount", "address", address.Hex(), "block number or hash", blockNrOrHash) - blockNum, err := e.backend.BlockNumberFromComet(blockNrOrHash) + blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } - return e.backend.GetTransactionCount(address, blockNum) + return e.backend.GetTransactionCount(ctx, address, blockNum) } // GetTransactionReceipt returns the transaction receipt identified by hash. func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionReceipt") + defer span.End() hexTx := hash.Hex() e.logger.Debug("eth_getTransactionReceipt", "hash", hexTx) - return e.backend.GetTransactionReceipt(hash) + return e.backend.GetTransactionReceipt(ctx, hash) } // GetBlockTransactionCountByHash returns the number of transactions in the block identified by hash. func (e *PublicAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint { + ctx, span := tracer.Start(context.Background(), "eth_getBlockTransactionCountByHash") + defer span.End() e.logger.Debug("eth_getBlockTransactionCountByHash", "hash", hash.Hex()) - return e.backend.GetBlockTransactionCountByHash(hash) + return e.backend.GetBlockTransactionCountByHash(ctx, hash) } // GetBlockTransactionCountByNumber returns the number of transactions in the block identified by number. func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint { + ctx, span := tracer.Start(context.Background(), "eth_getBlockTransactionCountByNumber") + defer span.End() e.logger.Debug("eth_getBlockTransactionCountByNumber", "height", blockNum.Int64()) - return e.backend.GetBlockTransactionCountByNumber(blockNum) + return e.backend.GetBlockTransactionCountByNumber(ctx, blockNum) } // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockHashAndIndex") + defer span.End() e.logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) - return e.backend.GetTransactionByBlockHashAndIndex(hash, idx) + return e.backend.GetTransactionByBlockHashAndIndex(ctx, hash, idx) } // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockNumberAndIndex") + defer span.End() e.logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) - return e.backend.GetTransactionByBlockNumberAndIndex(blockNum, idx) + return e.backend.GetTransactionByBlockNumberAndIndex(ctx, blockNum, idx) } /////////////////////////////////////////////////////////////////////////////// @@ -229,14 +257,18 @@ func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockN // SendRawTransaction send a raw Ethereum transaction. func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { + ctx, span := tracer.Start(context.Background(), "eth_sendRawTransaction") + defer span.End() e.logger.Debug("eth_sendRawTransaction", "length", len(data)) - return e.backend.SendRawTransaction(data) + return e.backend.SendRawTransaction(ctx, data) } // SendTransaction sends an Ethereum transaction. func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { + ctx, span := tracer.Start(context.Background(), "eth_sendTransaction") + defer span.End() e.logger.Debug("eth_sendTransaction", "args", args) - return e.backend.SendTransaction(args) + return e.backend.SendTransaction(ctx, args) } /////////////////////////////////////////////////////////////////////////////// @@ -245,26 +277,34 @@ func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, // Accounts returns the list of accounts available to this node. func (e *PublicAPI) Accounts() ([]common.Address, error) { + ctx, span := tracer.Start(context.Background(), "eth_accounts") + defer span.End() e.logger.Debug("eth_accounts") - return e.backend.Accounts() + return e.backend.Accounts(ctx) } // GetBalance returns the provided account's balance up to the provided block number. func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error) { + ctx, span := tracer.Start(context.Background(), "eth_getBalance") + defer span.End() e.logger.Debug("eth_getBalance", "address", address.String(), "block number or hash", blockNrOrHash) - return e.backend.GetBalance(address, blockNrOrHash) + return e.backend.GetBalance(ctx, address, blockNrOrHash) } // GetStorageAt returns the contract storage at the given address, block number, and key. func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_getStorageAt") + defer span.End() e.logger.Debug("eth_getStorageAt", "address", address.Hex(), "key", key, "block number or hash", blockNrOrHash) - return e.backend.GetStorageAt(address, key, blockNrOrHash) + return e.backend.GetStorageAt(ctx, address, key, blockNrOrHash) } // GetCode returns the contract code at the given address and block number. func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_getCode") + defer span.End() e.logger.Debug("eth_getCode", "address", address.Hex(), "block number or hash", blockNrOrHash) - return e.backend.GetCode(address, blockNrOrHash) + return e.backend.GetCode(ctx, address, blockNrOrHash) } // GetProof returns an account object with proof and any storage proofs @@ -272,8 +312,10 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash, ) (*rpctypes.AccountResult, error) { + ctx, span := tracer.Start(context.Background(), "eth_getProof") + defer span.End() e.logger.Debug("eth_getProof", "address", address.Hex(), "keys", storageKeys, "block number or hash", blockNrOrHash) - return e.backend.GetProof(address, storageKeys, blockNrOrHash) + return e.backend.GetProof(ctx, address, storageKeys, blockNrOrHash) } /////////////////////////////////////////////////////////////////////////////// @@ -286,13 +328,15 @@ func (e *PublicAPI) Call( blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, ) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_call") + defer span.End() e.logger.Debug("eth_call", "args", args, "block number or hash", blockNrOrHash) - blockNum, err := e.backend.BlockNumberFromComet(blockNrOrHash) + blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { return nil, err } - data, err := e.backend.DoCall(args, blockNum, overrides) + data, err := e.backend.DoCall(ctx, args, blockNum, overrides) if err != nil { return []byte{}, err } @@ -317,14 +361,18 @@ func (e *PublicAPI) ProtocolVersion() hexutil.Uint { // GasPrice returns the current gas price based on Cosmos EVM's gas price oracle. func (e *PublicAPI) GasPrice() (*hexutil.Big, error) { + ctx, span := tracer.Start(context.Background(), "eth_gasPrice") + defer span.End() e.logger.Debug("eth_gasPrice") - return e.backend.GasPrice() + return e.backend.GasPrice(ctx) } // EstimateGas returns an estimate of gas usage for the given smart contract call. func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, overrides *json.RawMessage) (hexutil.Uint64, error) { + ctx, span := tracer.Start(context.Background(), "eth_estimateGas") + defer span.End() e.logger.Debug("eth_estimateGas") - return e.backend.EstimateGas(args, blockNrOrHash, overrides) + return e.backend.EstimateGas(ctx, args, blockNrOrHash, overrides) } func (e *PublicAPI) FeeHistory( @@ -332,18 +380,22 @@ func (e *PublicAPI) FeeHistory( lastBlock rpc.BlockNumber, rewardPercentiles []float64, ) (*rpctypes.FeeHistoryResult, error) { + ctx, span := tracer.Start(context.Background(), "eth_feeHistory") + defer span.End() e.logger.Debug("eth_feeHistory") - return e.backend.FeeHistory(blockCount, lastBlock, rewardPercentiles) + return e.backend.FeeHistory(ctx, blockCount, lastBlock, rewardPercentiles) } // MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions. func (e *PublicAPI) MaxPriorityFeePerGas() (*hexutil.Big, error) { + ctx, span := tracer.Start(context.Background(), "eth_maxPriorityFeePerGas") + defer span.End() e.logger.Debug("eth_maxPriorityFeePerGas") - head, err := e.backend.CurrentHeader() + head, err := e.backend.CurrentHeader(ctx) if err != nil { return nil, err } - tipcap, err := e.backend.SuggestGasTipCap(head.BaseFee) + tipcap, err := e.backend.SuggestGasTipCap(ctx, head.BaseFee) if err != nil { return nil, err } @@ -352,8 +404,10 @@ func (e *PublicAPI) MaxPriorityFeePerGas() (*hexutil.Big, error) { // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint + ctx, span := tracer.Start(context.Background(), "eth_chainId") + defer span.End() e.logger.Debug("eth_chainId") - return e.backend.ChainID() + return e.backend.ChainID(ctx) } /////////////////////////////////////////////////////////////////////////////// @@ -392,35 +446,45 @@ func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.U // - pulledStates: number of state entries processed until now // - knownStates: number of known state entries that still need to be pulled func (e *PublicAPI) Syncing() (interface{}, error) { + ctx, span := tracer.Start(context.Background(), "eth_syncing") + defer span.End() e.logger.Debug("eth_syncing") - return e.backend.Syncing() + return e.backend.Syncing(ctx) } // Sign signs the provided data using the private key of address via Geth's signature standard. func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_sign") + defer span.End() e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) - return e.backend.Sign(address, data) + return e.backend.Sign(ctx, address, data) } // GetTransactionLogs returns the logs given a transaction hash. func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) { + ctx, span := tracer.Start(context.Background(), "eth_getTransactionLogs") + defer span.End() e.logger.Debug("eth_getTransactionLogs", "hash", txHash) - return e.backend.GetTransactionLogs(txHash) + return e.backend.GetTransactionLogs(ctx, txHash) } // SignTypedData signs EIP-712 conformant typed data func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { + ctx, span := tracer.Start(context.Background(), "eth_signTypedData") + defer span.End() e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) - return e.backend.SignTypedData(address, typedData) + return e.backend.SignTypedData(ctx, address, typedData) } // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) // on a given unsigned transaction, and returns it to the caller for further // processing (signing + broadcast). func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error) { + ctx, span := tracer.Start(context.Background(), "eth_fillTransaction") + defer span.End() // Set some sanity defaults and terminate on failure - args, err := e.backend.SetTxDefaults(args) + args, err := e.backend.SetTxDefaults(ctx, args) if err != nil { return nil, err } @@ -441,13 +505,15 @@ func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.Si // Resend accepts an existing transaction and a new gas price and limit. It will remove // the given transaction from the pool and reinsert it with the new gas price and limit. -func (e *PublicAPI) Resend(_ context.Context, +func (e *PublicAPI) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64, ) (common.Hash, error) { + ctx, span := tracer.Start(ctx, "eth_resend") + defer span.End() e.logger.Debug("eth_resend", "args", args) - return e.backend.Resend(args, gasPrice, gasLimit) + return e.backend.Resend(ctx, args, gasPrice, gasLimit) } // CreateAccessList returns the list of addresses and storage keys used by the transaction (except for the @@ -457,7 +523,9 @@ func (e *PublicAPI) CreateAccessList( blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, ) (*rpctypes.AccessListResult, error) { - res, err := e.backend.CreateAccessList(args, blockNrOrHash, overrides) + ctx, span := tracer.Start(context.Background(), "eth_createAccessList") + defer span.End() + res, err := e.backend.CreateAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { return nil, err } diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 987992e45..376ed08b5 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -11,6 +11,8 @@ import ( "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" "github.com/pkg/errors" + "go.opencensus.io/trace" + "go.opentelemetry.io/otel" coretypes "github.com/cometbft/cometbft/rpc/core/types" @@ -25,6 +27,8 @@ import ( var ( errInvalidBlockRange = errors.New("invalid block range params") errPendingLogsUnsupported = errors.New("pending logs are not supported") + + tracer = otel.Tracer("evm/rpc/namespaces/ethereum/eth/filters") ) // FilterAPI gathers @@ -40,16 +44,16 @@ type FilterAPI interface { // Backend defines the methods requided by the PublicFilterAPI backend type Backend interface { - GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) - HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) - HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) - CometBlockByHash(hash common.Hash) (*coretypes.ResultBlock, error) - CometBlockResultByNumber(height *int64) (*coretypes.ResultBlockResults, error) - GetLogs(blockHash common.Hash) ([][]*ethtypes.Log, error) - GetLogsByHeight(*int64) ([][]*ethtypes.Log, error) - BlockBloomFromCometBlock(blockRes *coretypes.ResultBlockResults) (ethtypes.Bloom, error) + GetBlockByNumber(ctx context.Context, blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) + HeaderByNumber(ctx context.Context, blockNum types.BlockNumber) (*ethtypes.Header, error) + HeaderByHash(ctx context.Context, blockHash common.Hash) (*ethtypes.Header, error) + CometBlockByHash(ctx context.Context, hash common.Hash) (*coretypes.ResultBlock, error) + CometBlockResultByNumber(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error) + GetLogs(ctx context.Context, blockHash common.Hash) ([][]*ethtypes.Log, error) + GetLogsByHeight(ctx context.Context, height *int64) ([][]*ethtypes.Log, error) + BlockBloomFromCometBlock(ctx context.Context, blockRes *coretypes.ResultBlockResults) (ethtypes.Bloom, error) - BloomStatus() (uint64, uint64) + BloomStatus(ctx context.Context) (uint64, uint64) RPCFilterCap() int32 RPCLogsCap() int32 @@ -222,6 +226,8 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID, // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*ethtypes.Log, error) { + ctx, span := tracer.Start(ctx, "GetLogs") + defer span.End() var filter *Filter if crit.BlockHash != nil { // Block filter requested, construct a single-shot filter @@ -273,6 +279,8 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ethtypes.Log, error) { + ctx, span := trace.StartSpan(ctx, "GetFilterLogs") + defer span.End() api.filtersMu.Lock() f, found := api.filters[id] api.filtersMu.Unlock() diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index 05066f082..ba276b36c 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -90,25 +90,27 @@ func newFilter(logger log.Logger, backend Backend, criteria filters.FilterCriter // Logs searches the blockchain for matching log entries, returning all from the // first block that contains matches, updating the start of the filter accordingly. -func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) (logs []*ethtypes.Log, err error) { +func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) (logs []*ethtypes.Log, err error) { + ctx, span := tracer.Start(ctx, "Filter.Logs") + defer span.End() if blockLimit == 0 { return nil, nil } // If we're doing singleton block filtering, execute and return if f.criteria.BlockHash != nil && *f.criteria.BlockHash != (common.Hash{}) { - resBlock, err := f.backend.CometBlockByHash(*f.criteria.BlockHash) + resBlock, err := f.backend.CometBlockByHash(ctx, *f.criteria.BlockHash) if err != nil { return nil, fmt.Errorf("failed to fetch header by hash %s: %w", f.criteria.BlockHash, err) } - blockRes, err := f.backend.CometBlockResultByNumber(&resBlock.Block.Height) + blockRes, err := f.backend.CometBlockResultByNumber(ctx, &resBlock.Block.Height) if err != nil { f.logger.Debug("failed to fetch block result from CometBFT", "height", resBlock.Block.Height, "error", err.Error()) return nil, err } - bloom, err := f.backend.BlockBloomFromCometBlock(blockRes) + bloom, err := f.backend.BlockBloomFromCometBlock(ctx, blockRes) if err != nil { return nil, err } @@ -122,7 +124,7 @@ func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) (logs [ } // Figure out the limits of the filter range - header, err := f.backend.HeaderByNumber(types.EthLatestBlockNumber) + header, err := f.backend.HeaderByNumber(ctx, types.EthLatestBlockNumber) if err != nil { return nil, fmt.Errorf("failed to fetch header by number (latest): %w", err) } @@ -171,13 +173,13 @@ func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) (logs [ for height := from; height <= to; height++ { h := int64(height) //#nosec G115 - blockRes, err := f.backend.CometBlockResultByNumber(&h) + blockRes, err := f.backend.CometBlockResultByNumber(ctx, &h) if err != nil { f.logger.Debug("failed to fetch block result from CometBFT", "height", height, "error", err.Error()) return nil, fmt.Errorf("failed to fetch block result from CometBFT: %w", err) } - bloom, err := f.backend.BlockBloomFromCometBlock(blockRes) + bloom, err := f.backend.BlockBloomFromCometBlock(ctx, blockRes) if err != nil { return nil, fmt.Errorf("failed to query block bloom filter from block results: %w", err) } diff --git a/rpc/namespaces/ethereum/miner/api.go b/rpc/namespaces/ethereum/miner/api.go index b8e60d3d9..09bde9918 100644 --- a/rpc/namespaces/ethereum/miner/api.go +++ b/rpc/namespaces/ethereum/miner/api.go @@ -1,8 +1,11 @@ package miner import ( + "context" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "go.opentelemetry.io/otel" "github.com/cosmos/evm/rpc/backend" @@ -11,6 +14,10 @@ import ( "github.com/cosmos/cosmos-sdk/server" ) +var ( + tracer = otel.Tracer("evm/rpc/namespaces/ethereum/miner") +) + // API is the private miner prefixed set of APIs in the Miner JSON-RPC spec. type API struct { ctx *server.Context @@ -33,11 +40,15 @@ func NewPrivateAPI( // SetEtherbase sets the etherbase of the miner func (api *API) SetEtherbase(etherbase common.Address) bool { api.logger.Debug("miner_setEtherbase") - return api.backend.SetEtherbase(etherbase) + ctx, span := tracer.Start(context.Background(), "miner_setEtherbase") + defer span.End() + return api.backend.SetEtherbase(ctx, etherbase) } // SetGasPrice sets the minimum accepted gas price for the miner. func (api *API) SetGasPrice(gasPrice hexutil.Big) bool { api.logger.Info(api.ctx.Viper.ConfigFileUsed()) - return api.backend.SetGasPrice(gasPrice) + ctx, span := tracer.Start(context.Background(), "miner_setGasPrice") + defer span.End() + return api.backend.SetGasPrice(ctx, gasPrice) } diff --git a/rpc/namespaces/ethereum/net/api.go b/rpc/namespaces/ethereum/net/api.go index d1c8f39ff..4b0446f84 100644 --- a/rpc/namespaces/ethereum/net/api.go +++ b/rpc/namespaces/ethereum/net/api.go @@ -5,6 +5,7 @@ import ( "fmt" rpcclient "github.com/cometbft/cometbft/rpc/client" + "go.opentelemetry.io/otel" "github.com/cosmos/evm/server/config" @@ -12,6 +13,10 @@ import ( "github.com/cosmos/cosmos-sdk/server" ) +var ( + tracer = otel.Tracer("evm/rpc/namespaces/ethereum/net") +) + // PublicAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec. type PublicAPI struct { networkVersion uint64 @@ -37,7 +42,8 @@ func (s *PublicAPI) Version() string { // Listening returns if client is actively listening for network connections. func (s *PublicAPI) Listening() bool { - ctx := context.Background() + ctx, span := tracer.Start(context.Background(), "Listening") + defer span.End() netInfo, err := s.tmClient.NetInfo(ctx) if err != nil { return false @@ -47,7 +53,8 @@ func (s *PublicAPI) Listening() bool { // PeerCount returns the number of peers currently connected to the client. func (s *PublicAPI) PeerCount() int { - ctx := context.Background() + ctx, span := tracer.Start(context.Background(), "PeerCount") + defer span.End() netInfo, err := s.tmClient.NetInfo(ctx) if err != nil { return 0 diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 51a5b73c6..85137979f 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "go.opentelemetry.io/otel" "github.com/cosmos/evm/crypto/hd" "github.com/cosmos/evm/rpc/backend" @@ -21,6 +22,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +var ( + tracer = otel.Tracer("evm/rpc/namespaces/ethereum/personal") +) + // PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec. type PrivateAccountAPI struct { backend backend.EVMBackend @@ -55,13 +60,17 @@ func NewAPI( // NOTE: The key will be both armored and encrypted using the same passphrase. func (api *PrivateAccountAPI) ImportRawKey(privkey, password string) (common.Address, error) { api.logger.Debug("personal_importRawKey") - return api.backend.ImportRawKey(privkey, password) + ctx, span := tracer.Start(context.Background(), "ImportRawKey") + defer span.End() + return api.backend.ImportRawKey(ctx, privkey, password) } // ListAccounts will return a list of addresses for accounts this node manages. func (api *PrivateAccountAPI) ListAccounts() ([]common.Address, error) { api.logger.Debug("personal_listAccounts") - return api.backend.ListAccounts() + ctx, span := tracer.Start(context.Background(), "ListAccounts") + defer span.End() + return api.backend.ListAccounts(ctx) } // LockAccount will lock the account associated with the given address when it's unlocked. @@ -76,13 +85,15 @@ func (api *PrivateAccountAPI) LockAccount(address common.Address) bool { // NewAccount will create a new account and returns the address for the new account. func (api *PrivateAccountAPI) NewAccount(password string) (common.Address, error) { api.logger.Debug("personal_newAccount") + ctx, span := tracer.Start(context.Background(), "NewAccount") + defer span.End() name := "key_" + time.Now().UTC().Format(time.RFC3339) // create the mnemonic and save the account hdPath := api.hdPathIter() - info, err := api.backend.NewMnemonic(name, keyring.English, hdPath.String(), password, hd.EthSecp256k1) + info, err := api.backend.NewMnemonic(ctx, name, keyring.English, hdPath.String(), password, hd.EthSecp256k1) if err != nil { return common.Address{}, err } @@ -110,9 +121,11 @@ func (api *PrivateAccountAPI) UnlockAccount(_ context.Context, addr common.Addre // SendTransaction will create a transaction from the given arguments and // tries to sign it with the key associated with args.To. If the given password isn't // able to decrypt the key it fails. -func (api *PrivateAccountAPI) SendTransaction(_ context.Context, args evmtypes.TransactionArgs, _ string) (common.Hash, error) { +func (api *PrivateAccountAPI) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs, _ string) (common.Hash, error) { api.logger.Debug("personal_sendTransaction", "address", args.To.String()) - return api.backend.SendTransaction(args) + ctx, span := tracer.Start(ctx, "SendTransaction") + defer span.End() + return api.backend.SendTransaction(ctx, args) } // Sign calculates an Ethereum ECDSA signature for: @@ -124,9 +137,11 @@ func (api *PrivateAccountAPI) SendTransaction(_ context.Context, args evmtypes.T // The key used to calculate the signature is decrypted with the given password. // // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign -func (api *PrivateAccountAPI) Sign(_ context.Context, data hexutil.Bytes, addr common.Address, _ string) (hexutil.Bytes, error) { +func (api *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, _ string) (hexutil.Bytes, error) { api.logger.Debug("personal_sign", "data", data, "address", addr.String()) - return api.backend.Sign(addr, data) + ctx, span := tracer.Start(ctx, "Sign") + defer span.End() + return api.backend.Sign(ctx, addr, data) } // EcRecover returns the address for the account that was used to create the signature. @@ -139,8 +154,10 @@ func (api *PrivateAccountAPI) Sign(_ context.Context, data hexutil.Bytes, addr c // the V value must be 27 or 28 for legacy reasons. // // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecove -func (api *PrivateAccountAPI) EcRecover(_ context.Context, data, sig hexutil.Bytes) (common.Address, error) { +func (api *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { api.logger.Debug("personal_ecRecover", "data", data, "sig", sig) + ctx, span := tracer.Start(ctx, "EcRecover") + defer span.End() if len(sig) != crypto.SignatureLength { return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index ec041865a..403eef3ed 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -1,8 +1,13 @@ package txpool import ( + "context" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/rpc/backend" "github.com/cosmos/evm/rpc/types" @@ -10,6 +15,8 @@ import ( "cosmossdk.io/log" ) +var tracer = otel.Tracer("evm/rpc/namespaces/ethereum/txpool") + // PublicAPI offers and API for the transaction pool. It only operates on data that is non-confidential. // NOTE: For more info about the current status of this endpoints see https://github.com/evmos/ethermint/issues/124 type PublicAPI struct { @@ -28,23 +35,31 @@ func NewPublicAPI(logger log.Logger, backend backend.EVMBackend) *PublicAPI { // Content returns the transactions contained within the transaction pool func (api *PublicAPI) Content() (map[string]map[string]map[string]*types.RPCTransaction, error) { api.logger.Debug("txpool_content") - return api.backend.Content() + ctx, span := tracer.Start(context.Background(), "Content") + defer span.End() + return api.backend.Content(ctx) } // ContentFrom returns the transactions contained within the transaction pool func (api *PublicAPI) ContentFrom(address common.Address) (map[string]map[string]*types.RPCTransaction, error) { api.logger.Debug("txpool_contentFrom") - return api.backend.ContentFrom(address) + ctx, span := tracer.Start(context.Background(), "ContentFrom", trace.WithAttributes(attribute.String("address", address.Hex()))) + defer span.End() + return api.backend.ContentFrom(ctx, address) } // Inspect returns the content of the transaction pool and flattens it into an easily inspectable list func (api *PublicAPI) Inspect() (map[string]map[string]map[string]string, error) { api.logger.Debug("txpool_inspect") - return api.backend.Inspect() + ctx, span := tracer.Start(context.Background(), "Inspect") + defer span.End() + return api.backend.Inspect(ctx) } // Status returns the number of pending and queued transaction in the pool func (api *PublicAPI) Status() (map[string]hexutil.Uint, error) { api.logger.Debug("txpool_status") - return api.backend.Status() + ctx, span := tracer.Start(context.Background(), "Status") + defer span.End() + return api.backend.Status(ctx) } diff --git a/rpc/types/block.go b/rpc/types/block.go index 3f34bf393..8f4146f4f 100644 --- a/rpc/types/block.go +++ b/rpc/types/block.go @@ -51,12 +51,19 @@ func NewBlockNumber(n *big.Int) BlockNumber { // ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is // 0, it will return an empty context and the gRPC query will use the latest block height for querying. // Note that all metadata is processed and removed by the CometBFT layer, so it won't be accessible at gRPC server level. -func ContextWithHeight(height int64) context.Context { +func ContextWithHeight(height int64, ctxs ...context.Context) context.Context { + var ctx context.Context + if len(ctxs) == 0 { + ctx = context.Background() + } else { + ctx = ctxs[0] + } + if height == 0 { - return context.Background() + return ctx } - return metadata.AppendToOutgoingContext(context.Background(), grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height)) + return metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height)) } // UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports: diff --git a/rpc/types/utils.go b/rpc/types/utils.go index d2554f7be..d59053bc3 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -12,6 +12,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" ethparams "github.com/ethereum/go-ethereum/params" "github.com/pkg/errors" + "go.opentelemetry.io/otel" abci "github.com/cometbft/cometbft/abci/types" cmtrpcclient "github.com/cometbft/cometbft/rpc/client" @@ -97,8 +98,13 @@ func EthHeaderFromComet(header cmttypes.Header, bloom ethtypes.Bloom, baseFee *b } } +var tracer = otel.Tracer("evm/rpc/types") + // BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params. func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (int64, error) { + goCtx, span := tracer.Start(goCtx, "BlockMaxGasFromConsensusParams") + defer span.End() + cmtrpcclient, ok := clientCtx.Client.(cmtrpcclient.Client) if !ok { panic("incorrect tm rpc client") diff --git a/server/start.go b/server/start.go index d48690b53..902e47b75 100644 --- a/server/start.go +++ b/server/start.go @@ -11,6 +11,7 @@ import ( ethmetricsexp "github.com/ethereum/go-ethereum/metrics/exp" "github.com/spf13/cobra" + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "golang.org/x/sync/errgroup" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -667,6 +668,7 @@ func startGrpcServer( grpc.MaxCallRecvMsgSize(maxRecvMsgSize), grpc.MaxCallSendMsgSize(maxSendMsgSize), ), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) if err != nil { return nil, clientCtx, err diff --git a/tests/integration/rpc/backend/test_account_info.go b/tests/integration/rpc/backend/test_account_info.go index 8afaf045b..0a4868e32 100644 --- a/tests/integration/rpc/backend/test_account_info.go +++ b/tests/integration/rpc/backend/test_account_info.go @@ -67,7 +67,7 @@ func (s *TestSuite) TestGetCode() { s.SetupTest() // reset tc.registerMock(tc.addr) - code, err := s.backend.GetCode(tc.addr, tc.blockNrOrHash) + code, err := s.backend.GetCode(s.Ctx(), tc.addr, tc.blockNrOrHash) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expCode, code) @@ -128,7 +128,7 @@ func (s *TestSuite) TestGetProof() { rpctypes.BlockNumberOrHash{BlockNumber: &blockNr}, func(bn rpctypes.BlockNumber, addr common.Address) { height := bn.Int64() - s.backend.Ctx = rpctypes.ContextWithHeight(height) + // Context is now passed to methods directly, not stored in backend client := s.backend.ClientCtx.Client.(*mocks.Client) RegisterHeader(client, &height, nil) QueryClient := s.backend.QueryClient.QueryClient.(*mocks.EVMQueryClient) @@ -175,7 +175,7 @@ func (s *TestSuite) TestGetProof() { rpctypes.BlockNumberOrHash{BlockNumber: &blockNrZero}, func(bn rpctypes.BlockNumber, addr common.Address) { height := int64(4) - s.backend.Ctx = rpctypes.ContextWithHeight(height) + // Context is now passed to methods directly, not stored in backend client := s.backend.ClientCtx.Client.(*mocks.Client) RegisterHeader(client, &height, nil) queryClient := s.backend.QueryClient.QueryClient.(*mocks.EVMQueryClient) @@ -223,7 +223,7 @@ func (s *TestSuite) TestGetProof() { s.SetupTest() tc.registerMock(*tc.blockNrOrHash.BlockNumber, tc.addr) - accRes, err := s.backend.GetProof(tc.addr, tc.storageKeys, tc.blockNrOrHash) + accRes, err := s.backend.GetProof(s.Ctx(), tc.addr, tc.storageKeys, tc.blockNrOrHash) if tc.expPass { s.Require().NoError(err) @@ -286,7 +286,7 @@ func (s *TestSuite) TestGetStorageAt() { s.SetupTest() tc.registerMock(tc.addr, tc.key, tc.expStorage.String()) - storage, err := s.backend.GetStorageAt(tc.addr, tc.key, tc.blockNrOrHash) + storage, err := s.backend.GetStorageAt(s.Ctx(), tc.addr, tc.key, tc.blockNrOrHash) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expStorage, storage) @@ -395,7 +395,7 @@ func (s *TestSuite) TestGetBalance() { tc.registerMock(*tc.blockNrOrHash.BlockNumber, tc.addr) } - balance, err := s.backend.GetBalance(tc.addr, tc.blockNrOrHash) + balance, err := s.backend.GetBalance(s.Ctx(), tc.addr, tc.blockNrOrHash) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expBalance, balance) @@ -472,7 +472,7 @@ func (s *TestSuite) TestGetTransactionCount() { tc.registerMock(addr, tc.blockNum) - txCount, err := s.backend.GetTransactionCount(addr, tc.blockNum) + txCount, err := s.backend.GetTransactionCount(s.Ctx(), addr, tc.blockNum) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expTxCount, *txCount) diff --git a/tests/integration/rpc/backend/test_backend_suite.go b/tests/integration/rpc/backend/test_backend_suite.go index c056d6d6a..df77fe1c0 100644 --- a/tests/integration/rpc/backend/test_backend_suite.go +++ b/tests/integration/rpc/backend/test_backend_suite.go @@ -2,6 +2,7 @@ package backend import ( "bufio" + "context" "math/big" "os" "path/filepath" @@ -102,12 +103,16 @@ func (s *TestSuite) SetupTest() { s.backend.Cfg.EVM.EVMChainID = ChainID.EVMChainID s.backend.QueryClient.QueryClient = mocks.NewEVMQueryClient(s.T()) s.backend.QueryClient.FeeMarket = mocks.NewFeeMarketQueryClient(s.T()) - s.backend.Ctx = rpctypes.ContextWithHeight(1) // Add codec s.backend.ClientCtx.Codec = encodingConfig.Codec } +// Ctx returns a context with height set for testing +func (s *TestSuite) Ctx() context.Context { + return rpctypes.ContextWithHeight(1, context.Background()) +} + // buildEthereumTx returns an example legacy Ethereum transaction func (s *TestSuite) buildEthereumTx() (*evmtypes.MsgEthereumTx, []byte) { ethTxParams := evmtypes.EvmTxArgs{ @@ -175,7 +180,7 @@ func (s *TestSuite) buildFormattedBlock( msgs = []*evmtypes.MsgEthereumTx{tx} } ethBlock := s.buildEthBlock(blockRes, resBlock, msgs, validator, baseFee) - res, err := rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, s.backend.ChainConfig()) + res, err := rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, s.backend.ChainConfig(s.Ctx())) s.Require().NoError(err) return res @@ -208,7 +213,7 @@ func (s *TestSuite) buildEthBlock( } // 5) Build receipts - receipts, err := s.backend.ReceiptsFromCometBlock(resBlock, blockRes, msgs) + receipts, err := s.backend.ReceiptsFromCometBlock(s.Ctx(), resBlock, blockRes, msgs) s.Require().NoError(err) // 6) Gas used @@ -245,7 +250,7 @@ func (s *TestSuite) signAndEncodeEthTx(msgEthereumTx *evmtypes.MsgEthereumTx) [] from, priv := utiltx.NewAddrKey() signer := utiltx.NewSigner(priv) - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) msgEthereumTx.From = from.Bytes() err := msgEthereumTx.Sign(ethSigner, signer) s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_blocks.go b/tests/integration/rpc/backend/test_blocks.go index e8fb30c5e..6cbbddfd9 100644 --- a/tests/integration/rpc/backend/test_blocks.go +++ b/tests/integration/rpc/backend/test_blocks.go @@ -72,7 +72,7 @@ func (s *TestSuite) TestBlockNumber() { s.SetupTest() // reset test and queries tc.registerMock() - blockNumber, err := s.backend.BlockNumber() + blockNumber, err := s.backend.BlockNumber(s.Ctx()) if tc.expPass { s.Require().NoError(err) @@ -217,7 +217,7 @@ func (s *TestSuite) TestGetBlockByNumber() { s.SetupTest() // reset test and queries tc.registerMock(tc.blockNumber, math.NewIntFromBigInt(tc.baseFee), tc.validator, tc.txBz) - block, err := s.backend.GetBlockByNumber(tc.blockNumber, tc.fullTx) + block, err := s.backend.GetBlockByNumber(s.Ctx(), tc.blockNumber, tc.fullTx) if tc.expPass { s.Require().NoError(err) @@ -381,7 +381,7 @@ func (s *TestSuite) TestGetBlockByHash() { s.SetupTest() // reset test and queries tc.registerMock(tc.hash, math.NewIntFromBigInt(tc.baseFee), tc.validator, tc.txBz) - block, err := s.backend.GetBlockByHash(tc.hash, tc.fullTx) + block, err := s.backend.GetBlockByHash(s.Ctx(), tc.hash, tc.fullTx) if tc.expPass { if tc.expNoop { @@ -471,7 +471,7 @@ func (s *TestSuite) TestGetBlockTransactionCountByHash() { s.SetupTest() // reset test and queries tc.registerMock(tc.hash) - count := s.backend.GetBlockTransactionCountByHash(tc.hash) + count := s.backend.GetBlockTransactionCountByHash(s.Ctx(), tc.hash) if tc.expPass { s.Require().Equal(tc.expCount, *count) } else { @@ -547,7 +547,7 @@ func (s *TestSuite) TestGetBlockTransactionCountByNumber() { s.SetupTest() // reset test and queries tc.registerMock(tc.blockNum) - count := s.backend.GetBlockTransactionCountByNumber(tc.blockNum) + count := s.backend.GetBlockTransactionCountByNumber(s.Ctx(), tc.blockNum) if tc.expPass { s.Require().Equal(tc.expCount, *count) } else { @@ -645,7 +645,7 @@ func (s *TestSuite) TestCometBlockByNumber() { s.SetupTest() // reset test and queries tc.registerMock(tc.blockNumber) - resultBlock, err := s.backend.CometBlockByNumber(tc.blockNumber) + resultBlock, err := s.backend.CometBlockByNumber(s.Ctx(), tc.blockNumber) if tc.expPass { s.Require().NoError(err) @@ -701,7 +701,7 @@ func (s *TestSuite) TestCometBlockResultByNumber() { tc.registerMock(tc.blockNumber) client := s.backend.ClientCtx.Client.(*mocks.Client) - blockRes, err := client.BlockResults(s.backend.Ctx, &tc.blockNumber) //#nosec G601 -- fine for tests + blockRes, err := client.BlockResults(s.Ctx(), &tc.blockNumber) //#nosec G601 -- fine for tests if tc.expPass { s.Require().NoError(err) @@ -773,7 +773,7 @@ func (s *TestSuite) TestBlockNumberFromComet() { } tc.registerMock(tc.hash) - blockNum, err := s.backend.BlockNumberFromComet(blockNrOrHash) + blockNum, err := s.backend.BlockNumberFromComet(s.Ctx(), blockNrOrHash) if tc.expPass { s.Require().NoError(err) @@ -836,7 +836,7 @@ func (s *TestSuite) TestBlockNumberFromCometByHash() { s.SetupTest() // reset test and queries tc.registerMock(tc.hash) - blockNum, err := s.backend.BlockNumberFromCometByHash(tc.hash) + blockNum, err := s.backend.BlockNumberFromCometByHash(s.Ctx(), tc.hash) if tc.expPass { expHeight := big.NewInt(resHeader.Header.Height) s.Require().NoError(err) @@ -902,7 +902,7 @@ func (s *TestSuite) TestBlockBloomFromCometBlock() { } for _, tc := range testCases { s.Run(fmt.Sprintf("Case %s", tc.name), func() { - blockBloom, err := s.backend.BlockBloomFromCometBlock(tc.blockRes) + blockBloom, err := s.backend.BlockBloomFromCometBlock(s.Ctx(), tc.blockRes) if tc.expPass { s.Require().NoError(err) @@ -1124,7 +1124,7 @@ func (s *TestSuite) TestGetEthBlockFromComet() { err := s.backend.Indexer.IndexBlock(tc.resBlock.Block, tc.blockRes.TxsResults) s.Require().NoError(err) } - block, err := s.backend.RPCBlockFromCometBlock(tc.resBlock, tc.blockRes, tc.fullTx) + block, err := s.backend.RPCBlockFromCometBlock(s.Ctx(), tc.resBlock, tc.blockRes, tc.fullTx) var tx *evmtypes.MsgEthereumTx if tc.expTxs { @@ -1200,7 +1200,7 @@ func (s *TestSuite) TestEthMsgsFromCometBlock() { s.Run(fmt.Sprintf("Case %s", tc.name), func() { s.SetupTest() // reset test and queries - msgs := s.backend.EthMsgsFromCometBlock(tc.resBlock, tc.blockRes) + msgs := s.backend.EthMsgsFromCometBlock(s.Ctx(), tc.resBlock, tc.blockRes) for i, expMsg := range tc.expMsgs { expBytes, err := json.Marshal(expMsg) s.Require().Nil(err) @@ -1345,10 +1345,10 @@ func (s *TestSuite) TestHeaderByNumber() { s.SetupTest() // reset test and queries tc.registerMock(tc.blockNumber, math.NewIntFromBigInt(tc.baseFee)) - header, err := s.backend.HeaderByNumber(tc.blockNumber) + header, err := s.backend.HeaderByNumber(s.Ctx(), tc.blockNumber) if tc.expPass { - msgs := s.backend.EthMsgsFromCometBlock(resBlock, blockRes) + msgs := s.backend.EthMsgsFromCometBlock(s.Ctx(), resBlock, blockRes) expHeader := s.buildEthBlock(blockRes, resBlock, msgs, validator, tc.baseFee).Header() s.Require().NoError(err) @@ -1467,10 +1467,10 @@ func (s *TestSuite) TestHeaderByHash() { s.SetupTest() // reset test and queries tc.registerMock(tc.hash, math.NewIntFromBigInt(tc.baseFee)) - header, err := s.backend.HeaderByHash(tc.hash) + header, err := s.backend.HeaderByHash(s.Ctx(), tc.hash) if tc.expPass { - msgs := s.backend.EthMsgsFromCometBlock(resBlock, blockRes) + msgs := s.backend.EthMsgsFromCometBlock(s.Ctx(), resBlock, blockRes) expHeader := s.buildEthBlock(blockRes, resBlock, msgs, validator, tc.baseFee).Header() s.Require().NoError(err) @@ -1567,12 +1567,12 @@ func (s *TestSuite) TestEthBlockByNumber() { s.SetupTest() // reset test and queries tc.registerMock(tc.blockNumber) - ethBlock, err := s.backend.EthBlockByNumber(tc.blockNumber) + ethBlock, err := s.backend.EthBlockByNumber(s.Ctx(), tc.blockNumber) if tc.expPass { s.Require().NoError(err) - msgs := s.backend.EthMsgsFromCometBlock(resBlock, blockRes) + msgs := s.backend.EthMsgsFromCometBlock(s.Ctx(), resBlock, blockRes) txs := make([]*ethtypes.Transaction, len(msgs)) for i, m := range msgs { txs[i] = m.AsTransaction() @@ -1681,12 +1681,12 @@ func (s *TestSuite) TestEthBlockFromCometBlock() { s.Require().NoError(s.backend.Indexer.IndexBlock(tc.resBlock.Block, tc.blockRes.TxsResults)) } - ethBlock, err := s.backend.EthBlockFromCometBlock(tc.resBlock, tc.blockRes) + ethBlock, err := s.backend.EthBlockFromCometBlock(s.Ctx(), tc.resBlock, tc.blockRes) if tc.expPass { s.Require().NoError(err) - msgs := s.backend.EthMsgsFromCometBlock(tc.resBlock, tc.blockRes) + msgs := s.backend.EthMsgsFromCometBlock(s.Ctx(), tc.resBlock, tc.blockRes) txs := make([]*ethtypes.Transaction, len(msgs)) for i, m := range msgs { txs[i] = m.AsTransaction() diff --git a/tests/integration/rpc/backend/test_call_tx.go b/tests/integration/rpc/backend/test_call_tx.go index 5679894f8..78ae2dfbd 100644 --- a/tests/integration/rpc/backend/test_call_tx.go +++ b/tests/integration/rpc/backend/test_call_tx.go @@ -281,7 +281,7 @@ func (s *TestSuite) TestResend() { s.SetupTest() // reset test and queries tc.registerMock() - hash, err := s.backend.Resend(tc.args, tc.gasPrice, tc.gasLimit) + hash, err := s.backend.Resend(s.Ctx(), tc.args, tc.gasPrice, tc.gasLimit) if tc.expPass { s.Require().Equal(tc.expHash, hash) @@ -298,7 +298,7 @@ func (s *TestSuite) TestSendRawTransaction() { emptyEvmChainIDTx := s.buildEthereumTxWithChainID(nil) invalidChainID := big.NewInt(1) // Sign the ethTx - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) err := ethTx.Sign(ethSigner, s.signer) s.Require().NoError(err) @@ -402,7 +402,7 @@ func (s *TestSuite) TestSendRawTransaction() { s.SetupTest() // reset test and queries tc.registerMock() - hash, err := s.backend.SendRawTransaction(tc.rawTx()) + hash, err := s.backend.SendRawTransaction(s.Ctx(), tc.rawTx()) if tc.expPass { s.Require().Equal(tc.expHash, hash) @@ -553,7 +553,7 @@ func (s *TestSuite) TestDoCall() { s.SetupTest() // reset test and queries tc.registerMock() - msgEthTx, err := s.backend.DoCall(tc.callArgs, tc.blockNum, tc.overrides) + msgEthTx, err := s.backend.DoCall(s.Ctx(), tc.callArgs, tc.blockNum, tc.overrides) if tc.expPass { s.Require().NoError(err) @@ -618,7 +618,7 @@ func (s *TestSuite) TestGasPrice() { s.SetupTest() // reset test and queries tc.registerMock() - gasPrice, err := s.backend.GasPrice() + gasPrice, err := s.backend.GasPrice(s.Ctx()) if tc.expPass { s.Require().Equal(tc.expGas, gasPrice) } else { @@ -763,7 +763,7 @@ func (s *TestSuite) TestEstimateGas() { blockNum := rpctypes.BlockNumber(1) blockNrOrHash := rpctypes.BlockNumberOrHash{BlockNumber: &blockNum} - gas, err := s.backend.EstimateGas(tc.callArgs, &blockNrOrHash, tc.overrides) + gas, err := s.backend.EstimateGas(s.Ctx(), tc.callArgs, &blockNrOrHash, tc.overrides) if tc.expPass { s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_chain_info.go b/tests/integration/rpc/backend/test_chain_info.go index 631aedd46..05d3028b8 100644 --- a/tests/integration/rpc/backend/test_chain_info.go +++ b/tests/integration/rpc/backend/test_chain_info.go @@ -1,6 +1,7 @@ package backend import ( + "context" "fmt" "math/big" @@ -143,7 +144,7 @@ func (s *TestSuite) TestBaseFee() { s.SetupTest() // reset test and queries tc.registerMock() - baseFee, err := s.backend.BaseFee(tc.blockRes) + baseFee, err := s.backend.BaseFee(s.Ctx(), tc.blockRes) if tc.expPass { s.Require().NoError(err) @@ -180,7 +181,7 @@ func (s *TestSuite) TestChainID() { s.SetupTest() // reset test and queries tc.registerMock() - chainID, err := s.backend.ChainID() + chainID, err := s.backend.ChainID(s.Ctx()) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expChainID, chainID) @@ -237,7 +238,7 @@ func (s *TestSuite) TestGetCoinbase() { s.SetupTest() // reset test and queries tc.registerMock() - accAddr, err := s.backend.GetCoinbase() + accAddr, err := s.backend.GetCoinbase(s.Ctx()) if tc.expPass { s.Require().Equal(tc.accAddr, accAddr) @@ -277,7 +278,7 @@ func (s *TestSuite) TestSuggestGasTipCap() { s.SetupTest() // reset test and queries tc.registerMock() - maxDelta, err := s.backend.SuggestGasTipCap(tc.baseFee) + maxDelta, err := s.backend.SuggestGasTipCap(s.Ctx(), tc.baseFee) if tc.expPass { s.Require().Equal(tc.expGasTipCap, maxDelta) @@ -311,7 +312,7 @@ func (s *TestSuite) TestGlobalMinGasPrice() { s.SetupTest() // reset test and queries tc.registerMock() - globalMinGasPrice, err := s.backend.GlobalMinGasPrice() + globalMinGasPrice, err := s.backend.GlobalMinGasPrice(s.Ctx()) if tc.expPass { s.Require().Equal(tc.expMinGasPrice, globalMinGasPrice) @@ -577,13 +578,14 @@ func (s *TestSuite) TestFeeHistory() { called := 0 if len(tc.targetNewBaseFees) > 0 { s.backend.ProcessBlocker = func( + ctx context.Context, cometBlock *cmtrpctypes.ResultBlock, ethBlock *map[string]interface{}, rewardPercentiles []float64, cometBlockResult *cmtrpctypes.ResultBlockResults, targetOneFeeHistory *rpc.OneFeeHistory, ) error { - err := s.backend.ProcessBlock(cometBlock, ethBlock, rewardPercentiles, cometBlockResult, targetOneFeeHistory) + err := s.backend.ProcessBlock(ctx, cometBlock, ethBlock, rewardPercentiles, cometBlockResult, targetOneFeeHistory) s.Require().NoError(err) targetOneFeeHistory.NextBaseFee = tc.targetNewBaseFees[called] called++ @@ -591,7 +593,7 @@ func (s *TestSuite) TestFeeHistory() { } } - feeHistory, err := s.backend.FeeHistory(tc.userBlockCount, tc.latestBlock, []float64{25, 50, 75, 100}) + feeHistory, err := s.backend.FeeHistory(s.Ctx(), tc.userBlockCount, tc.latestBlock, []float64{25, 50, 75, 100}) if tc.expPass { s.Require().NoError(err) s.Require().Equal(feeHistory, tc.expFeeHistory) diff --git a/tests/integration/rpc/backend/test_filters.go b/tests/integration/rpc/backend/test_filters.go index 503116995..37c2303b0 100644 --- a/tests/integration/rpc/backend/test_filters.go +++ b/tests/integration/rpc/backend/test_filters.go @@ -78,7 +78,7 @@ func (s *TestSuite) TestGetLogs() { s.SetupTest() tc.registerMock(tc.blockHash) - logs, err := s.backend.GetLogs(tc.blockHash) + logs, err := s.backend.GetLogs(s.Ctx(), tc.blockHash) if tc.expPass { s.Require().NoError(err) @@ -110,7 +110,7 @@ func (s *TestSuite) TestBloomStatus() { s.SetupTest() tc.registerMock() - bloom, _ := s.backend.BloomStatus() + bloom, _ := s.backend.BloomStatus(s.Ctx()) if tc.expPass { s.Require().Equal(tc.expResult, bloom) diff --git a/tests/integration/rpc/backend/test_node_info.go b/tests/integration/rpc/backend/test_node_info.go index 270a3c8a1..d7a5a9073 100644 --- a/tests/integration/rpc/backend/test_node_info.go +++ b/tests/integration/rpc/backend/test_node_info.go @@ -122,7 +122,7 @@ func (s *TestSuite) TestListAccounts() { s.SetupTest() // reset test and queries tc.registerMock() - output, err := s.backend.ListAccounts() + output, err := s.backend.ListAccounts(s.Ctx()) if tc.expPass { s.Require().NoError(err) @@ -154,7 +154,7 @@ func (s *TestSuite) TestAccounts() { s.SetupTest() // reset test and queries tc.registerMock() - output, err := s.backend.Accounts() + output, err := s.backend.Accounts(s.Ctx()) if tc.expPass { s.Require().NoError(err) @@ -196,7 +196,7 @@ func (s *TestSuite) TestSyncing() { func() { client := s.backend.ClientCtx.Client.(*mocks.Client) RegisterStatus(client) - status, _ := client.Status(s.backend.Ctx) + status, _ := client.Status(s.Ctx()) status.SyncInfo.CatchingUp = true }, map[string]interface{}{ @@ -212,7 +212,7 @@ func (s *TestSuite) TestSyncing() { s.SetupTest() // reset test and queries tc.registerMock() - output, err := s.backend.Syncing() + output, err := s.backend.Syncing(s.Ctx()) if tc.expPass { s.Require().NoError(err) @@ -262,7 +262,7 @@ func (s *TestSuite) TestSetEtherbase() { RegisterParams(QueryClient, &header, 1) c := sdk.NewDecCoin(constants.ExampleAttoDenom, math.NewIntFromBigInt(big.NewInt(1))) s.backend.Cfg.SetMinGasPrices(sdk.DecCoins{c}) - delAddr, _ := s.backend.GetCoinbase() + delAddr, _ := s.backend.GetCoinbase(s.Ctx()) // account, _ := s.backend.ClientCtx.AccountRetriever.GetAccount(s.backend.ClientCtx, delAddr) delCommonAddr := common.BytesToAddress(delAddr.Bytes()) request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()} @@ -309,7 +309,7 @@ func (s *TestSuite) TestSetEtherbase() { s.SetupTest() // reset test and queries tc.registerMock() - output := s.backend.SetEtherbase(tc.etherbase) + output := s.backend.SetEtherbase(s.Ctx(), tc.etherbase) s.Require().Equal(tc.expResult, output) }) @@ -352,7 +352,7 @@ func (s *TestSuite) TestImportRawKey() { s.SetupTest() // reset test and queries tc.registerMock() - output, err := s.backend.ImportRawKey(tc.privKey, tc.password) + output, err := s.backend.ImportRawKey(s.Ctx(), tc.privKey, tc.password) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expAddr, output) diff --git a/tests/integration/rpc/backend/test_sign_tx.go b/tests/integration/rpc/backend/test_sign_tx.go index a0f2d3f14..6582f1064 100644 --- a/tests/integration/rpc/backend/test_sign_tx.go +++ b/tests/integration/rpc/backend/test_sign_tx.go @@ -129,13 +129,13 @@ func (s *TestSuite) TestSendTransaction() { if tc.expPass { // Sign the transaction and get the hash - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) msg := evmtypes.NewTxFromArgs(&callArgsDefault) err := msg.Sign(ethSigner, s.backend.ClientCtx.Keyring) s.Require().NoError(err) tc.expHash = msg.AsTransaction().Hash() } - responseHash, err := s.backend.SendTransaction(tc.args) + responseHash, err := s.backend.SendTransaction(s.Ctx(), tc.args) if tc.expPass { s.Require().NoError(err) s.Require().Equal(tc.expHash, responseHash) @@ -180,7 +180,7 @@ func (s *TestSuite) TestSign() { s.SetupTest() // reset test and queries tc.registerMock() - responseBz, err := s.backend.Sign(tc.fromAddr, tc.inputBz) + responseBz, err := s.backend.Sign(s.Ctx(), tc.fromAddr, tc.inputBz) if tc.expPass { signature, _, err := s.backend.ClientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), tc.inputBz, signingtypes.SignMode_SIGN_MODE_TEXTUAL) signature[goethcrypto.RecoveryIDOffset] += 27 @@ -228,7 +228,7 @@ func (s *TestSuite) TestSignTypedData() { s.SetupTest() // reset test and queries tc.registerMock() - responseBz, err := s.backend.SignTypedData(tc.fromAddr, tc.inputTypedData) + responseBz, err := s.backend.SignTypedData(s.Ctx(), tc.fromAddr, tc.inputTypedData) if tc.expPass { sigHash, _, _ := apitypes.TypedDataAndHash(tc.inputTypedData) @@ -256,7 +256,7 @@ func broadcastTx(suite *TestSuite, priv *ethsecp256k1.PrivKey, baseFee math.Int, RegisterBaseFee(QueryClient, baseFee) RegisterValidatorAccount(QueryClient, sdk.AccAddress(utiltx.GenerateAddress().Bytes())) RegisterConsensusParams(client, height) - ethSigner := ethtypes.LatestSigner(suite.backend.ChainConfig()) + ethSigner := ethtypes.LatestSigner(suite.backend.ChainConfig(suite.Ctx())) msg := evmtypes.NewTxFromArgs(&callArgsDefault) err := msg.Sign(ethSigner, suite.backend.ClientCtx.Keyring) suite.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_tracing.go b/tests/integration/rpc/backend/test_tracing.go index eefbaf818..d778c2abb 100644 --- a/tests/integration/rpc/backend/test_tracing.go +++ b/tests/integration/rpc/backend/test_tracing.go @@ -35,7 +35,7 @@ func (s *TestSuite) TestTraceTransaction() { armor := crypto.EncryptArmorPrivKey(priv, "", "eth_secp256k1") _ = s.backend.ClientCtx.Keyring.ImportPrivKey("test_key", armor, "") - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) txEncoder := s.backend.ClientCtx.TxConfig.TxEncoder() @@ -196,7 +196,7 @@ func (s *TestSuite) TestTraceTransaction() { err := s.backend.Indexer.IndexBlock(tc.block, tc.responseBlock) s.Require().NoError(err) - txResult, err := s.backend.TraceTransaction(txHash, nil) + txResult, err := s.backend.TraceTransaction(s.Ctx(), txHash, nil) if tc.expPass { s.Require().NoError(err) @@ -369,7 +369,7 @@ func (s *TestSuite) TestTraceCall() { s.SetupTest() // reset test and queries tc.registerMock() - result, err := s.backend.TraceCall(tc.args, tc.blockNrOrHash, tc.config) + result, err := s.backend.TraceCall(s.Ctx(), tc.args, tc.blockNrOrHash, tc.config) if tc.expPass { s.Require().NoError(err) @@ -457,7 +457,7 @@ func (s *TestSuite) TestTraceBlock() { s.SetupTest() // reset test and queries tc.registerMock() - traceResults, err := s.backend.TraceBlock(1, tc.config, tc.resBlock) + traceResults, err := s.backend.TraceBlock(s.Ctx(), 1, tc.config, tc.resBlock) if tc.expPass { s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_tx_info.go b/tests/integration/rpc/backend/test_tx_info.go index 0d6efea5f..10d88313a 100644 --- a/tests/integration/rpc/backend/test_tx_info.go +++ b/tests/integration/rpc/backend/test_tx_info.go @@ -47,7 +47,7 @@ func (s *TestSuite) TestGetTransactionByHash() { } blockTime := uint64(block.Time.UTC().Unix()) //nolint:gosec // G115 - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, blockTime, 0, big.NewInt(1), s.backend.ChainConfig()) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, blockTime, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) testCases := []struct { name string @@ -115,7 +115,7 @@ func (s *TestSuite) TestGetTransactionByHash() { err := s.backend.Indexer.IndexBlock(block, responseDeliver) s.Require().NoError(err) - rpcTx, err := s.backend.GetTransactionByHash(tc.tx.Hash()) + rpcTx, err := s.backend.GetTransactionByHash(s.Ctx(), tc.tx.Hash()) if tc.expPass { s.Require().NoError(err) @@ -129,7 +129,7 @@ func (s *TestSuite) TestGetTransactionByHash() { func (s *TestSuite) TestGetTransactionsByHashPending() { msgEthereumTx, bz := s.buildEthereumTx() - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig()) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) testCases := []struct { name string @@ -175,7 +175,7 @@ func (s *TestSuite) TestGetTransactionsByHashPending() { s.SetupTest() // reset tc.registerMock() - rpcTx, err := s.backend.GetTransactionByHashPending(tc.tx.Hash()) + rpcTx, err := s.backend.GetTransactionByHashPending(s.Ctx(), tc.tx.Hash()) if tc.expPass { s.Require().NoError(err) @@ -189,7 +189,7 @@ func (s *TestSuite) TestGetTransactionsByHashPending() { func (s *TestSuite) TestGetTxByEthHash() { msgEthereumTx, bz := s.buildEthereumTx() - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig()) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) testCases := []struct { name string @@ -217,7 +217,7 @@ func (s *TestSuite) TestGetTxByEthHash() { s.SetupTest() // reset tc.registerMock() - rpcTx, err := s.backend.GetTxByEthHash(tc.tx.Hash()) + rpcTx, err := s.backend.GetTxByEthHash(s.Ctx(), tc.tx.Hash()) if tc.expPass { s.Require().NoError(err) @@ -267,7 +267,7 @@ func (s *TestSuite) TestGetTransactionByBlockHashAndIndex() { s.SetupTest() // reset tc.registerMock() - rpcTx, err := s.backend.GetTransactionByBlockHashAndIndex(tc.blockHash, 1) + rpcTx, err := s.backend.GetTransactionByBlockHashAndIndex(s.Ctx(), tc.blockHash, 1) if tc.expPass { s.Require().NoError(err) @@ -307,7 +307,7 @@ func (s *TestSuite) TestGetTransactionByBlockAndIndex() { blockTime, 0, big.NewInt(1), - s.backend.ChainConfig(), + s.backend.ChainConfig(s.Ctx()), ) testCases := []struct { name string @@ -380,7 +380,7 @@ func (s *TestSuite) TestGetTransactionByBlockAndIndex() { s.SetupTest() // reset tc.registerMock() - rpcTx, err := s.backend.GetTransactionByBlockAndIndex(tc.block, tc.idx) + rpcTx, err := s.backend.GetTransactionByBlockAndIndex(s.Ctx(), tc.block, tc.idx) if tc.expPass { s.Require().NoError(err) @@ -403,7 +403,7 @@ func (s *TestSuite) TestGetTransactionByBlockNumberAndIndex() { blockTime, 0, big.NewInt(1), - s.backend.ChainConfig(), + s.backend.ChainConfig(s.Ctx()), ) testCases := []struct { name string @@ -445,7 +445,7 @@ func (s *TestSuite) TestGetTransactionByBlockNumberAndIndex() { s.SetupTest() // reset tc.registerMock() - rpcTx, err := s.backend.GetTransactionByBlockNumberAndIndex(tc.blockNum, tc.idx) + rpcTx, err := s.backend.GetTransactionByBlockNumberAndIndex(s.Ctx(), tc.blockNum, tc.idx) if tc.expPass { s.Require().NoError(err) s.Require().Equal(rpcTx, tc.expRPCTx) @@ -486,7 +486,7 @@ func (s *TestSuite) TestGetTransactionByTxIndex() { s.SetupTest() // reset tc.registerMock() - txResults, err := s.backend.GetTxByTxIndex(tc.height, tc.index) + txResults, err := s.backend.GetTxByTxIndex(s.Ctx(), tc.height, tc.index) if tc.expPass { s.Require().NoError(err) @@ -527,7 +527,7 @@ func (s *TestSuite) TestQueryCometTxIndexer() { s.SetupTest() // reset tc.registerMock() - txResults, err := s.backend.QueryCometTxIndexer(tc.query, tc.txGetter) + txResults, err := s.backend.QueryCometTxIndexer(s.Ctx(), tc.query, tc.txGetter) if tc.expPass { s.Require().NoError(err) @@ -685,7 +685,7 @@ func (s *TestSuite) TestGetTransactionReceipt() { err := s.backend.Indexer.IndexBlock(tc.block, tc.blockResult) s.Require().NoError(err) - res, err := s.backend.GetTransactionReceipt(tc.tx.Hash()) + res, err := s.backend.GetTransactionReceipt(s.Ctx(), tc.tx.Hash()) if tc.expPass { s.Require().Equal(res["transactionHash"], tc.tx.Hash()) s.Require().Equal(res["blockNumber"], hexutil.Uint64(tc.block.Height)) //nolint: gosec // G115 diff --git a/tests/speedtest/go.mod b/tests/speedtest/go.mod index e0a7994d6..2f17df45b 100644 --- a/tests/speedtest/go.mod +++ b/tests/speedtest/go.mod @@ -260,9 +260,9 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.21.0 // indirect - golang.org/x/crypto v0.44.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 // indirect + golang.org/x/net v0.47.0 // indirect golang.org/x/oauth2 v0.32.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect diff --git a/tests/speedtest/go.sum b/tests/speedtest/go.sum index 9b4cd70ca..68367c563 100644 --- a/tests/speedtest/go.sum +++ b/tests/speedtest/go.sum @@ -1061,8 +1061,8 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -1118,8 +1118,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 h1:6/3JGEh1C88g7m+qzzTbl3A0FtsLguXieqofVLU/JAo= -golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index 6f8e9534d..a9de44dac 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -37,7 +37,7 @@ require ( github.com/VictoriaMetrics/fastcache v1.12.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.2.0 // indirect - github.com/bits-and-blooms/bitset v1.24.3 // indirect + github.com/bits-and-blooms/bitset v1.24.4 // indirect github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect @@ -145,7 +145,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -177,7 +177,7 @@ require ( github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v1.0.1 // indirect go.etcd.io/bbolt v1.4.0 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel v1.38.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect @@ -187,18 +187,18 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.21.0 // indirect - golang.org/x/crypto v0.44.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/net v0.46.0 // indirect + golang.org/x/net v0.47.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/text v0.31.0 // indirect golang.org/x/tools v0.38.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect - google.golang.org/grpc v1.76.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect + google.golang.org/grpc v1.77.0 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 97e85d3c7..16e74a81c 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -9,8 +9,8 @@ cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gC cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= cloud.google.com/go/compute v1.38.0 h1:MilCLYQW2m7Dku8hRIIKo4r0oKastlD74sSu16riYKs= -cloud.google.com/go/compute/metadata v0.8.0 h1:HxMRIbao8w17ZX6wBnjhcDkW6lTFpgcaobyVfZWqRLA= -cloud.google.com/go/compute/metadata v0.8.0/go.mod h1:sYOGTp851OV9bOFJ9CH7elVvyzopvWQFNNghtDQ/Biw= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8= cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE= cloud.google.com/go/monitoring v1.24.2 h1:5OTsoJ1dXYIiMiuL+sYscLc9BumrL3CarVLL7dd7lHM= @@ -61,8 +61,8 @@ github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bp github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.7 h1:ybO8RBeh29qrxIhCA9E8gKY6xfONU9T6G6aP9DTKfLE= github.com/DataDog/zstd v1.5.7/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 h1:UQUsRi8WTzhZntp5313l+CHIAT95ojUI2lpP/ExlZa4= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0/go.mod h1:Cz6ft6Dkn3Et6l2v2a9/RpN7epQ1GtDlO6lj8bEcOvw= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 h1:sBEjpZlNHzK1voKq9695PJSX2o5NEXl7/OL3coiIY0c= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 h1:owcC2UnmsZycprQ5RfRgjydWhuoxg71LUfyiQdijZuM= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0/go.mod h1:ZPpqegjbE99EPKsu3iUWV22A04wzGPcAY/ziSIQEEgs= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 h1:Ron4zCA/yk6U7WOBXhTJcDpsUBG9npumK6xw2auFltQ= @@ -145,8 +145,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.24.3 h1:Bte86SlO3lwPQqww+7BE9ZuUCKIjfqnG5jtEyqA9y9Y= -github.com/bits-and-blooms/bitset v1.24.3/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.24.4 h1:95H15Og1clikBrKr/DuzMXkQzECs1M6hhoGXLwLQOZE= +github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.3.5 h1:dpAlnAwmT1yIBm3exhT1/8iUSD98RDJM5vqJVQDQLiU= @@ -192,8 +192,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y+bSQAYZnetRJ70VMVKm5CKI0= +github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -304,9 +304,9 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M= -github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A= -github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw= +github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329 h1:K+fnvUM0VZ7ZFJf0n4L/BRlnsb9pL/GuDG6FqaH+PwM= +github.com/envoyproxy/go-control-plane/envoy v1.35.0 h1:ixjkELDE+ru6idPxcHLj8LBVc2bFP7iBytj353BoHUo= +github.com/envoyproxy/go-control-plane/envoy v1.35.0/go.mod h1:09qwbGVuSWWAyN5t/b3iyVfz5+z8QWGrzkoqm/8SbEs= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= @@ -342,8 +342,8 @@ github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwv github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI= -github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -775,8 +775,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= 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= @@ -844,8 +844,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= -github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE= -github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g= +github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= +github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -915,8 +915,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM= -github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/zondax/golem v0.27.0 h1:IbBjGIXF3SoGOZHsILJvIM/F/ylwJzMcHAcggiqniPw= github.com/zondax/golem v0.27.0/go.mod h1:AmorCgJPt00L8xN1VrMBe13PSifoZksnQ1Ge906bu4A= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= @@ -930,10 +928,10 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0 h1:F7q2tNlCaHY9nMKHR6XH9/qkp8FktLnIcy6jJNyOCQw= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0/go.mod h1:IbBN8uAIIx734PTonTPxAxnjc2pQTxWNkwfstZ+6H2k= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY6LiIY9I8cUfm+pJs= +go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= @@ -985,8 +983,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -1032,13 +1030,13 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= -golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= -golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= +golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= 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= @@ -1172,10 +1170,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 h1:M1rk8KBnUsBDg1oPGHNCxG4vc1f49epmTO7xscSajMk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= 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= @@ -1193,8 +1191,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/vm/keeper/state_transition.go b/x/vm/keeper/state_transition.go index 192f00ad5..cec90531f 100644 --- a/x/vm/keeper/state_transition.go +++ b/x/vm/keeper/state_transition.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" + "go.opentelemetry.io/otel" cmttypes "github.com/cometbft/cometbft/types" @@ -28,6 +29,10 @@ import ( consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" ) +var ( + otelTracer = otel.Tracer("cosmos/evm/x/vm") +) + // NewEVMWithOverridePrecompiles creates a new EVM instance with opcode hooks and optionally overrides // the precompiles call hook. If overridePrecompiles is true, the EVM will use the keeper's static precompiles // for call hooks; otherwise, it will use the recipient-specific precompile hook. @@ -196,6 +201,8 @@ func calculateCumulativeGasFromEthResponse(meter storetypes.GasMeter, res *types // // For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072 func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*types.MsgEthereumTxResponse, error) { + ctx, span := ctx.StartSpan(otelTracer, "ApplyTransaction") + defer span.End() cfg, err := k.EVMConfig(ctx, ctx.BlockHeader().ProposerAddress) if err != nil { return nil, errorsmod.Wrap(err, "failed to load evm config") @@ -376,6 +383,8 @@ func (k *Keeper) ApplyMessageWithConfig( internal bool, overrides *rpctypes.StateOverride, ) (*types.MsgEthereumTxResponse, error) { + ctx, span := ctx.StartSpan(otelTracer, "ApplyMessageWithConfig") + defer span.End() var ( ret []byte // return bytes from evm execution vmErr error // vm errors do not effect consensus and are therefore not assigned to err From b0af0488cf206e190939135b0a04eee0907de02a Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 26 Nov 2025 13:51:17 -0800 Subject: [PATCH 02/14] some fixes --- rpc/backend/backend.go | 2 +- rpc/backend/call_tx.go | 4 ++-- rpc/backend/chain_info.go | 6 ++---- rpc/backend/comet_to_eth.go | 2 +- rpc/backend/sign_tx.go | 2 +- rpc/backend/tx_info.go | 14 +++++++------- rpc/backend/tx_pool.go | 8 ++++---- rpc/backend/utils.go | 2 +- .../integration/rpc/backend/test_backend_suite.go | 4 ++-- tests/integration/rpc/backend/test_call_tx.go | 2 +- tests/integration/rpc/backend/test_sign_tx.go | 4 ++-- tests/integration/rpc/backend/test_tracing.go | 2 +- tests/integration/rpc/backend/test_tx_info.go | 10 +++++----- 13 files changed, 30 insertions(+), 32 deletions(-) diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index c9ec34ded..b3652175b 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -92,7 +92,7 @@ type EVMBackend interface { // Chain Info ChainID(ctx context.Context) (*hexutil.Big, error) - ChainConfig(ctx context.Context) *params.ChainConfig + ChainConfig() *params.ChainConfig GlobalMinGasPrice(ctx context.Context) (*big.Int, error) BaseFee(ctx context.Context, blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error) CurrentHeader(ctx context.Context) (*ethtypes.Header, error) diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 7653bff5c..dcc53edee 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -46,7 +46,7 @@ func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gas // The signer used should always be the 'latest' known one because we expect // signers to be backwards-compatible with old transactions. - cfg := b.ChainConfig(ctx) + cfg := b.ChainConfig() if cfg == nil { cfg = evmtypes.DefaultChainConfig(b.EvmChainID.Uint64()).EthereumConfig(nil) } @@ -130,7 +130,7 @@ func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (r } ethereumTx := &evmtypes.MsgEthereumTx{} - ethSigner := ethtypes.LatestSigner(b.ChainConfig(ctx)) + ethSigner := ethtypes.LatestSigner(b.ChainConfig()) if err := ethereumTx.FromSignedEthereumTx(tx, ethSigner); err != nil { b.Logger.Error("transaction converting failed", "error", err.Error()) return common.Hash{}, fmt.Errorf("failed to convert ethereum transaction: %w", err) diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index f7b972e9f..11a64352b 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -42,7 +42,7 @@ func (b *Backend) ChainID(ctx context.Context) (result *hexutil.Big, err error) return (*hexutil.Big)(b.EvmChainID), nil } - if config := b.ChainConfig(ctx); config.IsEIP155(new(big.Int).SetUint64(uint64(bn))) { + if config := b.ChainConfig(); config.IsEIP155(new(big.Int).SetUint64(uint64(bn))) { return (*hexutil.Big)(config.ChainID), nil } @@ -50,9 +50,7 @@ func (b *Backend) ChainID(ctx context.Context) (result *hexutil.Big, err error) } // ChainConfig returns the latest ethereum chain configuration -func (b *Backend) ChainConfig(ctx context.Context) *params.ChainConfig { - _, span := tracer.Start(ctx, "ChainConfig") - defer span.End() +func (b *Backend) ChainConfig() *params.ChainConfig { return evmtypes.GetEthChainConfig() } diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index f18304800..5d7e3675a 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -59,7 +59,7 @@ func (b *Backend) RPCBlockFromCometBlock( return nil, fmt.Errorf("failed to get rpc block from comet block: %w", err) } - return rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, b.ChainConfig(ctx)) + return rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, b.ChainConfig()) } // BlockNumberFromComet returns the BlockNumber from BlockNumberOrHash diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 5137ce38d..6db7b3c52 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -68,7 +68,7 @@ func (b *Backend) SendTransaction(ctx context.Context, args evmtypes.Transaction return common.Hash{}, err } - signer := ethtypes.MakeSigner(b.ChainConfig(ctx), new(big.Int).SetUint64(uint64(bn)), header.Time) + signer := ethtypes.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn)), header.Time) // LegacyTx derives EvmChainID from the signature. To make sure the msg.ValidateBasic makes // the corresponding EvmChainID validation, we need to sign the transaction before calling it diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index a2ae78780..c7a7a91a4 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -99,7 +99,7 @@ func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) blockTime, index, baseFee, - b.ChainConfig(ctx), + b.ChainConfig(), ), nil } @@ -133,7 +133,7 @@ func (b *Backend) GetTransactionByHashPending(ctx context.Context, txHash common uint64(0), uint64(0), nil, - b.ChainConfig(ctx), + b.ChainConfig(), ), nil } } @@ -450,7 +450,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(ctx context.Context, block *cmtr blockTime, index, baseFee, - b.ChainConfig(ctx), + b.ChainConfig(), ), nil } @@ -563,8 +563,8 @@ func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.Trans addressesToExclude[*args.To] = struct{}{} } - isMerge := b.ChainConfig(ctx).MergeNetsplitBlock != nil - precompiles := vm.ActivePrecompiles(b.ChainConfig(ctx).Rules(header.Number, isMerge, header.Time)) + isMerge := b.ChainConfig().MergeNetsplitBlock != nil + precompiles := vm.ActivePrecompiles(b.ChainConfig().Rules(header.Number, isMerge, header.Time)) for _, addr := range precompiles { addressesToExclude[addr] = struct{}{} } @@ -579,7 +579,7 @@ func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.Trans for _, auth := range args.AuthorizationList { // validate authorization (duplicating stateTransition.validateAuthorization() logic from geth: https://github.com/ethereum/go-ethereum/blob/bf8f63dcd27e178bd373bfe41ea718efee2851dd/core/state_transition.go#L575) nonceOverflow := auth.Nonce+1 < auth.Nonce - invalidChainID := !auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig(ctx).ChainID) != 0 + invalidChainID := !auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0 if nonceOverflow || invalidChainID { b.Logger.Error("invalid authorization", "auth", auth) continue @@ -615,7 +615,7 @@ func (b *Backend) initAccessListTracer(ctx context.Context, args evmtypes.Transa nonce64 := hexutil.Uint64(nonce) args.Nonce = &nonce64 } - if err = args.CallDefaults(b.RPCGasCap(), header.BaseFee, b.ChainConfig(ctx).ChainID); err != nil { + if err = args.CallDefaults(b.RPCGasCap(), header.BaseFee, b.ChainConfig().ChainID); err != nil { b.Logger.Error("failed to set default call args", "error", err) return nil, nil, err } diff --git a/rpc/backend/tx_pool.go b/rpc/backend/tx_pool.go index c707be3c2..63e7b54ca 100644 --- a/rpc/backend/tx_pool.go +++ b/rpc/backend/tx_pool.go @@ -55,7 +55,7 @@ func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map } for _, tx := range txList { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) content[StatusPending][addrStr][strconv.FormatUint(tx.Nonce(), 10)] = rpcTx } } @@ -68,7 +68,7 @@ func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map } for _, tx := range txList { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) content[StatusQueued][addrStr][strconv.FormatUint(tx.Nonce(), 10)] = rpcTx } } @@ -102,7 +102,7 @@ func (b *Backend) ContentFrom(ctx context.Context, addr common.Address) (result // Build the pending transactions dump := make(map[string]*types.RPCTransaction, len(pending)) // variable name comes from go-ethereum: https://github.com/ethereum/go-ethereum/blob/0dacfef8ac42e7be5db26c2956f2b238ba7c75e8/internal/ethapi/api.go#L221 for _, tx := range pending { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) dump[fmt.Sprintf("%d", tx.Nonce())] = rpcTx } content[StatusPending] = dump @@ -110,7 +110,7 @@ func (b *Backend) ContentFrom(ctx context.Context, addr common.Address) (result // Build the queued transactions dump = make(map[string]*types.RPCTransaction, len(queue)) // variable name comes from go-ethereum: https://github.com/ethereum/go-ethereum/blob/0dacfef8ac42e7be5db26c2956f2b238ba7c75e8/internal/ethapi/api.go#L221 for _, tx := range queue { - rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig(ctx)) + rpcTx := types.NewRPCPendingTransaction(tx, curHeader, b.ChainConfig()) dump[fmt.Sprintf("%d", tx.Nonce())] = rpcTx } content[StatusQueued] = dump diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 777cf355e..196039444 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -150,7 +150,7 @@ func (b *Backend) ProcessBlock( } else { targetOneFeeHistory.BaseFee = blockBaseFee } - cfg := b.ChainConfig(ctx) + cfg := b.ChainConfig() gasLimitUint64, ok := (*ethBlock)["gasLimit"].(hexutil.Uint64) if !ok { return fmt.Errorf("invalid gas limit type: %T", (*ethBlock)["gasLimit"]) diff --git a/tests/integration/rpc/backend/test_backend_suite.go b/tests/integration/rpc/backend/test_backend_suite.go index df77fe1c0..9d45db0ca 100644 --- a/tests/integration/rpc/backend/test_backend_suite.go +++ b/tests/integration/rpc/backend/test_backend_suite.go @@ -180,7 +180,7 @@ func (s *TestSuite) buildFormattedBlock( msgs = []*evmtypes.MsgEthereumTx{tx} } ethBlock := s.buildEthBlock(blockRes, resBlock, msgs, validator, baseFee) - res, err := rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, s.backend.ChainConfig(s.Ctx())) + res, err := rpctypes.RPCMarshalBlock(ethBlock, resBlock, msgs, true, fullTx, s.backend.ChainConfig()) s.Require().NoError(err) return res @@ -250,7 +250,7 @@ func (s *TestSuite) signAndEncodeEthTx(msgEthereumTx *evmtypes.MsgEthereumTx) [] from, priv := utiltx.NewAddrKey() signer := utiltx.NewSigner(priv) - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) msgEthereumTx.From = from.Bytes() err := msgEthereumTx.Sign(ethSigner, signer) s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_call_tx.go b/tests/integration/rpc/backend/test_call_tx.go index 78ae2dfbd..e8fa75889 100644 --- a/tests/integration/rpc/backend/test_call_tx.go +++ b/tests/integration/rpc/backend/test_call_tx.go @@ -298,7 +298,7 @@ func (s *TestSuite) TestSendRawTransaction() { emptyEvmChainIDTx := s.buildEthereumTxWithChainID(nil) invalidChainID := big.NewInt(1) // Sign the ethTx - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) err := ethTx.Sign(ethSigner, s.signer) s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_sign_tx.go b/tests/integration/rpc/backend/test_sign_tx.go index 6582f1064..b861c7a0e 100644 --- a/tests/integration/rpc/backend/test_sign_tx.go +++ b/tests/integration/rpc/backend/test_sign_tx.go @@ -129,7 +129,7 @@ func (s *TestSuite) TestSendTransaction() { if tc.expPass { // Sign the transaction and get the hash - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) msg := evmtypes.NewTxFromArgs(&callArgsDefault) err := msg.Sign(ethSigner, s.backend.ClientCtx.Keyring) s.Require().NoError(err) @@ -256,7 +256,7 @@ func broadcastTx(suite *TestSuite, priv *ethsecp256k1.PrivKey, baseFee math.Int, RegisterBaseFee(QueryClient, baseFee) RegisterValidatorAccount(QueryClient, sdk.AccAddress(utiltx.GenerateAddress().Bytes())) RegisterConsensusParams(client, height) - ethSigner := ethtypes.LatestSigner(suite.backend.ChainConfig(suite.Ctx())) + ethSigner := ethtypes.LatestSigner(suite.backend.ChainConfig()) msg := evmtypes.NewTxFromArgs(&callArgsDefault) err := msg.Sign(ethSigner, suite.backend.ClientCtx.Keyring) suite.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_tracing.go b/tests/integration/rpc/backend/test_tracing.go index d778c2abb..bb132585a 100644 --- a/tests/integration/rpc/backend/test_tracing.go +++ b/tests/integration/rpc/backend/test_tracing.go @@ -35,7 +35,7 @@ func (s *TestSuite) TestTraceTransaction() { armor := crypto.EncryptArmorPrivKey(priv, "", "eth_secp256k1") _ = s.backend.ClientCtx.Keyring.ImportPrivKey("test_key", armor, "") - ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig(s.Ctx())) + ethSigner := ethtypes.LatestSigner(s.backend.ChainConfig()) txEncoder := s.backend.ClientCtx.TxConfig.TxEncoder() diff --git a/tests/integration/rpc/backend/test_tx_info.go b/tests/integration/rpc/backend/test_tx_info.go index 10d88313a..38ab1127f 100644 --- a/tests/integration/rpc/backend/test_tx_info.go +++ b/tests/integration/rpc/backend/test_tx_info.go @@ -47,7 +47,7 @@ func (s *TestSuite) TestGetTransactionByHash() { } blockTime := uint64(block.Time.UTC().Unix()) //nolint:gosec // G115 - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, blockTime, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, blockTime, 0, big.NewInt(1), s.backend.ChainConfig()) testCases := []struct { name string @@ -129,7 +129,7 @@ func (s *TestSuite) TestGetTransactionByHash() { func (s *TestSuite) TestGetTransactionsByHashPending() { msgEthereumTx, bz := s.buildEthereumTx() - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig()) testCases := []struct { name string @@ -189,7 +189,7 @@ func (s *TestSuite) TestGetTransactionsByHashPending() { func (s *TestSuite) TestGetTxByEthHash() { msgEthereumTx, bz := s.buildEthereumTx() - rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig(s.Ctx())) + rpcTransaction := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, 0, big.NewInt(1), s.backend.ChainConfig()) testCases := []struct { name string @@ -307,7 +307,7 @@ func (s *TestSuite) TestGetTransactionByBlockAndIndex() { blockTime, 0, big.NewInt(1), - s.backend.ChainConfig(s.Ctx()), + s.backend.ChainConfig(), ) testCases := []struct { name string @@ -403,7 +403,7 @@ func (s *TestSuite) TestGetTransactionByBlockNumberAndIndex() { blockTime, 0, big.NewInt(1), - s.backend.ChainConfig(s.Ctx()), + s.backend.ChainConfig(), ) testCases := []struct { name string From af08ce4a3d1d011c17e02c6c5dcb1efc54e67b51 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:14:22 -0800 Subject: [PATCH 03/14] bug fixes --- evmd/app.go | 4 +++- rpc/backend/account_info.go | 10 ---------- rpc/backend/backend.go | 12 ++++++------ rpc/backend/call_tx.go | 2 ++ rpc/backend/chain_info.go | 3 ++- rpc/backend/node_info.go | 8 ++++---- rpc/backend/sign_tx.go | 4 ++-- rpc/backend/utils.go | 10 ++++++++++ rpc/namespaces/ethereum/eth/api.go | 12 +++--------- rpc/namespaces/ethereum/eth/filters/api.go | 3 +-- rpc/namespaces/ethereum/personal/api.go | 16 ++++------------ tests/integration/rpc/backend/test_node_info.go | 2 +- tests/integration/rpc/backend/test_sign_tx.go | 4 ++-- 13 files changed, 40 insertions(+), 50 deletions(-) diff --git a/evmd/app.go b/evmd/app.go index 3623f57ce..cf2604c29 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -129,6 +129,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" cosmosevmserver "github.com/cosmos/evm/server" + // import telemetry for side effects. + // telemetry package contains an init that instantiates the otel sdk. _ "github.com/cosmos/cosmos-sdk/telemetry" ) @@ -411,7 +413,7 @@ func NewExampleApp( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 1ecda5d73..af7c2ebed 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -240,13 +240,3 @@ func (b *Backend) GetTransactionCount(ctx context.Context, address common.Addres n = hexutil.Uint64(nonce) return &n, nil } - -func unwrapBlockNOrHash(blockNOrHash rpctypes.BlockNumberOrHash) string { - if blockNOrHash.BlockHash != nil { - return blockNOrHash.BlockHash.String() - } - if blockNOrHash.BlockNumber != nil { - return fmt.Sprintf("%d", *blockNOrHash.BlockNumber) - } - return "" -} diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index b3652175b..06e435527 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -44,13 +44,13 @@ type BackendI interface { //nolint: revive // Implemented by Backend. type EVMBackend interface { // Node specific queries - Accounts(ctx context.Context) ([]common.Address, error) + Accounts() ([]common.Address, error) Syncing(ctx context.Context) (interface{}, error) SetEtherbase(ctx context.Context, etherbase common.Address) bool SetGasPrice(ctx context.Context, gasPrice hexutil.Big) bool - ImportRawKey(ctx context.Context, privkey, password string) (common.Address, error) - ListAccounts(ctx context.Context) ([]common.Address, error) - NewMnemonic(ctx context.Context, uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error) + ImportRawKey(privkey, password string) (common.Address, error) + ListAccounts() ([]common.Address, error) + NewMnemonic(uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error) UnprotectedAllowed() bool RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection @@ -58,9 +58,9 @@ type EVMBackend interface { RPCMinGasPrice() *big.Int // Sign Tx - Sign(ctx context.Context, address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) + Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs) (common.Hash, error) - SignTypedData(ctx context.Context, address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) + SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) // Blocks Info BlockNumber(ctx context.Context) (hexutil.Uint64, error) diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index dcc53edee..e97c255ae 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -118,6 +118,8 @@ func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (r return common.Hash{}, err } + span.SetAttributes(attribute.String("tx_hash", tx.Hash().Hex())) + // check the local node config in case unprotected txs are disabled if !b.UnprotectedAllowed() { if !tx.Protected() { diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 11a64352b..f81454330 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -186,9 +186,10 @@ func (b *Backend) FeeHistory( userBlockCount math.HexOrDecimal64, // number blocks to fetch, maximum is 100 lastBlock rpc.BlockNumber, // the block to start search , to oldest rewardPercentiles []float64, // percentiles to fetch reward -) (*rpctypes.FeeHistoryResult, error) { +) (_ *rpctypes.FeeHistoryResult, err error) { ctx, span := tracer.Start(ctx, "FeeHistory", trace.WithAttributes(attribute.Int64("blockCount", int64(userBlockCount)), attribute.Int64("lastBlock", int64(lastBlock)))) defer span.End() + defer func() { span.RecordError(err) }() for i, p := range rewardPercentiles { if p < 0 || p > 100 { return nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 62ea917eb..017ac132e 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -32,7 +32,7 @@ import ( ) // Accounts returns the list of accounts available to this node. -func (b *Backend) Accounts(_ context.Context) ([]common.Address, error) { +func (b *Backend) Accounts() ([]common.Address, error) { addresses := make([]common.Address, 0) // return [] instead of nil if empty if !b.Cfg.JSONRPC.AllowInsecureUnlock { @@ -197,7 +197,7 @@ func (b *Backend) SetEtherbase(ctx context.Context, etherbase common.Address) bo // keys stored on the keyring. // // NOTE: The key will be both armored and encrypted using the same passphrase. -func (b *Backend) ImportRawKey(_ context.Context, privkey, password string) (common.Address, error) { +func (b *Backend) ImportRawKey(privkey, password string) (common.Address, error) { priv, err := crypto.HexToECDSA(privkey) if err != nil { return common.Address{}, err @@ -229,7 +229,7 @@ func (b *Backend) ImportRawKey(_ context.Context, privkey, password string) (com } // ListAccounts will return a list of addresses for accounts this node manages. -func (b *Backend) ListAccounts(ctx context.Context) ([]common.Address, error) { +func (b *Backend) ListAccounts() ([]common.Address, error) { addrs := []common.Address{} if !b.Cfg.JSONRPC.AllowInsecureUnlock { @@ -254,7 +254,7 @@ func (b *Backend) ListAccounts(ctx context.Context) ([]common.Address, error) { } // NewAccount will create a new account and returns the address for the new account. -func (b *Backend) NewMnemonic(ctx context.Context, uid string, +func (b *Backend) NewMnemonic(uid string, _ keyring.Language, hdPath, bip39Passphrase string, diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 6db7b3c52..154078c84 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -135,7 +135,7 @@ func (b *Backend) SendTransaction(ctx context.Context, args evmtypes.Transaction } // Sign signs the provided data using the private key of address via Geth's signature standard. -func (b *Backend) Sign(_ context.Context, address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { +func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { from := sdk.AccAddress(address.Bytes()) _, err := b.ClientCtx.Keyring.KeyByAddress(from) @@ -156,7 +156,7 @@ func (b *Backend) Sign(_ context.Context, address common.Address, data hexutil.B } // SignTypedData signs EIP-712 conformant typed data -func (b *Backend) SignTypedData(_ context.Context, address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { +func (b *Backend) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { from := sdk.AccAddress(address.Bytes()) _, err := b.ClientCtx.Keyring.KeyByAddress(from) diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 196039444..80974f0d7 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -344,3 +344,13 @@ func GetHexProofs(proof *crypto.ProofOps) []string { } return proofs } + +func unwrapBlockNOrHash(blockNOrHash types.BlockNumberOrHash) string { + if blockNOrHash.BlockHash != nil { + return blockNOrHash.BlockHash.String() + } + if blockNOrHash.BlockNumber != nil { + return fmt.Sprintf("%d", *blockNOrHash.BlockNumber) + } + return "" +} diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 787283def..6e72f6f8b 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -277,10 +277,8 @@ func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, // Accounts returns the list of accounts available to this node. func (e *PublicAPI) Accounts() ([]common.Address, error) { - ctx, span := tracer.Start(context.Background(), "eth_accounts") - defer span.End() e.logger.Debug("eth_accounts") - return e.backend.Accounts(ctx) + return e.backend.Accounts() } // GetBalance returns the provided account's balance up to the provided block number. @@ -454,10 +452,8 @@ func (e *PublicAPI) Syncing() (interface{}, error) { // Sign signs the provided data using the private key of address via Geth's signature standard. func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { - ctx, span := tracer.Start(context.Background(), "eth_sign") - defer span.End() e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) - return e.backend.Sign(ctx, address, data) + return e.backend.Sign(address, data) } // GetTransactionLogs returns the logs given a transaction hash. @@ -471,10 +467,8 @@ func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, err // SignTypedData signs EIP-712 conformant typed data func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { - ctx, span := tracer.Start(context.Background(), "eth_signTypedData") - defer span.End() e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) - return e.backend.SignTypedData(ctx, address, typedData) + return e.backend.SignTypedData(address, typedData) } // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 376ed08b5..581b70a13 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -11,7 +11,6 @@ import ( "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" "github.com/pkg/errors" - "go.opencensus.io/trace" "go.opentelemetry.io/otel" coretypes "github.com/cometbft/cometbft/rpc/core/types" @@ -279,7 +278,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ethtypes.Log, error) { - ctx, span := trace.StartSpan(ctx, "GetFilterLogs") + ctx, span := tracer.Start(ctx, "GetFilterLogs") defer span.End() api.filtersMu.Lock() f, found := api.filters[id] diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 85137979f..311904541 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -60,17 +60,13 @@ func NewAPI( // NOTE: The key will be both armored and encrypted using the same passphrase. func (api *PrivateAccountAPI) ImportRawKey(privkey, password string) (common.Address, error) { api.logger.Debug("personal_importRawKey") - ctx, span := tracer.Start(context.Background(), "ImportRawKey") - defer span.End() - return api.backend.ImportRawKey(ctx, privkey, password) + return api.backend.ImportRawKey(privkey, password) } // ListAccounts will return a list of addresses for accounts this node manages. func (api *PrivateAccountAPI) ListAccounts() ([]common.Address, error) { api.logger.Debug("personal_listAccounts") - ctx, span := tracer.Start(context.Background(), "ListAccounts") - defer span.End() - return api.backend.ListAccounts(ctx) + return api.backend.ListAccounts() } // LockAccount will lock the account associated with the given address when it's unlocked. @@ -85,15 +81,13 @@ func (api *PrivateAccountAPI) LockAccount(address common.Address) bool { // NewAccount will create a new account and returns the address for the new account. func (api *PrivateAccountAPI) NewAccount(password string) (common.Address, error) { api.logger.Debug("personal_newAccount") - ctx, span := tracer.Start(context.Background(), "NewAccount") - defer span.End() name := "key_" + time.Now().UTC().Format(time.RFC3339) // create the mnemonic and save the account hdPath := api.hdPathIter() - info, err := api.backend.NewMnemonic(ctx, name, keyring.English, hdPath.String(), password, hd.EthSecp256k1) + info, err := api.backend.NewMnemonic(name, keyring.English, hdPath.String(), password, hd.EthSecp256k1) if err != nil { return common.Address{}, err } @@ -139,9 +133,7 @@ func (api *PrivateAccountAPI) SendTransaction(ctx context.Context, args evmtypes // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign func (api *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, _ string) (hexutil.Bytes, error) { api.logger.Debug("personal_sign", "data", data, "address", addr.String()) - ctx, span := tracer.Start(ctx, "Sign") - defer span.End() - return api.backend.Sign(ctx, addr, data) + return api.backend.Sign(addr, data) } // EcRecover returns the address for the account that was used to create the signature. diff --git a/tests/integration/rpc/backend/test_node_info.go b/tests/integration/rpc/backend/test_node_info.go index d7a5a9073..eb55f956e 100644 --- a/tests/integration/rpc/backend/test_node_info.go +++ b/tests/integration/rpc/backend/test_node_info.go @@ -154,7 +154,7 @@ func (s *TestSuite) TestAccounts() { s.SetupTest() // reset test and queries tc.registerMock() - output, err := s.backend.Accounts(s.Ctx()) + output, err := s.backend.Accounts() if tc.expPass { s.Require().NoError(err) diff --git a/tests/integration/rpc/backend/test_sign_tx.go b/tests/integration/rpc/backend/test_sign_tx.go index b861c7a0e..99ee64783 100644 --- a/tests/integration/rpc/backend/test_sign_tx.go +++ b/tests/integration/rpc/backend/test_sign_tx.go @@ -180,7 +180,7 @@ func (s *TestSuite) TestSign() { s.SetupTest() // reset test and queries tc.registerMock() - responseBz, err := s.backend.Sign(s.Ctx(), tc.fromAddr, tc.inputBz) + responseBz, err := s.backend.Sign(tc.fromAddr, tc.inputBz) if tc.expPass { signature, _, err := s.backend.ClientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), tc.inputBz, signingtypes.SignMode_SIGN_MODE_TEXTUAL) signature[goethcrypto.RecoveryIDOffset] += 27 @@ -228,7 +228,7 @@ func (s *TestSuite) TestSignTypedData() { s.SetupTest() // reset test and queries tc.registerMock() - responseBz, err := s.backend.SignTypedData(s.Ctx(), tc.fromAddr, tc.inputTypedData) + responseBz, err := s.backend.SignTypedData(tc.fromAddr, tc.inputTypedData) if tc.expPass { sigHash, _, _ := apitypes.TypedDataAndHash(tc.inputTypedData) From bd482565ebff889c21c1ecf3dde6a837de4b8129 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:19:01 -0800 Subject: [PATCH 04/14] remove temp tracer from state_transition --- x/vm/keeper/state_transition.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/x/vm/keeper/state_transition.go b/x/vm/keeper/state_transition.go index cec90531f..192f00ad5 100644 --- a/x/vm/keeper/state_transition.go +++ b/x/vm/keeper/state_transition.go @@ -11,7 +11,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" - "go.opentelemetry.io/otel" cmttypes "github.com/cometbft/cometbft/types" @@ -29,10 +28,6 @@ import ( consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" ) -var ( - otelTracer = otel.Tracer("cosmos/evm/x/vm") -) - // NewEVMWithOverridePrecompiles creates a new EVM instance with opcode hooks and optionally overrides // the precompiles call hook. If overridePrecompiles is true, the EVM will use the keeper's static precompiles // for call hooks; otherwise, it will use the recipient-specific precompile hook. @@ -201,8 +196,6 @@ func calculateCumulativeGasFromEthResponse(meter storetypes.GasMeter, res *types // // For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072 func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*types.MsgEthereumTxResponse, error) { - ctx, span := ctx.StartSpan(otelTracer, "ApplyTransaction") - defer span.End() cfg, err := k.EVMConfig(ctx, ctx.BlockHeader().ProposerAddress) if err != nil { return nil, errorsmod.Wrap(err, "failed to load evm config") @@ -383,8 +376,6 @@ func (k *Keeper) ApplyMessageWithConfig( internal bool, overrides *rpctypes.StateOverride, ) (*types.MsgEthereumTxResponse, error) { - ctx, span := ctx.StartSpan(otelTracer, "ApplyMessageWithConfig") - defer span.End() var ( ret []byte // return bytes from evm execution vmErr error // vm errors do not effect consensus and are therefore not assigned to err From 79b76e4b9c3fcd9dda41635fb0c0341dbb90a9d6 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:36:59 -0800 Subject: [PATCH 05/14] more fixes --- rpc/backend/account_info.go | 10 +++---- rpc/backend/backend.go | 2 +- rpc/backend/blocks.go | 10 +++---- rpc/backend/call_tx.go | 12 ++++---- rpc/backend/chain_info.go | 17 +++++------ rpc/backend/comet.go | 10 +++---- rpc/backend/comet_to_eth.go | 16 +++++------ rpc/backend/filters.go | 8 ++---- rpc/backend/headers.go | 8 +++--- rpc/backend/node_info.go | 2 +- rpc/backend/sign_tx.go | 2 +- rpc/backend/tracing.go | 6 ++-- rpc/backend/tx_info.go | 28 ++++++++++--------- rpc/backend/tx_pool.go | 4 +-- rpc/backend/utils.go | 6 ++-- rpc/namespaces/ethereum/debug/api.go | 16 +++++++---- rpc/namespaces/ethereum/eth/filters/api.go | 2 +- rpc/namespaces/ethereum/personal/api.go | 2 +- rpc/types/utils.go | 3 +- tests/integration/rpc/backend/test_filters.go | 2 +- 20 files changed, 88 insertions(+), 78 deletions(-) diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index af7c2ebed..59df107f3 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -28,8 +28,8 @@ import ( // GetCode returns the contract code at the given address and block number. func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (bz hexutil.Bytes, err error) { ctx, span := tracer.Start(ctx, "GetCode", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -52,8 +52,8 @@ func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOr // GetProof returns an account object with proof and any storage proofs func (b *Backend) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (result *rpctypes.AccountResult, err error) { ctx, span := tracer.Start(ctx, "GetProof", trace.WithAttributes(attribute.String("address", address.String()), attribute.StringSlice("storageKeys", storageKeys), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -138,8 +138,8 @@ func (b *Backend) GetProof(ctx context.Context, address common.Address, storageK // GetStorageAt returns the contract storage at the given address, block number, and key. func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (result hexutil.Bytes, err error) { ctx, span := tracer.Start(ctx, "GetStorageAt", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("key", key), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -164,8 +164,8 @@ func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key // GetBalance returns the provided account's *spendable* balance up to the provided block number. func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "GetBalance", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -203,8 +203,8 @@ func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockN // GetTransactionCount returns the number of transactions at the given address up to the given block number. func (b *Backend) GetTransactionCount(ctx context.Context, address common.Address, blockNum rpctypes.BlockNumber) (result *hexutil.Uint64, err error) { ctx, span := tracer.Start(ctx, "GetTransactionCount", trace.WithAttributes(attribute.String("address", address.String()), attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() n := hexutil.Uint64(0) bn, err := b.BlockNumber(ctx) diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 06e435527..f06d12705 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -123,7 +123,7 @@ type EVMBackend interface { // Filter API GetLogs(ctx context.Context, hash common.Hash) ([][]*ethtypes.Log, error) GetLogsByHeight(ctx context.Context, height *int64) ([][]*ethtypes.Log, error) - BloomStatus(ctx context.Context) (uint64, uint64) + BloomStatus() (uint64, uint64) // TxPool API Content(ctx context.Context) (map[string]map[string]map[string]*types.RPCTransaction, error) diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index b594f6564..381247f8e 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -27,8 +27,8 @@ import ( // rpc. func (b *Backend) BlockNumber(ctx context.Context) (result hexutil.Uint64, err error) { ctx, span := tracer.Start(ctx, "GetBlockNumber") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // do any grpc query, ignore the response and use the returned block height var header metadata.MD @@ -55,8 +55,8 @@ func (b *Backend) BlockNumber(ctx context.Context) (result hexutil.Uint64, err e // objects or if false only the hashes of the transactions. func (b *Backend) GetBlockByNumber(ctx context.Context, blockNum types.BlockNumber, fullTx bool) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Bool("fullTx", fullTx))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -87,8 +87,8 @@ func (b *Backend) GetBlockByNumber(ctx context.Context, blockNum types.BlockNumb // hash. func (b *Backend) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Bool("fullTx", fullTx))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -171,8 +171,8 @@ func (b *Backend) getBlockTransactionCount(ctx context.Context, block *cmtrpctyp // EthBlockByNumber returns the Ethereum Block identified by number. func (b *Backend) EthBlockByNumber(ctx context.Context, blockNum types.BlockNumber) (result *ethtypes.Block, err error) { ctx, span := tracer.Start(ctx, "EthBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -203,8 +203,8 @@ func (b *Backend) GetBlockReceipts( blockNrOrHash types.BlockNumberOrHash, ) (result []map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockReceipts", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index e97c255ae..c2b7a7eca 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -32,8 +32,8 @@ import ( // the given transaction from the pool and reinsert it with the new gas price and limit. func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (result common.Hash, err error) { ctx, span := tracer.Start(ctx, "Resend", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() if args.Nonce == nil { return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec") @@ -108,8 +108,8 @@ func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gas // SendRawTransaction send a raw Ethereum transaction. func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (result common.Hash, err error) { ctx, span := tracer.Start(ctx, "SendRawTransaction") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // RLP decode raw transaction bytes tx := ðtypes.Transaction{} @@ -202,8 +202,8 @@ func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (r // provided on the args func (b *Backend) SetTxDefaults(ctx context.Context, args evmtypes.TransactionArgs) (result evmtypes.TransactionArgs, err error) { ctx, span := tracer.Start(ctx, "SetTxDefaults") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { return args, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") @@ -343,8 +343,8 @@ func (b *Backend) EstimateGas( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "EstimateGas", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockNr := rpctypes.EthPendingBlockNumber if blockNrOrHash != nil { @@ -406,8 +406,8 @@ func (b *Backend) DoCall( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "DoCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.Int64("blockNr", blockNr.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() bz, err := json.Marshal(&args) if err != nil { @@ -466,8 +466,8 @@ func (b *Backend) DoCall( // GasPrice returns the current gas price based on Cosmos EVM' gas price oracle. func (b *Backend) GasPrice(ctx context.Context) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "GasPrice") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() head, err := b.CurrentHeader(ctx) if err != nil { diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index f81454330..bd38bb1a9 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -32,8 +32,8 @@ import ( // ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config. func (b *Backend) ChainID(ctx context.Context) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "ChainID") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // if current block is at or past the EIP-155 replay-protection fork block, return EvmChainID from config bn, err := b.BlockNumber(ctx) @@ -57,8 +57,8 @@ func (b *Backend) ChainConfig() *params.ChainConfig { // GlobalMinGasPrice returns MinGasPrice param from FeeMarket func (b *Backend) GlobalMinGasPrice(ctx context.Context) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "GlobalMinGasPrice") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() res, err := b.QueryClient.GlobalMinGasPrice(ctx, &evmtypes.QueryGlobalMinGasPriceRequest{}) if err != nil { @@ -76,8 +76,8 @@ func (b *Backend) GlobalMinGasPrice(ctx context.Context) (result *big.Int, err e // return nil. func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "BaseFee", trace.WithAttributes(attribute.Int64("height", blockRes.Height))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // return BaseFee if London hard fork is activated and feemarket is enabled ctx = rpctypes.ContextWithHeight(blockRes.Height, ctx) @@ -111,8 +111,8 @@ func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlock // if the ABCI responses are discarded ('discard_abci_responses' config param) func (b *Backend) CurrentHeader(ctx context.Context) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "CurrentHeader") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() return b.HeaderByNumber(ctx, rpctypes.EthLatestBlockNumber) } @@ -121,8 +121,8 @@ func (b *Backend) CurrentHeader(ctx context.Context) (result *ethtypes.Header, e // and have a from address that is one of the accounts this node manages. func (b *Backend) PendingTransactions(ctx context.Context) (result []*sdk.Tx, err error) { ctx, span := tracer.Start(ctx, "PendingTransactions") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() mc, ok := b.ClientCtx.Client.(cmtrpcclient.MempoolClient) if !ok { @@ -149,8 +149,8 @@ func (b *Backend) PendingTransactions(ctx context.Context) (result []*sdk.Tx, er // GetCoinbase is the address that staking rewards will be send to (alias for Etherbase). func (b *Backend) GetCoinbase(ctx context.Context) (result sdk.AccAddress, err error) { ctx, span := tracer.Start(ctx, "GetCoinbase") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() node, err := b.ClientCtx.GetNode() if err != nil { @@ -188,8 +188,8 @@ func (b *Backend) FeeHistory( rewardPercentiles []float64, // percentiles to fetch reward ) (_ *rpctypes.FeeHistoryResult, err error) { ctx, span := tracer.Start(ctx, "FeeHistory", trace.WithAttributes(attribute.Int64("blockCount", int64(userBlockCount)), attribute.Int64("lastBlock", int64(lastBlock)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() for i, p := range rewardPercentiles { if p < 0 || p > 100 { return nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) @@ -352,8 +352,9 @@ func (b *Backend) FeeHistory( // SuggestGasTipCap returns the suggested tip cap // Although we don't support tx prioritization yet, but we return a positive value to help client to // mitigate the base fee changes. -func (b *Backend) SuggestGasTipCap(ctx context.Context, baseFee *big.Int) (*big.Int, error) { +func (b *Backend) SuggestGasTipCap(ctx context.Context, baseFee *big.Int) (_ *big.Int, err error) { ctx, span := tracer.Start(ctx, "SuggestGasTipCap") + defer func() { span.RecordError(err) }() defer span.End() if baseFee == nil { // london hardfork not enabled or feemarket not enabled diff --git a/rpc/backend/comet.go b/rpc/backend/comet.go index 860d8bcc5..4fe7b12b3 100644 --- a/rpc/backend/comet.go +++ b/rpc/backend/comet.go @@ -19,8 +19,8 @@ import ( // block number func (b *Backend) CometBlockByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultBlock, err error) { ctx, span := tracer.Start(ctx, "CometBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { @@ -44,8 +44,8 @@ func (b *Backend) CometBlockByNumber(ctx context.Context, blockNum rpctypes.Bloc // block number func (b *Backend) CometHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultHeader, err error) { ctx, span := tracer.Start(ctx, "CometHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { @@ -62,8 +62,8 @@ func (b *Backend) CometBlockResultByNumber(ctx context.Context, height *int64) ( heightAttr = *height } ctx, span := tracer.Start(ctx, "CometBlockResultByNumber", trace.WithAttributes(attribute.Int64("height", heightAttr))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() if height != nil && *height == 0 { height = nil @@ -79,8 +79,8 @@ func (b *Backend) CometBlockResultByNumber(ctx context.Context, height *int64) ( // CometBlockByHash returns a CometBFT-formatted block by block number func (b *Backend) CometBlockByHash(ctx context.Context, blockHash common.Hash) (result *cmtrpctypes.ResultBlock, err error) { ctx, span := tracer.Start(ctx, "CometBlockByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.RPCClient.BlockByHash(ctx, blockHash.Bytes()) if err != nil { @@ -98,8 +98,8 @@ func (b *Backend) CometBlockByHash(ctx context.Context, blockHash common.Hash) ( func (b *Backend) getHeightByBlockNum(ctx context.Context, blockNum rpctypes.BlockNumber) (height int64, err error) { ctx, span := tracer.Start(ctx, "getHeightByBlockNum", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() if blockNum == rpctypes.EthEarliestBlockNumber { status, err := b.ClientCtx.Client.Status(ctx) diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index 5d7e3675a..e47a668c1 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -30,8 +30,8 @@ func (b *Backend) RPCHeaderFromCometBlock( blockRes *cmtrpctypes.ResultBlockResults, ) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "RPCHeaderFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { @@ -50,8 +50,8 @@ func (b *Backend) RPCBlockFromCometBlock( fullTx bool, ) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "RPCBlockFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() msgs := b.EthMsgsFromCometBlock(ctx, resBlock, blockRes) ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) @@ -65,8 +65,8 @@ func (b *Backend) RPCBlockFromCometBlock( // BlockNumberFromComet returns the BlockNumber from BlockNumberOrHash func (b *Backend) BlockNumberFromComet(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (result rpctypes.BlockNumber, err error) { ctx, span := tracer.Start(ctx, "BlockNumberFromComet", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() switch { case blockNrOrHash.BlockHash == nil && blockNrOrHash.BlockNumber == nil: @@ -87,8 +87,8 @@ func (b *Backend) BlockNumberFromComet(ctx context.Context, blockNrOrHash rpctyp // BlockNumberFromCometByHash returns the block height of given block hash func (b *Backend) BlockNumberFromCometByHash(ctx context.Context, blockHash common.Hash) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "BlockNumberFromCometByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resHeader, err := b.RPCClient.HeaderByHash(ctx, blockHash.Bytes()) if err != nil { @@ -154,8 +154,8 @@ func (b *Backend) EthBlockFromCometBlock( blockRes *cmtrpctypes.ResultBlockResults, ) (result *ethtypes.Block, err error) { ctx, span := tracer.Start(ctx, "EthBlockFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() cmtBlock := resBlock.Block @@ -224,8 +224,8 @@ func (b *Backend) MinerFromCometBlock( resBlock *cmtrpctypes.ResultBlock, ) (result common.Address, err error) { ctx, span := tracer.Start(ctx, "MinerFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() cmtBlock := resBlock.Block @@ -263,8 +263,8 @@ func (b *Backend) ReceiptsFromCometBlock( msgs []*evmtypes.MsgEthereumTx, ) (result []*ethtypes.Receipt, err error) { ctx, span := tracer.Start(ctx, "ReceiptsFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { @@ -347,8 +347,8 @@ func (b *Backend) ReceiptsFromCometBlock( // BlockBloom query block bloom filter from block results func (b *Backend) BlockBloomFromCometBlock(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result ethtypes.Bloom, err error) { ctx, span := tracer.Start(ctx, "BlockBloomFromCometBlock") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() for _, event := range blockRes.FinalizeBlockEvents { if event.Type != evmtypes.EventTypeBlockBloom { diff --git a/rpc/backend/filters.go b/rpc/backend/filters.go index f733559f2..eb8284102 100644 --- a/rpc/backend/filters.go +++ b/rpc/backend/filters.go @@ -13,8 +13,8 @@ import ( // GetLogs returns all the logs from all the ethereum transactions in a block. func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) (result [][]*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -33,8 +33,8 @@ func (b *Backend) GetLogsByHeight(ctx context.Context, height *int64) (result [] heightAttr = *height } ctx, span := tracer.Start(ctx, "GetLogsByHeight", trace.WithAttributes(attribute.Int64("height", heightAttr))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // NOTE: we query the state in case the tx result logs are not persisted after an upgrade. blockRes, err := b.RPCClient.BlockResults(ctx, height) @@ -47,8 +47,6 @@ func (b *Backend) GetLogsByHeight(ctx context.Context, height *int64) (result [] // BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained // by the chain indexer. -func (b *Backend) BloomStatus(ctx context.Context) (uint64, uint64) { - ctx, span := tracer.Start(ctx, "BloomStatus") - defer span.End() +func (b *Backend) BloomStatus() (uint64, uint64) { return 4096, 0 } diff --git a/rpc/backend/headers.go b/rpc/backend/headers.go index c448160ad..d21b3fd92 100644 --- a/rpc/backend/headers.go +++ b/rpc/backend/headers.go @@ -17,8 +17,8 @@ import ( // objects or if false only the hashes of the transactions. func (b *Backend) GetHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -49,8 +49,8 @@ func (b *Backend) GetHeaderByNumber(ctx context.Context, blockNum rpctypes.Block // hash. func (b *Backend) GetHeaderByHash(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetHeaderByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -80,8 +80,8 @@ func (b *Backend) GetHeaderByHash(ctx context.Context, hash common.Hash) (result // HeaderByNumber returns the block header identified by height. func (b *Backend) HeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "HeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -109,8 +109,8 @@ func (b *Backend) HeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNum // HeaderByHash returns the block header identified by hash. func (b *Backend) HeaderByHash(ctx context.Context, blockHash common.Hash) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "HeaderByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resBlock, err := b.CometBlockByHash(ctx, blockHash) if err != nil { diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 017ac132e..29bffd29c 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -66,8 +66,8 @@ func (b *Backend) Accounts() ([]common.Address, error) { // - knownStates: number of known state entries that still need to be pulled func (b *Backend) Syncing(ctx context.Context) (result interface{}, err error) { ctx, span := tracer.Start(ctx, "Syncing") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() status, err := b.ClientCtx.Client.Status(ctx) if err != nil { diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 154078c84..937dff51c 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -33,8 +33,8 @@ func (b *Backend) SendTransaction(ctx context.Context, args evmtypes.Transaction toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "SendTransaction", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // Look up the wallet containing the requested signer if !b.Cfg.JSONRPC.AllowInsecureUnlock { diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index 765857fbc..5ca3b5139 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -25,8 +25,8 @@ import ( // and returns them as a JSON object. func (b *Backend) TraceTransaction(ctx context.Context, hash common.Hash, config *rpctypes.TraceConfig) (result interface{}, err error) { ctx, span := tracer.Start(ctx, "TraceTransaction", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // Get transaction by hash transaction, err := b.GetTxByEthHash(ctx, hash) @@ -160,8 +160,8 @@ func (b *Backend) TraceBlock(ctx context.Context, height rpctypes.BlockNumber, block *tmrpctypes.ResultBlock, ) (result []*evmtypes.TxTraceResult, err error) { ctx, span := tracer.Start(ctx, "TraceBlock", trace.WithAttributes(attribute.Int64("height", height.Int64()), attribute.String("blockHash", common.BytesToHash(block.BlockID.Hash).Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() txs := block.Block.Txs txsLength := len(txs) @@ -255,8 +255,8 @@ func (b *Backend) TraceCall( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "TraceCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() // Marshal tx args bz, err := json.Marshal(&args) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index c7a7a91a4..caad8c1ac 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -35,8 +35,8 @@ import ( // GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByHash", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() res, err := b.GetTxByEthHash(ctx, txHash) if err != nil { @@ -106,8 +106,8 @@ func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) // GetTransactionByHashPending find pending tx from mempool func (b *Backend) GetTransactionByHashPending(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByHashPending", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() hexTx := txHash.Hex() // try to find tx in mempool @@ -150,8 +150,8 @@ func (b *Backend) GetGasUsed(res *servertypes.TxResult, _ *big.Int, _ uint64) ui // GetTransactionReceipt returns the transaction receipt identified by hash. func (b *Backend) GetTransactionReceipt(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetTransactionReceipt", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() hexTx := hash.Hex() b.Logger.Debug("eth_getTransactionReceipt", "hash", hexTx) @@ -230,8 +230,8 @@ func (b *Backend) GetTransactionReceipt(ctx context.Context, hash common.Hash) ( // GetTransactionLogs returns the transaction logs identified by hash. func (b *Backend) GetTransactionLogs(ctx context.Context, hash common.Hash) (result []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetTransactionLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() hexTx := hash.Hex() @@ -272,8 +272,8 @@ func (b *Backend) GetTransactionLogs(ctx context.Context, hash common.Hash) (res // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. func (b *Backend) GetTransactionByBlockHashAndIndex(ctx context.Context, hash common.Hash, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockHashAndIndex", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Int64("idx", int64(idx)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() b.Logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) sc, ok := b.ClientCtx.Client.(cmtrpcclient.SignClient) @@ -298,8 +298,8 @@ func (b *Backend) GetTransactionByBlockHashAndIndex(ctx context.Context, hash co // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. func (b *Backend) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNum rpctypes.BlockNumber, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockNumberAndIndex", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Int64("idx", int64(idx)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() b.Logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) @@ -322,8 +322,8 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(ctx context.Context, block // https://github.com/cometbft/cometbft/issues/6539 func (b *Backend) GetTxByEthHash(ctx context.Context, hash common.Hash) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "GetTxByEthHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() if b.Indexer != nil { return b.Indexer.GetByTxHash(hash) @@ -343,8 +343,8 @@ func (b *Backend) GetTxByEthHash(ctx context.Context, hash common.Hash) (result // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs func (b *Backend) GetTxByTxIndex(ctx context.Context, height int64, index uint) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "GetTxByTxIndex", trace.WithAttributes(attribute.Int64("height", height), attribute.Int64("index", int64(index)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() int32Index := int32(index) //#nosec G115 -- checked for int overflow already if b.Indexer != nil { @@ -368,8 +368,8 @@ func (b *Backend) GetTxByTxIndex(ctx context.Context, height int64, index uint) // QueryCometTxIndexer query tx in CometBFT tx indexer func (b *Backend) QueryCometTxIndexer(ctx context.Context, query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "QueryCometTxIndexer") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() resTxs, err := b.ClientCtx.Client.TxSearch(ctx, query, false, nil, nil, "") if err != nil { @@ -398,8 +398,8 @@ func (b *Backend) QueryCometTxIndexer(ctx context.Context, query string, txGette // GetTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`. func (b *Backend) GetTransactionByBlockAndIndex(ctx context.Context, block *cmtrpctypes.ResultBlock, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockAndIndex", trace.WithAttributes(attribute.Int64("blockHeight", block.Block.Height), attribute.Int64("idx", int64(idx)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() blockRes, err := b.RPCClient.BlockResults(ctx, &block.Block.Height) if err != nil { @@ -463,8 +463,8 @@ func (b *Backend) CreateAccessList( overrides *json.RawMessage, ) (result *rpctypes.AccessListResult, err error) { ctx, span := tracer.Start(ctx, "CreateAccessList", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() accessList, gasUsed, vmErr, err := b.createAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { @@ -492,8 +492,9 @@ func (b *Backend) createAccessList( args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, -) (ethtypes.AccessList, uint64, error, error) { +) (_ ethtypes.AccessList, _ uint64, _ error, sysErr error) { ctx, span := tracer.Start(ctx, "createAccessList") + defer func() { span.RecordError(sysErr) }() defer span.End() args, err := b.SetTxDefaults(ctx, args) if err != nil { @@ -547,8 +548,9 @@ func (b *Backend) createAccessList( // getAccessListExcludes returns the addresses to exclude from the access list. // This includes the sender account, the target account (if provided), precompiles, // and any addresses in the authorization list. -func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber) (map[common.Address]struct{}, error) { +func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber) (_ map[common.Address]struct{}, err error) { ctx, span := tracer.Start(ctx, "getAccessListExcludes") + defer func() { span.RecordError(err) }() defer span.End() header, err := b.HeaderByNumber(ctx, blockNum) if err != nil { diff --git a/rpc/backend/tx_pool.go b/rpc/backend/tx_pool.go index 63e7b54ca..5c3b33e28 100644 --- a/rpc/backend/tx_pool.go +++ b/rpc/backend/tx_pool.go @@ -24,8 +24,8 @@ const ( // Content returns the transactions contained within the transaction pool. func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map[string]*types.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "Content") - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() content := map[string]map[string]map[string]*types.RPCTransaction{ StatusPending: make(map[string]map[string]*types.RPCTransaction), @@ -79,8 +79,8 @@ func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map // ContentFrom returns the transactions contained within the transaction pool func (b *Backend) ContentFrom(ctx context.Context, addr common.Address) (result map[string]map[string]*types.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "ContentFrom", trace.WithAttributes(attribute.String("address", addr.Hex()))) - defer span.End() defer func() { span.RecordError(err) }() + defer span.End() content := make(map[string]map[string]*types.RPCTransaction, 2) diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 80974f0d7..b4644c079 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -50,8 +50,9 @@ func (s sortGasAndReward) Less(i, j int) bool { // If the pending value is true, it will iterate over the mempool (pending) // txs in order to compute and return the pending tx sequence. // Todo: include the ability to specify a blockNumber -func (b *Backend) getAccountNonce(ctx context.Context, accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { +func (b *Backend) getAccountNonce(ctx context.Context, accAddr common.Address, pending bool, height int64, logger log.Logger) (_ uint64, err error) { ctx, span := tracer.Start(ctx, "getAccountNonce") + defer func() { span.RecordError(err) }() defer span.End() queryClient := authtypes.NewQueryClient(b.ClientCtx) adr := sdk.AccAddress(accAddr.Bytes()).String() @@ -140,8 +141,9 @@ func (b *Backend) ProcessBlock( rewardPercentiles []float64, cometBlockResult *cmtrpctypes.ResultBlockResults, targetOneFeeHistory *types.OneFeeHistory, -) error { +) (err error) { ctx, span := tracer.Start(ctx, "ProcessBlock") + defer func() { span.RecordError(err) }() defer span.End() blockHeight := cometBlock.Block.Height blockBaseFee, err := b.BaseFee(ctx, cometBlockResult) diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 79231b6f4..734c003c6 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -82,6 +82,7 @@ func (a *API) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfig) ( func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *rpctypes.TraceConfig) (res []*evmtypes.TxTraceResult, err error) { a.logger.Debug("debug_traceBlockByNumber", "height", height) ctx, span := tracer.Start(context.Background(), "eth_traceBlockByNumber", trace.WithAttributes(attribute.Int64("height", int64(height)))) + defer func() { span.RecordError(err) }() defer span.End() if height == 0 { return nil, errors.New("genesis is not traceable") @@ -119,9 +120,10 @@ func (a *API) TraceBlockByHash(hash common.Hash, config *rpctypes.TraceConfig) ( // TraceBlock returns the structured logs created during the execution of // EVM and returns them as a JSON object. It accepts an RLP-encoded block. -func (a *API) TraceBlock(ctx context.Context, tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { +func (a *API) TraceBlock(ctx context.Context, tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) (_ []*evmtypes.TxTraceResult, err error) { a.logger.Debug("debug_traceBlock", "size", len(tblockRlp)) ctx, span := tracer.Start(ctx, "eth_traceBlock") + defer func() { span.RecordError(err) }() defer span.End() // Decode RLP-encoded block var block types.Block @@ -164,9 +166,10 @@ func (a *API) TraceCall(ctx context.Context, args evmtypes.TransactionArgs, bloc } // GetRawBlock retrieves the RLP-encoded block by block number or hash. -func (a *API) GetRawBlock(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { +func (a *API) GetRawBlock(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { a.logger.Debug("debug_getRawBlock", "block number or hash", blockNrOrHash) ctx, span := tracer.Start(ctx, "eth_getRawBlock") + defer func() { span.RecordError(err) }() defer span.End() // Get block number from blockNrOrHash blockNum, err := a.backend.BlockNumberFromComet(ctx, blockNrOrHash) @@ -423,8 +426,9 @@ func (a *API) SetGCPercent(v int) (int, error) { } // GetHeaderRlp retrieves the RLP encoded for of a single header. -func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { +func (a *API) GetHeaderRlp(number uint64) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderRlp") + defer func() { span.RecordError(err) }() defer span.End() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled @@ -438,8 +442,9 @@ func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { } // GetBlockRlp retrieves the RLP encoded for of a single block. -func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { +func (a *API) GetBlockRlp(number uint64) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockRlp") + defer func() { span.RecordError(err) }() defer span.End() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled @@ -453,8 +458,9 @@ func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { } // PrintBlock retrieves a block and returns its pretty printed form. -func (a *API) PrintBlock(number uint64) (string, error) { +func (a *API) PrintBlock(number uint64) (_ string, err error) { ctx, span := tracer.Start(context.Background(), "eth_printBlock") + defer func() { span.RecordError(err) }() defer span.End() if !a.profilingEnabled { return "", rpctypes.ErrProfilingDisabled diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 581b70a13..427930d2c 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -52,7 +52,7 @@ type Backend interface { GetLogsByHeight(ctx context.Context, height *int64) ([][]*ethtypes.Log, error) BlockBloomFromCometBlock(ctx context.Context, blockRes *coretypes.ResultBlockResults) (ethtypes.Bloom, error) - BloomStatus(ctx context.Context) (uint64, uint64) + BloomStatus() (uint64, uint64) RPCFilterCap() int32 RPCLogsCap() int32 diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 311904541..562f95e37 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -148,7 +148,7 @@ func (api *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecove func (api *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { api.logger.Debug("personal_ecRecover", "data", data, "sig", sig) - ctx, span := tracer.Start(ctx, "EcRecover") + _, span := tracer.Start(ctx, "EcRecover") defer span.End() if len(sig) != crypto.SignatureLength { diff --git a/rpc/types/utils.go b/rpc/types/utils.go index d59053bc3..c8cd3b116 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -101,8 +101,9 @@ func EthHeaderFromComet(header cmttypes.Header, bloom ethtypes.Bloom, baseFee *b var tracer = otel.Tracer("evm/rpc/types") // BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params. -func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (int64, error) { +func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (_ int64, err error) { goCtx, span := tracer.Start(goCtx, "BlockMaxGasFromConsensusParams") + defer func() { span.RecordError(err) }() defer span.End() cmtrpcclient, ok := clientCtx.Client.(cmtrpcclient.Client) diff --git a/tests/integration/rpc/backend/test_filters.go b/tests/integration/rpc/backend/test_filters.go index 37c2303b0..b1a6ef4a7 100644 --- a/tests/integration/rpc/backend/test_filters.go +++ b/tests/integration/rpc/backend/test_filters.go @@ -110,7 +110,7 @@ func (s *TestSuite) TestBloomStatus() { s.SetupTest() tc.registerMock() - bloom, _ := s.backend.BloomStatus(s.Ctx()) + bloom, _ := s.backend.BloomStatus() if tc.expPass { s.Require().Equal(tc.expResult, bloom) From d8519e5f66d9cdecb3ea573e9c18cd5bd51f1ffb Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:06:50 -0800 Subject: [PATCH 06/14] put tracer in backend.go --- rpc/backend/backend.go | 12 ++++++++---- rpc/backend/tracer.go | 5 ----- 2 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 rpc/backend/tracer.go diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index f06d12705..2769a57b9 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -7,6 +7,8 @@ import ( "math/big" "time" + tmrpcclient "github.com/cometbft/cometbft/rpc/client" + tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" @@ -14,9 +16,7 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/signer/core/apitypes" - - tmrpcclient "github.com/cometbft/cometbft/rpc/client" - tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" + "go.opentelemetry.io/otel" evmmempool "github.com/cosmos/evm/mempool" "github.com/cosmos/evm/rpc/types" @@ -137,7 +137,11 @@ type EVMBackend interface { TraceCall(ctx context.Context, args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, config *types.TraceConfig) (interface{}, error) } -var _ BackendI = (*Backend)(nil) +var ( + _ BackendI = (*Backend)(nil) + + tracer = otel.Tracer("evm/rpc/backend") +) // ProcessBlocker is a function type that processes a block and its associated data // for fee history calculation. It takes a Tendermint block, its corresponding diff --git a/rpc/backend/tracer.go b/rpc/backend/tracer.go deleted file mode 100644 index 9555ca47a..000000000 --- a/rpc/backend/tracer.go +++ /dev/null @@ -1,5 +0,0 @@ -package backend - -import "go.opentelemetry.io/otel" - -var tracer = otel.Tracer("evm/rpc/backend") From 2910961f1c40399342fb4c93069dde38f8679972 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:56:01 -0800 Subject: [PATCH 07/14] dont actually need to side effect import telemetry --- evmd/app.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/evmd/app.go b/evmd/app.go index cf2604c29..a4bfe0be1 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -128,10 +128,6 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" cosmosevmserver "github.com/cosmos/evm/server" - - // import telemetry for side effects. - // telemetry package contains an init that instantiates the otel sdk. - _ "github.com/cosmos/cosmos-sdk/telemetry" ) func init() { @@ -413,7 +409,7 @@ func NewExampleApp( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) From f3b88ba96ce33c57ea1f27afbac34430b5521d8c Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 2 Dec 2025 15:21:09 -0800 Subject: [PATCH 08/14] tidy --- evmd/go.mod | 2 +- evmd/go.sum | 4 ++-- go.mod | 4 +--- go.sum | 12 ++---------- tests/speedtest/go.mod | 2 +- tests/speedtest/go.sum | 4 ++-- tests/systemtests/go.mod | 2 +- tests/systemtests/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/evmd/go.mod b/evmd/go.mod index bb64a96f5..342d7b03b 100644 --- a/evmd/go.mod +++ b/evmd/go.mod @@ -220,7 +220,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/common v0.67.4 // indirect github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect diff --git a/evmd/go.sum b/evmd/go.sum index 45727e252..65394555b 100644 --- a/evmd/go.sum +++ b/evmd/go.sum @@ -877,8 +877,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= -github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= +github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= diff --git a/go.mod b/go.mod index e5106d496..863cd3e37 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,6 @@ require ( github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 github.com/zondax/hid v0.9.2 - go.opencensus.io v0.24.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 go.opentelemetry.io/otel v1.38.0 go.opentelemetry.io/otel/trace v1.38.0 @@ -164,7 +163,6 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/snappy v1.0.0 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v25.2.10+incompatible // indirect @@ -230,7 +228,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/common v0.67.4 // indirect github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect diff --git a/go.sum b/go.sum index de90e9c77..72a5c1dbd 100644 --- a/go.sum +++ b/go.sum @@ -454,9 +454,6 @@ github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 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-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= @@ -493,7 +490,6 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -862,8 +858,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= -github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= +github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1018,8 +1014,6 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY6LiIY9I8cUfm+pJs= @@ -1169,7 +1163,6 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1357,7 +1350,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= diff --git a/tests/speedtest/go.mod b/tests/speedtest/go.mod index 2f17df45b..7e5db1ee3 100644 --- a/tests/speedtest/go.mod +++ b/tests/speedtest/go.mod @@ -209,7 +209,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/common v0.67.4 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect diff --git a/tests/speedtest/go.sum b/tests/speedtest/go.sum index 68367c563..3811715f5 100644 --- a/tests/speedtest/go.sum +++ b/tests/speedtest/go.sum @@ -847,8 +847,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= -github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= +github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= 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= diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index a9de44dac..2ed37c951 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -145,7 +145,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/common v0.67.4 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 16e74a81c..dd2c0c622 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -775,8 +775,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b 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.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= -github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= +github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= 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= From ced7b3765d5b65559f36753c5d14cfd5f0824c8b Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:41:34 -0800 Subject: [PATCH 09/14] add span EndSpanErr helper function --- rpc/backend/account_info.go | 16 +-- rpc/backend/blocks.go | 16 +-- rpc/backend/call_tx.go | 19 +-- rpc/backend/chain_info.go | 25 ++-- rpc/backend/comet.go | 16 +-- rpc/backend/comet_to_eth.go | 25 ++-- rpc/backend/filters.go | 8 +- rpc/backend/headers.go | 13 +- rpc/backend/node_info.go | 4 +- rpc/backend/sign_tx.go | 4 +- rpc/backend/tracing.go | 10 +- rpc/backend/tx_info.go | 40 ++---- rpc/backend/tx_pool.go | 7 +- rpc/backend/utils.go | 7 +- rpc/namespaces/ethereum/debug/api.go | 19 +-- rpc/namespaces/ethereum/eth/api.go | 122 +++++++++--------- rpc/namespaces/ethereum/eth/filters/api.go | 9 +- .../ethereum/eth/filters/filters.go | 3 +- rpc/namespaces/ethereum/personal/api.go | 9 +- rpc/namespaces/ethereum/txpool/api.go | 17 +-- rpc/types/utils.go | 4 +- trace/span.go | 14 ++ 22 files changed, 186 insertions(+), 221 deletions(-) create mode 100644 trace/span.go diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 59df107f3..8bf4c072c 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -15,6 +15,7 @@ import ( "github.com/cometbft/cometbft/libs/bytes" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -28,8 +29,7 @@ import ( // GetCode returns the contract code at the given address and block number. func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (bz hexutil.Bytes, err error) { ctx, span := tracer.Start(ctx, "GetCode", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -52,8 +52,7 @@ func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOr // GetProof returns an account object with proof and any storage proofs func (b *Backend) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (result *rpctypes.AccountResult, err error) { ctx, span := tracer.Start(ctx, "GetProof", trace.WithAttributes(attribute.String("address", address.String()), attribute.StringSlice("storageKeys", storageKeys), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -138,8 +137,7 @@ func (b *Backend) GetProof(ctx context.Context, address common.Address, storageK // GetStorageAt returns the contract storage at the given address, block number, and key. func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (result hexutil.Bytes, err error) { ctx, span := tracer.Start(ctx, "GetStorageAt", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("key", key), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -164,8 +162,7 @@ func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key // GetBalance returns the provided account's *spendable* balance up to the provided block number. func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "GetBalance", trace.WithAttributes(attribute.String("address", address.String()), attribute.String("blockNorHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -203,8 +200,7 @@ func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockN // GetTransactionCount returns the number of transactions at the given address up to the given block number. func (b *Backend) GetTransactionCount(ctx context.Context, address common.Address, blockNum rpctypes.BlockNumber) (result *hexutil.Uint64, err error) { ctx, span := tracer.Start(ctx, "GetTransactionCount", trace.WithAttributes(attribute.String("address", address.String()), attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() n := hexutil.Uint64(0) bn, err := b.BlockNumber(ctx) diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index 381247f8e..91de7d1b6 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -16,6 +16,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" @@ -27,8 +28,7 @@ import ( // rpc. func (b *Backend) BlockNumber(ctx context.Context) (result hexutil.Uint64, err error) { ctx, span := tracer.Start(ctx, "GetBlockNumber") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // do any grpc query, ignore the response and use the returned block height var header metadata.MD @@ -55,8 +55,7 @@ func (b *Backend) BlockNumber(ctx context.Context) (result hexutil.Uint64, err e // objects or if false only the hashes of the transactions. func (b *Backend) GetBlockByNumber(ctx context.Context, blockNum types.BlockNumber, fullTx bool) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Bool("fullTx", fullTx))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -87,8 +86,7 @@ func (b *Backend) GetBlockByNumber(ctx context.Context, blockNum types.BlockNumb // hash. func (b *Backend) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Bool("fullTx", fullTx))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -171,8 +169,7 @@ func (b *Backend) getBlockTransactionCount(ctx context.Context, block *cmtrpctyp // EthBlockByNumber returns the Ethereum Block identified by number. func (b *Backend) EthBlockByNumber(ctx context.Context, blockNum types.BlockNumber) (result *ethtypes.Block, err error) { ctx, span := tracer.Start(ctx, "EthBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -203,8 +200,7 @@ func (b *Backend) GetBlockReceipts( blockNrOrHash types.BlockNumberOrHash, ) (result []map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetBlockReceipts", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNum, err := b.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index c2b7a7eca..55d20e929 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/evm/mempool" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -32,8 +33,7 @@ import ( // the given transaction from the pool and reinsert it with the new gas price and limit. func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (result common.Hash, err error) { ctx, span := tracer.Start(ctx, "Resend", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if args.Nonce == nil { return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec") @@ -108,8 +108,7 @@ func (b *Backend) Resend(ctx context.Context, args evmtypes.TransactionArgs, gas // SendRawTransaction send a raw Ethereum transaction. func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (result common.Hash, err error) { ctx, span := tracer.Start(ctx, "SendRawTransaction") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // RLP decode raw transaction bytes tx := ðtypes.Transaction{} @@ -202,8 +201,7 @@ func (b *Backend) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (r // provided on the args func (b *Backend) SetTxDefaults(ctx context.Context, args evmtypes.TransactionArgs) (result evmtypes.TransactionArgs, err error) { ctx, span := tracer.Start(ctx, "SetTxDefaults") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { return args, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") @@ -343,8 +341,7 @@ func (b *Backend) EstimateGas( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "EstimateGas", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockNr := rpctypes.EthPendingBlockNumber if blockNrOrHash != nil { @@ -406,8 +403,7 @@ func (b *Backend) DoCall( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "DoCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.Int64("blockNr", blockNr.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() bz, err := json.Marshal(&args) if err != nil { @@ -466,8 +462,7 @@ func (b *Backend) DoCall( // GasPrice returns the current gas price based on Cosmos EVM' gas price oracle. func (b *Backend) GasPrice(ctx context.Context) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "GasPrice") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() head, err := b.CurrentHeader(ctx) if err != nil { diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index bd38bb1a9..0b4eb26f1 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -20,6 +20,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -32,8 +33,7 @@ import ( // ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config. func (b *Backend) ChainID(ctx context.Context) (result *hexutil.Big, err error) { ctx, span := tracer.Start(ctx, "ChainID") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // if current block is at or past the EIP-155 replay-protection fork block, return EvmChainID from config bn, err := b.BlockNumber(ctx) @@ -57,8 +57,7 @@ func (b *Backend) ChainConfig() *params.ChainConfig { // GlobalMinGasPrice returns MinGasPrice param from FeeMarket func (b *Backend) GlobalMinGasPrice(ctx context.Context) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "GlobalMinGasPrice") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() res, err := b.QueryClient.GlobalMinGasPrice(ctx, &evmtypes.QueryGlobalMinGasPriceRequest{}) if err != nil { @@ -76,8 +75,7 @@ func (b *Backend) GlobalMinGasPrice(ctx context.Context) (result *big.Int, err e // return nil. func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "BaseFee", trace.WithAttributes(attribute.Int64("height", blockRes.Height))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // return BaseFee if London hard fork is activated and feemarket is enabled ctx = rpctypes.ContextWithHeight(blockRes.Height, ctx) @@ -111,8 +109,7 @@ func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlock // if the ABCI responses are discarded ('discard_abci_responses' config param) func (b *Backend) CurrentHeader(ctx context.Context) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "CurrentHeader") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() return b.HeaderByNumber(ctx, rpctypes.EthLatestBlockNumber) } @@ -121,8 +118,7 @@ func (b *Backend) CurrentHeader(ctx context.Context) (result *ethtypes.Header, e // and have a from address that is one of the accounts this node manages. func (b *Backend) PendingTransactions(ctx context.Context) (result []*sdk.Tx, err error) { ctx, span := tracer.Start(ctx, "PendingTransactions") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() mc, ok := b.ClientCtx.Client.(cmtrpcclient.MempoolClient) if !ok { @@ -149,8 +145,7 @@ func (b *Backend) PendingTransactions(ctx context.Context) (result []*sdk.Tx, er // GetCoinbase is the address that staking rewards will be send to (alias for Etherbase). func (b *Backend) GetCoinbase(ctx context.Context) (result sdk.AccAddress, err error) { ctx, span := tracer.Start(ctx, "GetCoinbase") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() node, err := b.ClientCtx.GetNode() if err != nil { @@ -188,8 +183,7 @@ func (b *Backend) FeeHistory( rewardPercentiles []float64, // percentiles to fetch reward ) (_ *rpctypes.FeeHistoryResult, err error) { ctx, span := tracer.Start(ctx, "FeeHistory", trace.WithAttributes(attribute.Int64("blockCount", int64(userBlockCount)), attribute.Int64("lastBlock", int64(lastBlock)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() for i, p := range rewardPercentiles { if p < 0 || p > 100 { return nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) @@ -354,8 +348,7 @@ func (b *Backend) FeeHistory( // mitigate the base fee changes. func (b *Backend) SuggestGasTipCap(ctx context.Context, baseFee *big.Int) (_ *big.Int, err error) { ctx, span := tracer.Start(ctx, "SuggestGasTipCap") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if baseFee == nil { // london hardfork not enabled or feemarket not enabled return big.NewInt(0), nil diff --git a/rpc/backend/comet.go b/rpc/backend/comet.go index 4fe7b12b3..89c4f6309 100644 --- a/rpc/backend/comet.go +++ b/rpc/backend/comet.go @@ -12,6 +12,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" "github.com/cosmos/evm/utils" ) @@ -19,8 +20,7 @@ import ( // block number func (b *Backend) CometBlockByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultBlock, err error) { ctx, span := tracer.Start(ctx, "CometBlockByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { @@ -44,8 +44,7 @@ func (b *Backend) CometBlockByNumber(ctx context.Context, blockNum rpctypes.Bloc // block number func (b *Backend) CometHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *cmtrpctypes.ResultHeader, err error) { ctx, span := tracer.Start(ctx, "CometHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() height, err := b.getHeightByBlockNum(ctx, blockNum) if err != nil { @@ -62,8 +61,7 @@ func (b *Backend) CometBlockResultByNumber(ctx context.Context, height *int64) ( heightAttr = *height } ctx, span := tracer.Start(ctx, "CometBlockResultByNumber", trace.WithAttributes(attribute.Int64("height", heightAttr))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if height != nil && *height == 0 { height = nil @@ -79,8 +77,7 @@ func (b *Backend) CometBlockResultByNumber(ctx context.Context, height *int64) ( // CometBlockByHash returns a CometBFT-formatted block by block number func (b *Backend) CometBlockByHash(ctx context.Context, blockHash common.Hash) (result *cmtrpctypes.ResultBlock, err error) { ctx, span := tracer.Start(ctx, "CometBlockByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.RPCClient.BlockByHash(ctx, blockHash.Bytes()) if err != nil { @@ -98,8 +95,7 @@ func (b *Backend) CometBlockByHash(ctx context.Context, blockHash common.Hash) ( func (b *Backend) getHeightByBlockNum(ctx context.Context, blockNum rpctypes.BlockNumber) (height int64, err error) { ctx, span := tracer.Start(ctx, "getHeightByBlockNum", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if blockNum == rpctypes.EthEarliestBlockNumber { status, err := b.ClientCtx.Client.Status(ctx) diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index e47a668c1..f035e7346 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -17,6 +17,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -30,8 +31,7 @@ func (b *Backend) RPCHeaderFromCometBlock( blockRes *cmtrpctypes.ResultBlockResults, ) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "RPCHeaderFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) if err != nil { @@ -50,8 +50,7 @@ func (b *Backend) RPCBlockFromCometBlock( fullTx bool, ) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "RPCBlockFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() msgs := b.EthMsgsFromCometBlock(ctx, resBlock, blockRes) ethBlock, err := b.EthBlockFromCometBlock(ctx, resBlock, blockRes) @@ -65,8 +64,7 @@ func (b *Backend) RPCBlockFromCometBlock( // BlockNumberFromComet returns the BlockNumber from BlockNumberOrHash func (b *Backend) BlockNumberFromComet(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (result rpctypes.BlockNumber, err error) { ctx, span := tracer.Start(ctx, "BlockNumberFromComet", trace.WithAttributes(attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() switch { case blockNrOrHash.BlockHash == nil && blockNrOrHash.BlockNumber == nil: @@ -87,8 +85,7 @@ func (b *Backend) BlockNumberFromComet(ctx context.Context, blockNrOrHash rpctyp // BlockNumberFromCometByHash returns the block height of given block hash func (b *Backend) BlockNumberFromCometByHash(ctx context.Context, blockHash common.Hash) (result *big.Int, err error) { ctx, span := tracer.Start(ctx, "BlockNumberFromCometByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resHeader, err := b.RPCClient.HeaderByHash(ctx, blockHash.Bytes()) if err != nil { @@ -154,8 +151,7 @@ func (b *Backend) EthBlockFromCometBlock( blockRes *cmtrpctypes.ResultBlockResults, ) (result *ethtypes.Block, err error) { ctx, span := tracer.Start(ctx, "EthBlockFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() cmtBlock := resBlock.Block @@ -224,8 +220,7 @@ func (b *Backend) MinerFromCometBlock( resBlock *cmtrpctypes.ResultBlock, ) (result common.Address, err error) { ctx, span := tracer.Start(ctx, "MinerFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() cmtBlock := resBlock.Block @@ -263,8 +258,7 @@ func (b *Backend) ReceiptsFromCometBlock( msgs []*evmtypes.MsgEthereumTx, ) (result []*ethtypes.Receipt, err error) { ctx, span := tracer.Start(ctx, "ReceiptsFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() baseFee, err := b.BaseFee(ctx, blockRes) if err != nil { @@ -347,8 +341,7 @@ func (b *Backend) ReceiptsFromCometBlock( // BlockBloom query block bloom filter from block results func (b *Backend) BlockBloomFromCometBlock(ctx context.Context, blockRes *cmtrpctypes.ResultBlockResults) (result ethtypes.Bloom, err error) { ctx, span := tracer.Start(ctx, "BlockBloomFromCometBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() for _, event := range blockRes.FinalizeBlockEvents { if event.Type != evmtypes.EventTypeBlockBloom { diff --git a/rpc/backend/filters.go b/rpc/backend/filters.go index eb8284102..7e079da19 100644 --- a/rpc/backend/filters.go +++ b/rpc/backend/filters.go @@ -8,13 +8,14 @@ import ( "github.com/pkg/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" + + evmtrace "github.com/cosmos/evm/trace" ) // GetLogs returns all the logs from all the ethereum transactions in a block. func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) (result [][]*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -33,8 +34,7 @@ func (b *Backend) GetLogsByHeight(ctx context.Context, height *int64) (result [] heightAttr = *height } ctx, span := tracer.Start(ctx, "GetLogsByHeight", trace.WithAttributes(attribute.Int64("height", heightAttr))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // NOTE: we query the state in case the tx result logs are not persisted after an upgrade. blockRes, err := b.RPCClient.BlockResults(ctx, height) diff --git a/rpc/backend/headers.go b/rpc/backend/headers.go index d21b3fd92..ab9841bc1 100644 --- a/rpc/backend/headers.go +++ b/rpc/backend/headers.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/otel/trace" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" ) // GetBlockByNumber returns the JSON-RPC compatible Ethereum block identified by @@ -17,8 +18,7 @@ import ( // objects or if false only the hashes of the transactions. func (b *Backend) GetHeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetHeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -49,8 +49,7 @@ func (b *Backend) GetHeaderByNumber(ctx context.Context, blockNum rpctypes.Block // hash. func (b *Backend) GetHeaderByHash(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetHeaderByHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByHash(ctx, hash) if err != nil { @@ -80,8 +79,7 @@ func (b *Backend) GetHeaderByHash(ctx context.Context, hash common.Hash) (result // HeaderByNumber returns the block header identified by height. func (b *Backend) HeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNumber) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "HeaderByNumber", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByNumber(ctx, blockNum) if err != nil { @@ -109,8 +107,7 @@ func (b *Backend) HeaderByNumber(ctx context.Context, blockNum rpctypes.BlockNum // HeaderByHash returns the block header identified by hash. func (b *Backend) HeaderByHash(ctx context.Context, blockHash common.Hash) (result *ethtypes.Header, err error) { ctx, span := tracer.Start(ctx, "HeaderByHash", trace.WithAttributes(attribute.String("blockHash", blockHash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resBlock, err := b.CometBlockByHash(ctx, blockHash) if err != nil { diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 29bffd29c..bb6005b2f 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -16,6 +16,7 @@ import ( rpctypes "github.com/cosmos/evm/rpc/types" "github.com/cosmos/evm/server/config" "github.com/cosmos/evm/testutil/constants" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -66,8 +67,7 @@ func (b *Backend) Accounts() ([]common.Address, error) { // - knownStates: number of known state entries that still need to be pulled func (b *Backend) Syncing(ctx context.Context) (result interface{}, err error) { ctx, span := tracer.Start(ctx, "Syncing") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() status, err := b.ClientCtx.Client.Status(ctx) if err != nil { diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 937dff51c..3a44b1c09 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/mempool" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -33,8 +34,7 @@ func (b *Backend) SendTransaction(ctx context.Context, args evmtypes.Transaction toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "SendTransaction", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // Look up the wallet containing the requested signer if !b.Cfg.JSONRPC.AllowInsecureUnlock { diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index 5ca3b5139..1053100a9 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -16,6 +16,7 @@ import ( tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -25,8 +26,7 @@ import ( // and returns them as a JSON object. func (b *Backend) TraceTransaction(ctx context.Context, hash common.Hash, config *rpctypes.TraceConfig) (result interface{}, err error) { ctx, span := tracer.Start(ctx, "TraceTransaction", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // Get transaction by hash transaction, err := b.GetTxByEthHash(ctx, hash) @@ -160,8 +160,7 @@ func (b *Backend) TraceBlock(ctx context.Context, height rpctypes.BlockNumber, block *tmrpctypes.ResultBlock, ) (result []*evmtypes.TxTraceResult, err error) { ctx, span := tracer.Start(ctx, "TraceBlock", trace.WithAttributes(attribute.Int64("height", height.Int64()), attribute.String("blockHash", common.BytesToHash(block.BlockID.Hash).Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() txs := block.Block.Txs txsLength := len(txs) @@ -255,8 +254,7 @@ func (b *Backend) TraceCall( toAddr = args.To.Hex() } ctx, span := tracer.Start(ctx, "TraceCall", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("to", toAddr), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // Marshal tx args bz, err := json.Marshal(&args) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index caad8c1ac..c8d019865 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/evm/mempool/txpool" rpctypes "github.com/cosmos/evm/rpc/types" servertypes "github.com/cosmos/evm/server/types" + evmtrace "github.com/cosmos/evm/trace" "github.com/cosmos/evm/utils" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -35,8 +36,7 @@ import ( // GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByHash", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() res, err := b.GetTxByEthHash(ctx, txHash) if err != nil { @@ -106,8 +106,7 @@ func (b *Backend) GetTransactionByHash(ctx context.Context, txHash common.Hash) // GetTransactionByHashPending find pending tx from mempool func (b *Backend) GetTransactionByHashPending(ctx context.Context, txHash common.Hash) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByHashPending", trace.WithAttributes(attribute.String("txHash", txHash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() hexTx := txHash.Hex() // try to find tx in mempool @@ -150,8 +149,7 @@ func (b *Backend) GetGasUsed(res *servertypes.TxResult, _ *big.Int, _ uint64) ui // GetTransactionReceipt returns the transaction receipt identified by hash. func (b *Backend) GetTransactionReceipt(ctx context.Context, hash common.Hash) (result map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "GetTransactionReceipt", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() hexTx := hash.Hex() b.Logger.Debug("eth_getTransactionReceipt", "hash", hexTx) @@ -230,8 +228,7 @@ func (b *Backend) GetTransactionReceipt(ctx context.Context, hash common.Hash) ( // GetTransactionLogs returns the transaction logs identified by hash. func (b *Backend) GetTransactionLogs(ctx context.Context, hash common.Hash) (result []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetTransactionLogs", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() hexTx := hash.Hex() @@ -272,8 +269,7 @@ func (b *Backend) GetTransactionLogs(ctx context.Context, hash common.Hash) (res // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. func (b *Backend) GetTransactionByBlockHashAndIndex(ctx context.Context, hash common.Hash, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockHashAndIndex", trace.WithAttributes(attribute.String("hash", hash.Hex()), attribute.Int64("idx", int64(idx)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() b.Logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) sc, ok := b.ClientCtx.Client.(cmtrpcclient.SignClient) @@ -298,8 +294,7 @@ func (b *Backend) GetTransactionByBlockHashAndIndex(ctx context.Context, hash co // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. func (b *Backend) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNum rpctypes.BlockNumber, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockNumberAndIndex", trace.WithAttributes(attribute.Int64("blockNum", blockNum.Int64()), attribute.Int64("idx", int64(idx)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() b.Logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) @@ -322,8 +317,7 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(ctx context.Context, block // https://github.com/cometbft/cometbft/issues/6539 func (b *Backend) GetTxByEthHash(ctx context.Context, hash common.Hash) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "GetTxByEthHash", trace.WithAttributes(attribute.String("hash", hash.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if b.Indexer != nil { return b.Indexer.GetByTxHash(hash) @@ -343,8 +337,7 @@ func (b *Backend) GetTxByEthHash(ctx context.Context, hash common.Hash) (result // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs func (b *Backend) GetTxByTxIndex(ctx context.Context, height int64, index uint) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "GetTxByTxIndex", trace.WithAttributes(attribute.Int64("height", height), attribute.Int64("index", int64(index)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() int32Index := int32(index) //#nosec G115 -- checked for int overflow already if b.Indexer != nil { @@ -368,8 +361,7 @@ func (b *Backend) GetTxByTxIndex(ctx context.Context, height int64, index uint) // QueryCometTxIndexer query tx in CometBFT tx indexer func (b *Backend) QueryCometTxIndexer(ctx context.Context, query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (result *servertypes.TxResult, err error) { ctx, span := tracer.Start(ctx, "QueryCometTxIndexer") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() resTxs, err := b.ClientCtx.Client.TxSearch(ctx, query, false, nil, nil, "") if err != nil { @@ -398,8 +390,7 @@ func (b *Backend) QueryCometTxIndexer(ctx context.Context, query string, txGette // GetTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`. func (b *Backend) GetTransactionByBlockAndIndex(ctx context.Context, block *cmtrpctypes.ResultBlock, idx hexutil.Uint) (result *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "GetTransactionByBlockAndIndex", trace.WithAttributes(attribute.Int64("blockHeight", block.Block.Height), attribute.Int64("idx", int64(idx)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockRes, err := b.RPCClient.BlockResults(ctx, &block.Block.Height) if err != nil { @@ -463,8 +454,7 @@ func (b *Backend) CreateAccessList( overrides *json.RawMessage, ) (result *rpctypes.AccessListResult, err error) { ctx, span := tracer.Start(ctx, "CreateAccessList", trace.WithAttributes(attribute.String("from", args.GetFrom().Hex()), attribute.String("blockNrOrHash", unwrapBlockNOrHash(blockNrOrHash)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() accessList, gasUsed, vmErr, err := b.createAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { @@ -494,8 +484,7 @@ func (b *Backend) createAccessList( overrides *json.RawMessage, ) (_ ethtypes.AccessList, _ uint64, _ error, sysErr error) { ctx, span := tracer.Start(ctx, "createAccessList") - defer func() { span.RecordError(sysErr) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, sysErr) }() args, err := b.SetTxDefaults(ctx, args) if err != nil { b.Logger.Error("failed to set tx defaults", "error", err) @@ -550,8 +539,7 @@ func (b *Backend) createAccessList( // and any addresses in the authorization list. func (b *Backend) getAccessListExcludes(ctx context.Context, args evmtypes.TransactionArgs, blockNum rpctypes.BlockNumber) (_ map[common.Address]struct{}, err error) { ctx, span := tracer.Start(ctx, "getAccessListExcludes") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() header, err := b.HeaderByNumber(ctx, blockNum) if err != nil { b.Logger.Error("failed to get header by number", "error", err) diff --git a/rpc/backend/tx_pool.go b/rpc/backend/tx_pool.go index 5c3b33e28..b76ad1e12 100644 --- a/rpc/backend/tx_pool.go +++ b/rpc/backend/tx_pool.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/otel/trace" "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" ) const ( @@ -24,8 +25,7 @@ const ( // Content returns the transactions contained within the transaction pool. func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map[string]*types.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "Content") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() content := map[string]map[string]map[string]*types.RPCTransaction{ StatusPending: make(map[string]map[string]*types.RPCTransaction), @@ -79,8 +79,7 @@ func (b *Backend) Content(ctx context.Context) (result map[string]map[string]map // ContentFrom returns the transactions contained within the transaction pool func (b *Backend) ContentFrom(ctx context.Context, addr common.Address) (result map[string]map[string]*types.RPCTransaction, err error) { ctx, span := tracer.Start(ctx, "ContentFrom", trace.WithAttributes(attribute.String("address", addr.Hex()))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() content := make(map[string]map[string]*types.RPCTransaction, 2) diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index b4644c079..f12301005 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -20,6 +20,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" "github.com/cosmos/evm/utils" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -52,8 +53,7 @@ func (s sortGasAndReward) Less(i, j int) bool { // Todo: include the ability to specify a blockNumber func (b *Backend) getAccountNonce(ctx context.Context, accAddr common.Address, pending bool, height int64, logger log.Logger) (_ uint64, err error) { ctx, span := tracer.Start(ctx, "getAccountNonce") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() queryClient := authtypes.NewQueryClient(b.ClientCtx) adr := sdk.AccAddress(accAddr.Bytes()).String() ctx = types.ContextWithHeight(height, ctx) @@ -143,8 +143,7 @@ func (b *Backend) ProcessBlock( targetOneFeeHistory *types.OneFeeHistory, ) (err error) { ctx, span := tracer.Start(ctx, "ProcessBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() blockHeight := cometBlock.Block.Height blockBaseFee, err := b.BaseFee(ctx, cometBlockResult) if err != nil || blockBaseFee == nil { diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 734c003c6..c244c40ae 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -26,6 +26,7 @@ import ( "github.com/cosmos/evm/rpc/backend" rpctypes "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -82,8 +83,7 @@ func (a *API) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfig) ( func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *rpctypes.TraceConfig) (res []*evmtypes.TxTraceResult, err error) { a.logger.Debug("debug_traceBlockByNumber", "height", height) ctx, span := tracer.Start(context.Background(), "eth_traceBlockByNumber", trace.WithAttributes(attribute.Int64("height", int64(height)))) - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if height == 0 { return nil, errors.New("genesis is not traceable") } @@ -123,8 +123,7 @@ func (a *API) TraceBlockByHash(hash common.Hash, config *rpctypes.TraceConfig) ( func (a *API) TraceBlock(ctx context.Context, tblockRlp hexutil.Bytes, config *rpctypes.TraceConfig) (_ []*evmtypes.TxTraceResult, err error) { a.logger.Debug("debug_traceBlock", "size", len(tblockRlp)) ctx, span := tracer.Start(ctx, "eth_traceBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // Decode RLP-encoded block var block types.Block if err := rlp.DecodeBytes(tblockRlp, &block); err != nil { @@ -169,8 +168,7 @@ func (a *API) TraceCall(ctx context.Context, args evmtypes.TransactionArgs, bloc func (a *API) GetRawBlock(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { a.logger.Debug("debug_getRawBlock", "block number or hash", blockNrOrHash) ctx, span := tracer.Start(ctx, "eth_getRawBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() // Get block number from blockNrOrHash blockNum, err := a.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -428,8 +426,7 @@ func (a *API) SetGCPercent(v int) (int, error) { // GetHeaderRlp retrieves the RLP encoded for of a single header. func (a *API) GetHeaderRlp(number uint64) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderRlp") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled } @@ -444,8 +441,7 @@ func (a *API) GetHeaderRlp(number uint64) (_ hexutil.Bytes, err error) { // GetBlockRlp retrieves the RLP encoded for of a single block. func (a *API) GetBlockRlp(number uint64) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockRlp") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if !a.profilingEnabled { return nil, rpctypes.ErrProfilingDisabled } @@ -460,8 +456,7 @@ func (a *API) GetBlockRlp(number uint64) (_ hexutil.Bytes, err error) { // PrintBlock retrieves a block and returns its pretty printed form. func (a *API) PrintBlock(number uint64) (_ string, err error) { ctx, span := tracer.Start(context.Background(), "eth_printBlock") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() if !a.profilingEnabled { return "", rpctypes.ErrProfilingDisabled } diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 6e72f6f8b..2841374ab 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/evm/rpc/backend" rpctypes "github.com/cosmos/evm/rpc/types" + "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -135,17 +136,17 @@ func NewPublicAPI(logger log.Logger, backend backend.EVMBackend) *PublicAPI { // - When blockNr is -2 the chain latest header is returned. // - When blockNr is -3 the chain finalized header is returned. // - When blockNr is -4 the chain safe header is returned. -func (e *PublicAPI) GetHeaderByNumber(ethBlockNum rpctypes.BlockNumber) (map[string]interface{}, error) { +func (e *PublicAPI) GetHeaderByNumber(ethBlockNum rpctypes.BlockNumber) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderByNumber") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getHeaderByNumber", "number", ethBlockNum) return e.backend.GetHeaderByNumber(ctx, ethBlockNum) } // GetHeaderByHash returns the requested header by hash. -func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (map[string]interface{}, error) { +func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderByHash") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getHeaderByHash", "hash", hash.Hex()) return e.backend.GetHeaderByHash(ctx, hash) } @@ -155,33 +156,33 @@ func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (map[string]interface{}, e //////////////////////////////////////////////////////////////////////////////////////// // BlockNumber returns the current block number. -func (e *PublicAPI) BlockNumber() (hexutil.Uint64, error) { +func (e *PublicAPI) BlockNumber() (_ hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_blockNumber") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_blockNumber") return e.backend.BlockNumber(ctx) } // GetBlockByNumber returns the block identified by number. -func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error) { +func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bool) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockByNumber") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockByNumber", "number", ethBlockNum, "full", fullTx) return e.backend.GetBlockByNumber(ctx, ethBlockNum, fullTx) } // GetBlockByHash returns the block identified by hash. -func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { +func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockByHash") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockByHash", "hash", hash.Hex(), "full", fullTx) return e.backend.GetBlockByHash(ctx, hash, fullTx) } // GetBlockReceipts returns the block receipts for the given block hash or number or tag. -func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) ([]map[string]interface{}, error) { +func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (_ []map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "eth_getBlockReceipts") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockReceipts", "block number or hash", blockNrOrHash) return e.backend.GetBlockReceipts(ctx, blockNrOrHash) } @@ -191,17 +192,17 @@ func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes /////////////////////////////////////////////////////////////////////////////// // GetTransactionByHash returns the transaction identified by hash. -func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTransaction, error) { +func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByHash") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByHash", "hash", hash.Hex()) return e.backend.GetTransactionByHash(ctx, hash) } // GetTransactionCount returns the number of transactions at the given address up to the given block number. -func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Uint64, error) { +func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ *hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionCount") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionCount", "address", address.Hex(), "block number or hash", blockNrOrHash) blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -211,16 +212,16 @@ func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rp } // GetTransactionReceipt returns the transaction receipt identified by hash. -func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { +func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionReceipt") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() hexTx := hash.Hex() e.logger.Debug("eth_getTransactionReceipt", "hash", hexTx) return e.backend.GetTransactionReceipt(ctx, hash) } // GetBlockTransactionCountByHash returns the number of transactions in the block identified by hash. -func (e *PublicAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint { +func (e *PublicAPI) GetBlockTransactionCountByHash(hash common.Hash) (_ *hexutil.Uint) { ctx, span := tracer.Start(context.Background(), "eth_getBlockTransactionCountByHash") defer span.End() e.logger.Debug("eth_getBlockTransactionCountByHash", "hash", hash.Hex()) @@ -228,7 +229,7 @@ func (e *PublicAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Ui } // GetBlockTransactionCountByNumber returns the number of transactions in the block identified by number. -func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint { +func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) (_ *hexutil.Uint) { ctx, span := tracer.Start(context.Background(), "eth_getBlockTransactionCountByNumber") defer span.End() e.logger.Debug("eth_getBlockTransactionCountByNumber", "height", blockNum.Int64()) @@ -236,17 +237,17 @@ func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumb } // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. -func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { +func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockHashAndIndex") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) return e.backend.GetTransactionByBlockHashAndIndex(ctx, hash, idx) } // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. -func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { +func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockNumberAndIndex") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) return e.backend.GetTransactionByBlockNumberAndIndex(ctx, blockNum, idx) } @@ -256,17 +257,17 @@ func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockN /////////////////////////////////////////////////////////////////////////////// // SendRawTransaction send a raw Ethereum transaction. -func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { +func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (_ common.Hash, err error) { ctx, span := tracer.Start(context.Background(), "eth_sendRawTransaction") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_sendRawTransaction", "length", len(data)) return e.backend.SendRawTransaction(ctx, data) } // SendTransaction sends an Ethereum transaction. -func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { +func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (_ common.Hash, err error) { ctx, span := tracer.Start(context.Background(), "eth_sendTransaction") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_sendTransaction", "args", args) return e.backend.SendTransaction(ctx, args) } @@ -282,25 +283,25 @@ func (e *PublicAPI) Accounts() ([]common.Address, error) { } // GetBalance returns the provided account's balance up to the provided block number. -func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error) { +func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBalance") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBalance", "address", address.String(), "block number or hash", blockNrOrHash) return e.backend.GetBalance(ctx, address, blockNrOrHash) } // GetStorageAt returns the contract storage at the given address, block number, and key. -func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { +func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getStorageAt") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getStorageAt", "address", address.Hex(), "key", key, "block number or hash", blockNrOrHash) return e.backend.GetStorageAt(ctx, address, key, blockNrOrHash) } // GetCode returns the contract code at the given address and block number. -func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { +func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getCode") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getCode", "address", address.Hex(), "block number or hash", blockNrOrHash) return e.backend.GetCode(ctx, address, blockNrOrHash) } @@ -309,9 +310,9 @@ func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.Block func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash, -) (*rpctypes.AccountResult, error) { +) (_ *rpctypes.AccountResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_getProof") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getProof", "address", address.Hex(), "keys", storageKeys, "block number or hash", blockNrOrHash) return e.backend.GetProof(ctx, address, storageKeys, blockNrOrHash) } @@ -325,9 +326,9 @@ func (e *PublicAPI) Call( args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, -) (hexutil.Bytes, error) { +) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_call") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_call", "args", args, "block number or hash", blockNrOrHash) blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) @@ -358,17 +359,17 @@ func (e *PublicAPI) ProtocolVersion() hexutil.Uint { } // GasPrice returns the current gas price based on Cosmos EVM's gas price oracle. -func (e *PublicAPI) GasPrice() (*hexutil.Big, error) { +func (e *PublicAPI) GasPrice() (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_gasPrice") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_gasPrice") return e.backend.GasPrice(ctx) } // EstimateGas returns an estimate of gas usage for the given smart contract call. -func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, overrides *json.RawMessage) (hexutil.Uint64, error) { +func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, overrides *json.RawMessage) (_ hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_estimateGas") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_estimateGas") return e.backend.EstimateGas(ctx, args, blockNrOrHash, overrides) } @@ -377,17 +378,17 @@ func (e *PublicAPI) FeeHistory( blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64, -) (*rpctypes.FeeHistoryResult, error) { +) (_ *rpctypes.FeeHistoryResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_feeHistory") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_feeHistory") return e.backend.FeeHistory(ctx, blockCount, lastBlock, rewardPercentiles) } // MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions. -func (e *PublicAPI) MaxPriorityFeePerGas() (*hexutil.Big, error) { +func (e *PublicAPI) MaxPriorityFeePerGas() (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_maxPriorityFeePerGas") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_maxPriorityFeePerGas") head, err := e.backend.CurrentHeader(ctx) if err != nil { @@ -401,9 +402,9 @@ func (e *PublicAPI) MaxPriorityFeePerGas() (*hexutil.Big, error) { } // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. -func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint +func (e *PublicAPI) ChainId() (_ *hexutil.Big, err error) { //nolint ctx, span := tracer.Start(context.Background(), "eth_chainId") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_chainId") return e.backend.ChainID(ctx) } @@ -443,9 +444,9 @@ func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.U // - highestBlock: block number of the highest block header this node has received from peers // - pulledStates: number of state entries processed until now // - knownStates: number of known state entries that still need to be pulled -func (e *PublicAPI) Syncing() (interface{}, error) { +func (e *PublicAPI) Syncing() (_ interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_syncing") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_syncing") return e.backend.Syncing(ctx) } @@ -457,9 +458,9 @@ func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.By } // GetTransactionLogs returns the logs given a transaction hash. -func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) { +func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionLogs") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionLogs", "hash", txHash) return e.backend.GetTransactionLogs(ctx, txHash) @@ -474,11 +475,11 @@ func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.Typ // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) // on a given unsigned transaction, and returns it to the caller for further // processing (signing + broadcast). -func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error) { +func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (_ *rpctypes.SignTransactionResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_fillTransaction") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() // Set some sanity defaults and terminate on failure - args, err := e.backend.SetTxDefaults(ctx, args) + args, err = e.backend.SetTxDefaults(ctx, args) if err != nil { return nil, err } @@ -486,7 +487,8 @@ func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.Si // Assemble the transaction and obtain rlp tx := args.ToTransaction(ethtypes.LegacyTxType) - data, err := tx.MarshalBinary() + var data []byte + data, err = tx.MarshalBinary() if err != nil { return nil, err } @@ -503,9 +505,9 @@ func (e *PublicAPI) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64, -) (common.Hash, error) { +) (_ common.Hash, err error) { ctx, span := tracer.Start(ctx, "eth_resend") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() e.logger.Debug("eth_resend", "args", args) return e.backend.Resend(ctx, args, gasPrice, gasLimit) } @@ -516,9 +518,9 @@ func (e *PublicAPI) CreateAccessList( args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage, -) (*rpctypes.AccessListResult, error) { +) (_ *rpctypes.AccessListResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_createAccessList") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() res, err := e.backend.CreateAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { return nil, err diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 427930d2c..1ee34e490 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -17,6 +17,7 @@ import ( "github.com/cosmos/evm/rpc/stream" "github.com/cosmos/evm/rpc/types" + "github.com/cosmos/evm/trace" "cosmossdk.io/log" @@ -224,9 +225,9 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID, // GetLogs returns logs matching the given argument that are stored within the state. // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs -func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*ethtypes.Log, error) { +func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetLogs") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() var filter *Filter if crit.BlockHash != nil { // Block filter requested, construct a single-shot filter @@ -277,9 +278,9 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { // If the filter could not be found an empty array of logs is returned. // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs -func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ethtypes.Log, error) { +func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetFilterLogs") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() api.filtersMu.Lock() f, found := api.filters[id] api.filtersMu.Unlock() diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index ba276b36c..ed8d584df 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -17,6 +17,7 @@ import ( "github.com/cosmos/evm/rpc/backend" "github.com/cosmos/evm/rpc/types" + "github.com/cosmos/evm/trace" "cosmossdk.io/log" ) @@ -92,7 +93,7 @@ func newFilter(logger log.Logger, backend Backend, criteria filters.FilterCriter // first block that contains matches, updating the start of the filter accordingly. func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) (logs []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "Filter.Logs") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() if blockLimit == 0 { return nil, nil } diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 562f95e37..013935178 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/evm/crypto/hd" "github.com/cosmos/evm/rpc/backend" + "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -115,10 +116,10 @@ func (api *PrivateAccountAPI) UnlockAccount(_ context.Context, addr common.Addre // SendTransaction will create a transaction from the given arguments and // tries to sign it with the key associated with args.To. If the given password isn't // able to decrypt the key it fails. -func (api *PrivateAccountAPI) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs, _ string) (common.Hash, error) { +func (api *PrivateAccountAPI) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs, _ string) (_ common.Hash, err error) { api.logger.Debug("personal_sendTransaction", "address", args.To.String()) ctx, span := tracer.Start(ctx, "SendTransaction") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() return api.backend.SendTransaction(ctx, args) } @@ -146,10 +147,10 @@ func (api *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr // the V value must be 27 or 28 for legacy reasons. // // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecove -func (api *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { +func (api *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (_ common.Address, err error) { api.logger.Debug("personal_ecRecover", "data", data, "sig", sig) _, span := tracer.Start(ctx, "EcRecover") - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() if len(sig) != crypto.SignatureLength { return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index 403eef3ed..8cdfda2cc 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/evm/rpc/backend" "github.com/cosmos/evm/rpc/types" + evmtrace "github.com/cosmos/evm/trace" "cosmossdk.io/log" ) @@ -33,33 +34,33 @@ func NewPublicAPI(logger log.Logger, backend backend.EVMBackend) *PublicAPI { } // Content returns the transactions contained within the transaction pool -func (api *PublicAPI) Content() (map[string]map[string]map[string]*types.RPCTransaction, error) { +func (api *PublicAPI) Content() (_ map[string]map[string]map[string]*types.RPCTransaction, err error) { api.logger.Debug("txpool_content") ctx, span := tracer.Start(context.Background(), "Content") - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() return api.backend.Content(ctx) } // ContentFrom returns the transactions contained within the transaction pool -func (api *PublicAPI) ContentFrom(address common.Address) (map[string]map[string]*types.RPCTransaction, error) { +func (api *PublicAPI) ContentFrom(address common.Address) (_ map[string]map[string]*types.RPCTransaction, err error) { api.logger.Debug("txpool_contentFrom") ctx, span := tracer.Start(context.Background(), "ContentFrom", trace.WithAttributes(attribute.String("address", address.Hex()))) - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() return api.backend.ContentFrom(ctx, address) } // Inspect returns the content of the transaction pool and flattens it into an easily inspectable list -func (api *PublicAPI) Inspect() (map[string]map[string]map[string]string, error) { +func (api *PublicAPI) Inspect() (_ map[string]map[string]map[string]string, err error) { api.logger.Debug("txpool_inspect") ctx, span := tracer.Start(context.Background(), "Inspect") - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() return api.backend.Inspect(ctx) } // Status returns the number of pending and queued transaction in the pool -func (api *PublicAPI) Status() (map[string]hexutil.Uint, error) { +func (api *PublicAPI) Status() (_ map[string]hexutil.Uint, err error) { api.logger.Debug("txpool_status") ctx, span := tracer.Start(context.Background(), "Status") - defer span.End() + defer func() { evmtrace.EndSpanErr(span, err) }() return api.backend.Status(ctx) } diff --git a/rpc/types/utils.go b/rpc/types/utils.go index c8cd3b116..1c1310935 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -6,6 +6,7 @@ import ( "math/big" "strings" + "github.com/cosmos/evm/trace" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" @@ -103,8 +104,7 @@ var tracer = otel.Tracer("evm/rpc/types") // BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params. func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (_ int64, err error) { goCtx, span := tracer.Start(goCtx, "BlockMaxGasFromConsensusParams") - defer func() { span.RecordError(err) }() - defer span.End() + defer func() { trace.EndSpanErr(span, err) }() cmtrpcclient, ok := clientCtx.Client.(cmtrpcclient.Client) if !ok { diff --git a/trace/span.go b/trace/span.go new file mode 100644 index 000000000..2dd356dd0 --- /dev/null +++ b/trace/span.go @@ -0,0 +1,14 @@ +package trace + +import ( + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" +) + +func EndSpanErr(span trace.Span, err error) { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + } + span.End() +} From 76946cb220b2f31971366fa094569db4f1942433 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:43:18 -0800 Subject: [PATCH 10/14] add helper comment --- trace/span.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/trace/span.go b/trace/span.go index 2dd356dd0..996d99fe3 100644 --- a/trace/span.go +++ b/trace/span.go @@ -5,6 +5,17 @@ import ( "go.opentelemetry.io/otel/trace" ) +// EndSpanErr records the error to the span if not nil, and then ends the span. +// NOTE: This should be called like so: +// +// defer func() { EndSpanErr(span, err) } +// +// and not like this: +// +// defer EndSpanErr(span, err) +// +// This is due to the fact that the latter captures the error value at the point in time of the defer line, +// whilst the former will capture the final error value at the very end of the function. func EndSpanErr(span trace.Span, err error) { if err != nil { span.RecordError(err) From a7f4677dcf66cd430d00768e3f4dca3ef481c2fa Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:47:12 -0800 Subject: [PATCH 11/14] consistent import alias --- rpc/namespaces/ethereum/eth/api.go | 58 +++++++++---------- rpc/namespaces/ethereum/eth/filters/api.go | 6 +- .../ethereum/eth/filters/filters.go | 4 +- rpc/namespaces/ethereum/personal/api.go | 6 +- rpc/types/utils.go | 4 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 2841374ab..decee2735 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/evm/rpc/backend" rpctypes "github.com/cosmos/evm/rpc/types" - "github.com/cosmos/evm/trace" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -138,7 +138,7 @@ func NewPublicAPI(logger log.Logger, backend backend.EVMBackend) *PublicAPI { // - When blockNr is -4 the chain safe header is returned. func (e *PublicAPI) GetHeaderByNumber(ethBlockNum rpctypes.BlockNumber) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderByNumber") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getHeaderByNumber", "number", ethBlockNum) return e.backend.GetHeaderByNumber(ctx, ethBlockNum) } @@ -146,7 +146,7 @@ func (e *PublicAPI) GetHeaderByNumber(ethBlockNum rpctypes.BlockNumber) (_ map[s // GetHeaderByHash returns the requested header by hash. func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getHeaderByHash") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getHeaderByHash", "hash", hash.Hex()) return e.backend.GetHeaderByHash(ctx, hash) } @@ -158,7 +158,7 @@ func (e *PublicAPI) GetHeaderByHash(hash common.Hash) (_ map[string]interface{}, // BlockNumber returns the current block number. func (e *PublicAPI) BlockNumber() (_ hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_blockNumber") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_blockNumber") return e.backend.BlockNumber(ctx) } @@ -166,7 +166,7 @@ func (e *PublicAPI) BlockNumber() (_ hexutil.Uint64, err error) { // GetBlockByNumber returns the block identified by number. func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bool) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockByNumber") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockByNumber", "number", ethBlockNum, "full", fullTx) return e.backend.GetBlockByNumber(ctx, ethBlockNum, fullTx) } @@ -174,7 +174,7 @@ func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bo // GetBlockByHash returns the block identified by hash. func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBlockByHash") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockByHash", "hash", hash.Hex(), "full", fullTx) return e.backend.GetBlockByHash(ctx, hash, fullTx) } @@ -182,7 +182,7 @@ func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (_ map[string] // GetBlockReceipts returns the block receipts for the given block hash or number or tag. func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes.BlockNumberOrHash) (_ []map[string]interface{}, err error) { ctx, span := tracer.Start(ctx, "eth_getBlockReceipts") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBlockReceipts", "block number or hash", blockNrOrHash) return e.backend.GetBlockReceipts(ctx, blockNrOrHash) } @@ -194,7 +194,7 @@ func (e *PublicAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpctypes // GetTransactionByHash returns the transaction identified by hash. func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByHash") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByHash", "hash", hash.Hex()) return e.backend.GetTransactionByHash(ctx, hash) } @@ -202,7 +202,7 @@ func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (_ *rpctypes.RPCTrans // GetTransactionCount returns the number of transactions at the given address up to the given block number. func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ *hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionCount") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionCount", "address", address.Hex(), "block number or hash", blockNrOrHash) blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) if err != nil { @@ -214,7 +214,7 @@ func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rp // GetTransactionReceipt returns the transaction receipt identified by hash. func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (_ map[string]interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionReceipt") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() hexTx := hash.Hex() e.logger.Debug("eth_getTransactionReceipt", "hash", hexTx) return e.backend.GetTransactionReceipt(ctx, hash) @@ -239,7 +239,7 @@ func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumb // GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockHashAndIndex") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) return e.backend.GetTransactionByBlockHashAndIndex(ctx, hash, idx) } @@ -247,7 +247,7 @@ func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexu // GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (_ *rpctypes.RPCTransaction, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionByBlockNumberAndIndex") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) return e.backend.GetTransactionByBlockNumberAndIndex(ctx, blockNum, idx) } @@ -259,7 +259,7 @@ func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockN // SendRawTransaction send a raw Ethereum transaction. func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (_ common.Hash, err error) { ctx, span := tracer.Start(context.Background(), "eth_sendRawTransaction") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_sendRawTransaction", "length", len(data)) return e.backend.SendRawTransaction(ctx, data) } @@ -267,7 +267,7 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (_ common.Hash, err e // SendTransaction sends an Ethereum transaction. func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (_ common.Hash, err error) { ctx, span := tracer.Start(context.Background(), "eth_sendTransaction") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_sendTransaction", "args", args) return e.backend.SendTransaction(ctx, args) } @@ -285,7 +285,7 @@ func (e *PublicAPI) Accounts() ([]common.Address, error) { // GetBalance returns the provided account's balance up to the provided block number. func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_getBalance") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getBalance", "address", address.String(), "block number or hash", blockNrOrHash) return e.backend.GetBalance(ctx, address, blockNrOrHash) } @@ -293,7 +293,7 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.Bl // GetStorageAt returns the contract storage at the given address, block number, and key. func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getStorageAt") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getStorageAt", "address", address.Hex(), "key", key, "block number or hash", blockNrOrHash) return e.backend.GetStorageAt(ctx, address, key, blockNrOrHash) } @@ -301,7 +301,7 @@ func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHa // GetCode returns the contract code at the given address and block number. func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_getCode") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getCode", "address", address.Hex(), "block number or hash", blockNrOrHash) return e.backend.GetCode(ctx, address, blockNrOrHash) } @@ -312,7 +312,7 @@ func (e *PublicAPI) GetProof(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash, ) (_ *rpctypes.AccountResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_getProof") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getProof", "address", address.Hex(), "keys", storageKeys, "block number or hash", blockNrOrHash) return e.backend.GetProof(ctx, address, storageKeys, blockNrOrHash) } @@ -328,7 +328,7 @@ func (e *PublicAPI) Call( overrides *json.RawMessage, ) (_ hexutil.Bytes, err error) { ctx, span := tracer.Start(context.Background(), "eth_call") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_call", "args", args, "block number or hash", blockNrOrHash) blockNum, err := e.backend.BlockNumberFromComet(ctx, blockNrOrHash) @@ -361,7 +361,7 @@ func (e *PublicAPI) ProtocolVersion() hexutil.Uint { // GasPrice returns the current gas price based on Cosmos EVM's gas price oracle. func (e *PublicAPI) GasPrice() (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_gasPrice") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_gasPrice") return e.backend.GasPrice(ctx) } @@ -369,7 +369,7 @@ func (e *PublicAPI) GasPrice() (_ *hexutil.Big, err error) { // EstimateGas returns an estimate of gas usage for the given smart contract call. func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, overrides *json.RawMessage) (_ hexutil.Uint64, err error) { ctx, span := tracer.Start(context.Background(), "eth_estimateGas") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_estimateGas") return e.backend.EstimateGas(ctx, args, blockNrOrHash, overrides) } @@ -380,7 +380,7 @@ func (e *PublicAPI) FeeHistory( rewardPercentiles []float64, ) (_ *rpctypes.FeeHistoryResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_feeHistory") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_feeHistory") return e.backend.FeeHistory(ctx, blockCount, lastBlock, rewardPercentiles) } @@ -388,7 +388,7 @@ func (e *PublicAPI) FeeHistory( // MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions. func (e *PublicAPI) MaxPriorityFeePerGas() (_ *hexutil.Big, err error) { ctx, span := tracer.Start(context.Background(), "eth_maxPriorityFeePerGas") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_maxPriorityFeePerGas") head, err := e.backend.CurrentHeader(ctx) if err != nil { @@ -404,7 +404,7 @@ func (e *PublicAPI) MaxPriorityFeePerGas() (_ *hexutil.Big, err error) { // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. func (e *PublicAPI) ChainId() (_ *hexutil.Big, err error) { //nolint ctx, span := tracer.Start(context.Background(), "eth_chainId") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_chainId") return e.backend.ChainID(ctx) } @@ -446,7 +446,7 @@ func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.U // - knownStates: number of known state entries that still need to be pulled func (e *PublicAPI) Syncing() (_ interface{}, err error) { ctx, span := tracer.Start(context.Background(), "eth_syncing") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_syncing") return e.backend.Syncing(ctx) } @@ -460,7 +460,7 @@ func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.By // GetTransactionLogs returns the logs given a transaction hash. func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(context.Background(), "eth_getTransactionLogs") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_getTransactionLogs", "hash", txHash) return e.backend.GetTransactionLogs(ctx, txHash) @@ -477,7 +477,7 @@ func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.Typ // processing (signing + broadcast). func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (_ *rpctypes.SignTransactionResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_fillTransaction") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() // Set some sanity defaults and terminate on failure args, err = e.backend.SetTxDefaults(ctx, args) if err != nil { @@ -507,7 +507,7 @@ func (e *PublicAPI) Resend(ctx context.Context, gasLimit *hexutil.Uint64, ) (_ common.Hash, err error) { ctx, span := tracer.Start(ctx, "eth_resend") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() e.logger.Debug("eth_resend", "args", args) return e.backend.Resend(ctx, args, gasPrice, gasLimit) } @@ -520,7 +520,7 @@ func (e *PublicAPI) CreateAccessList( overrides *json.RawMessage, ) (_ *rpctypes.AccessListResult, err error) { ctx, span := tracer.Start(context.Background(), "eth_createAccessList") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() res, err := e.backend.CreateAccessList(ctx, args, blockNrOrHash, overrides) if err != nil { return nil, err diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 1ee34e490..b5f3a6be9 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/evm/rpc/stream" "github.com/cosmos/evm/rpc/types" - "github.com/cosmos/evm/trace" + evmtrace "github.com/cosmos/evm/trace" "cosmossdk.io/log" @@ -227,7 +227,7 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID, // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetLogs") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() var filter *Filter if crit.BlockHash != nil { // Block filter requested, construct a single-shot filter @@ -280,7 +280,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) (_ []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "GetFilterLogs") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() api.filtersMu.Lock() f, found := api.filters[id] api.filtersMu.Unlock() diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index ed8d584df..d1ecf7aa9 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/evm/rpc/backend" "github.com/cosmos/evm/rpc/types" - "github.com/cosmos/evm/trace" + evmtrace "github.com/cosmos/evm/trace" "cosmossdk.io/log" ) @@ -93,7 +93,7 @@ func newFilter(logger log.Logger, backend Backend, criteria filters.FilterCriter // first block that contains matches, updating the start of the filter accordingly. func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) (logs []*ethtypes.Log, err error) { ctx, span := tracer.Start(ctx, "Filter.Logs") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() if blockLimit == 0 { return nil, nil } diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 013935178..af8fb28f1 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -14,7 +14,7 @@ import ( "github.com/cosmos/evm/crypto/hd" "github.com/cosmos/evm/rpc/backend" - "github.com/cosmos/evm/trace" + evmtrace "github.com/cosmos/evm/trace" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -119,7 +119,7 @@ func (api *PrivateAccountAPI) UnlockAccount(_ context.Context, addr common.Addre func (api *PrivateAccountAPI) SendTransaction(ctx context.Context, args evmtypes.TransactionArgs, _ string) (_ common.Hash, err error) { api.logger.Debug("personal_sendTransaction", "address", args.To.String()) ctx, span := tracer.Start(ctx, "SendTransaction") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() return api.backend.SendTransaction(ctx, args) } @@ -150,7 +150,7 @@ func (api *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr func (api *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (_ common.Address, err error) { api.logger.Debug("personal_ecRecover", "data", data, "sig", sig) _, span := tracer.Start(ctx, "EcRecover") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() if len(sig) != crypto.SignatureLength { return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) diff --git a/rpc/types/utils.go b/rpc/types/utils.go index 1c1310935..2ff8e2538 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - "github.com/cosmos/evm/trace" + evmtrace "github.com/cosmos/evm/trace" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" @@ -104,7 +104,7 @@ var tracer = otel.Tracer("evm/rpc/types") // BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params. func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (_ int64, err error) { goCtx, span := tracer.Start(goCtx, "BlockMaxGasFromConsensusParams") - defer func() { trace.EndSpanErr(span, err) }() + defer func() { evmtrace.EndSpanErr(span, err) }() cmtrpcclient, ok := clientCtx.Client.(cmtrpcclient.Client) if !ok { From b9ff28a96a9ae9742b50e2d8a7d941f991d69e93 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 3 Dec 2025 11:10:50 -0800 Subject: [PATCH 12/14] point gomod to sdk otel branch --- evmd/go.mod | 5 ++-- evmd/go.sum | 2 ++ go.mod | 5 ++-- go.sum | 2 ++ tests/speedtest/go.mod | 31 ++++++++++++++++++-- tests/speedtest/go.sum | 59 ++++++++++++++++++++++++++++++++++++-- tests/systemtests/go.mod | 35 +++++++++++++++++++++-- tests/systemtests/go.sum | 61 ++++++++++++++++++++++++++++++++++++++-- 8 files changed, 186 insertions(+), 14 deletions(-) diff --git a/evmd/go.mod b/evmd/go.mod index 56597e2e2..6fec3ed35 100644 --- a/evmd/go.mod +++ b/evmd/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/evm/evmd -go 1.25.0 +go 1.25.5 require ( cosmossdk.io/api v0.9.2 @@ -16,7 +16,7 @@ require ( cosmossdk.io/x/upgrade v0.2.0 github.com/cometbft/cometbft v0.39.0-beta.2 github.com/cosmos/cosmos-db v1.1.3 - github.com/cosmos/cosmos-sdk v0.54.0-beta.0 + github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa github.com/cosmos/evm v0.2.0 github.com/cosmos/gogoproto v1.7.2 github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251027215440-22f0033d0aee @@ -316,7 +316,6 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - github.com/cosmos/cosmos-sdk => ../../cosmos-sdk github.com/cosmos/evm => ../ // use Cosmos geth fork // branch: release/1.16 diff --git a/evmd/go.sum b/evmd/go.sum index 72537c322..129de4cb9 100644 --- a/evmd/go.sum +++ b/evmd/go.sum @@ -274,6 +274,8 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa h1:/V1l4snedPDF0D02n4RcBGIc7Zh+AVUGDmdsfShIt/0= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa/go.mod h1:zLaCSzfwEXz3whgptvaqfiYweilHL0K9qRoEFwQQvEg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= diff --git a/go.mod b/go.mod index 952fed9dd..8da5c59cb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/evm -go 1.25.0 +go 1.25.5 require ( cosmossdk.io/api v0.9.2 @@ -18,7 +18,7 @@ require ( github.com/cometbft/cometbft v0.39.0-beta.2 github.com/cosmos/cosmos-db v1.1.3 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.54.0-beta.0 + github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.7.2 github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251027215440-22f0033d0aee @@ -310,7 +310,6 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - github.com/cosmos/cosmos-sdk => ../cosmos-sdk // use Cosmos geth fork // branch: release/1.16 github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v1.16.2-cosmos-1 diff --git a/go.sum b/go.sum index 3a6c42949..9c1972d61 100644 --- a/go.sum +++ b/go.sum @@ -269,6 +269,8 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa h1:/V1l4snedPDF0D02n4RcBGIc7Zh+AVUGDmdsfShIt/0= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa/go.mod h1:zLaCSzfwEXz3whgptvaqfiYweilHL0K9qRoEFwQQvEg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= diff --git a/tests/speedtest/go.mod b/tests/speedtest/go.mod index 17a336143..0bc282c6a 100644 --- a/tests/speedtest/go.mod +++ b/tests/speedtest/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/evm/tests/speedtest -go 1.25.0 +go 1.25.5 replace ( github.com/cosmos/evm => ../../ @@ -13,7 +13,7 @@ replace ( require ( cosmossdk.io/log v1.6.1 github.com/cosmos/cosmos-db v1.1.3 - github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251119151455-2667feb5154b + github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa github.com/cosmos/evm v0.2.0 github.com/cosmos/evm/evmd v0.0.0-20251112193856-d450ea1d6bd0 github.com/ethereum/go-ethereum v1.16.5 @@ -82,6 +82,7 @@ require ( github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cloudwego/base64x v0.1.6 // indirect @@ -117,6 +118,7 @@ require ( github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect + github.com/ebitengine/purego v0.8.4 // indirect github.com/emicklei/dot v1.8.0 // indirect github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect @@ -154,8 +156,10 @@ require ( github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -184,6 +188,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/linxGnu/grocksdb v1.10.3 // indirect + github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -207,9 +212,11 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.4 // indirect + github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -219,6 +226,7 @@ require ( github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sasha-s/go-deadlock v0.3.6 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shirou/gopsutil/v4 v4.25.7 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -248,12 +256,31 @@ require ( go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/host v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 // indirect + go.opentelemetry.io/contrib/otelconf v0.18.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.37.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect + go.opentelemetry.io/otel/log v0.14.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect diff --git a/tests/speedtest/go.sum b/tests/speedtest/go.sum index 951a61c12..720a60700 100644 --- a/tests/speedtest/go.sum +++ b/tests/speedtest/go.sum @@ -196,6 +196,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -266,8 +268,8 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251119151455-2667feb5154b h1:7NGmZys36hEWxNROw3Glzm9r4dpFu8rlvaqt5pmwt0s= -github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251119151455-2667feb5154b/go.mod h1:ASeglQApCId0j9w12IfYJEvwWC5mY6/cu4AhXG9xffw= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa h1:/V1l4snedPDF0D02n4RcBGIc7Zh+AVUGDmdsfShIt/0= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa/go.mod h1:zLaCSzfwEXz3whgptvaqfiYweilHL0K9qRoEFwQQvEg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= @@ -342,6 +344,8 @@ github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= +github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.8.0 h1:HnD60yAKFAevNeT+TPYr9pb8VB9bqdeSo0nzwIW6IOI= github.com/emicklei/dot v1.8.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= @@ -528,6 +532,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -538,6 +544,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 h1:81+kWbE1yErFBMjME0I5k3x3kojjKsWtPYHEAutoPow= @@ -676,6 +684,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.10.3 h1:0laII9AQ6kFxo5SjhdTfSh9EgF20piD6TMHK6YuDm+4= github.com/linxGnu/grocksdb v1.10.3/go.mod h1:OLQKZwiKwaJiAVCsOzWKvwiLwfZ5Vz8Md5TYR7t7pM8= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -823,6 +833,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -849,6 +861,8 @@ github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= +github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= 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= @@ -890,6 +904,8 @@ github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGT github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM= +github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -1008,21 +1024,59 @@ go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0 h1:zsaUrWypCf0NtYSUby+/BS6QqhXVNxMQD5w4dLczKCQ= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0/go.mod h1:Ru+kuFO+ToZqBKwI59rCStOhW6LWrbGisYrFaX61bJk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/contrib/otelconf v0.18.0 h1:ciF2Gf00BWs0DnexKFZXcxg9kJ8r3SUW1LOzW3CsKA8= +go.opentelemetry.io/contrib/otelconf v0.18.0/go.mod h1:FcP7k+JLwBLdOxS6qY6VQ/4b5VBntI6L6o80IMwhAeI= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 h1:pW+qDVo0jB0rLsNeaP85xLuz20cvsECUcN7TE+D8YTM= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0/go.mod h1:x7bd+t034hxLTve1hF9Yn9qQJlO/pP8H5pWIt7+gsFM= go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 h1:QQqYw3lkrzwVsoEX0w//EhH/TCnpRdEenKBOOEIMjWc= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0/go.mod h1:gSVQcr17jk2ig4jqJ2DX30IdWH251JcNAecvrqTxH1s= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 h1:Oe2z/BCg5q7k4iXC3cqJxKYg0ieRiOqF0cecFYdPTwk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0/go.mod h1:ZQM5lAJpOsKnYagGg/zV2krVqTtaVdYdDkhMoX6Oalg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 h1:B/g+qde6Mkzxbry5ZZag0l7QrQBCtVm7lVjaLgmpje8= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0/go.mod h1:mOJK8eMmgW6ocDJn6Bn11CcZ05gi3P8GylBXEkZtbgA= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg= +go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1173,6 +1227,7 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index f2559bcea..e7622c9bb 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -1,12 +1,12 @@ module github.com/cosmos/evm/tests/systemtests -go 1.25.0 +go 1.25.5 require ( cosmossdk.io/math v1.5.3 cosmossdk.io/systemtests v1.4.0 github.com/cometbft/cometbft v0.39.0-beta.2 - github.com/cosmos/cosmos-sdk v0.54.0-beta.0 + github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa github.com/cosmos/evm v0.5.0-rc.0 github.com/ethereum/go-ethereum v1.16.5 github.com/holiman/uint256 v1.3.2 @@ -42,6 +42,7 @@ require ( github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudwego/base64x v0.1.6 // indirect github.com/cockroachdb/errors v1.12.0 // indirect @@ -74,6 +75,7 @@ require ( github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect + github.com/ebitengine/purego v0.8.4 // indirect github.com/emicklei/dot v1.8.0 // indirect github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect github.com/ethereum/go-verkle v0.2.2 // indirect @@ -101,11 +103,14 @@ require ( github.com/google/go-cmp v0.7.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect @@ -127,6 +132,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/linxGnu/grocksdb v1.10.3 // indirect + github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect @@ -143,9 +149,11 @@ require ( github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.4 // indirect + github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -155,6 +163,7 @@ require ( github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sasha-s/go-deadlock v0.3.6 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shirou/gopsutil/v4 v4.25.7 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -178,9 +187,31 @@ require ( github.com/zondax/ledger-go v1.0.1 // indirect go.etcd.io/bbolt v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/host v0.63.0 // indirect + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 // indirect + go.opentelemetry.io/contrib/otelconf v0.18.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.37.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect + go.opentelemetry.io/otel/log v0.14.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index da3e8eec6..50b662899 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -169,6 +169,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -230,8 +232,8 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0 h1:KOyM1CjuriSxMm2CNhceGfEc2LbRWuImKw7L9yp3+SM= -github.com/cosmos/cosmos-sdk v0.54.0-beta.0/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa h1:/V1l4snedPDF0D02n4RcBGIc7Zh+AVUGDmdsfShIt/0= +github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251203182402-86d6325417fa/go.mod h1:zLaCSzfwEXz3whgptvaqfiYweilHL0K9qRoEFwQQvEg= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI= @@ -294,6 +296,8 @@ github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= +github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.8.0 h1:HnD60yAKFAevNeT+TPYr9pb8VB9bqdeSo0nzwIW6IOI= github.com/emicklei/dot v1.8.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= @@ -472,6 +476,8 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -480,6 +486,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 h1:81+kWbE1yErFBMjME0I5k3x3kojjKsWtPYHEAutoPow= @@ -605,6 +613,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.10.3 h1:0laII9AQ6kFxo5SjhdTfSh9EgF20piD6TMHK6YuDm+4= github.com/linxGnu/grocksdb v1.10.3/go.mod h1:OLQKZwiKwaJiAVCsOzWKvwiLwfZ5Vz8Md5TYR7t7pM8= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg= +github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -749,6 +759,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -777,6 +789,8 @@ github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc= github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= +github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= 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= @@ -817,6 +831,8 @@ github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGT github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM= +github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -934,19 +950,59 @@ go.opentelemetry.io/contrib/detectors/gcp v1.38.0 h1:ZoYbqX7OaA/TAikspPl3ozPI6iY go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0 h1:zsaUrWypCf0NtYSUby+/BS6QqhXVNxMQD5w4dLczKCQ= +go.opentelemetry.io/contrib/instrumentation/host v0.63.0/go.mod h1:Ru+kuFO+ToZqBKwI59rCStOhW6LWrbGisYrFaX61bJk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/contrib/otelconf v0.18.0 h1:ciF2Gf00BWs0DnexKFZXcxg9kJ8r3SUW1LOzW3CsKA8= +go.opentelemetry.io/contrib/otelconf v0.18.0/go.mod h1:FcP7k+JLwBLdOxS6qY6VQ/4b5VBntI6L6o80IMwhAeI= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= +go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 h1:pW+qDVo0jB0rLsNeaP85xLuz20cvsECUcN7TE+D8YTM= +go.opentelemetry.io/contrib/propagators/jaeger v1.37.0/go.mod h1:x7bd+t034hxLTve1hF9Yn9qQJlO/pP8H5pWIt7+gsFM= go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 h1:QQqYw3lkrzwVsoEX0w//EhH/TCnpRdEenKBOOEIMjWc= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0/go.mod h1:gSVQcr17jk2ig4jqJ2DX30IdWH251JcNAecvrqTxH1s= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 h1:Oe2z/BCg5q7k4iXC3cqJxKYg0ieRiOqF0cecFYdPTwk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0/go.mod h1:ZQM5lAJpOsKnYagGg/zV2krVqTtaVdYdDkhMoX6Oalg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 h1:B/g+qde6Mkzxbry5ZZag0l7QrQBCtVm7lVjaLgmpje8= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0/go.mod h1:mOJK8eMmgW6ocDJn6Bn11CcZ05gi3P8GylBXEkZtbgA= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg= +go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1080,6 +1136,7 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From aa145cae20a05116c54e514cd876672755c236a1 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:40:14 -0800 Subject: [PATCH 13/14] make the context height thing cleaner --- rpc/backend/account_info.go | 8 +- rpc/backend/call_tx.go | 8 +- rpc/backend/chain_info.go | 2 +- rpc/backend/comet_to_eth.go | 4 +- rpc/backend/tracing.go | 8 +- rpc/backend/tx_info_test.go | 4 +- rpc/backend/utils.go | 4 +- rpc/types/block.go | 21 ++--- .../rpc/backend/test_backend_suite.go | 4 +- tests/integration/rpc/backend/test_client.go | 62 +++++++------- .../rpc/backend/test_evm_query_client.go | 84 +++++++++---------- .../backend/test_feemarket_query_client.go | 4 +- x/vm/client/cli/query.go | 6 +- 13 files changed, 110 insertions(+), 109 deletions(-) diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 8bf4c072c..5b5e67130 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -36,7 +36,7 @@ func (b *Backend) GetCode(ctx context.Context, address common.Address, blockNrOr return nil, err } - ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockNum.Int64()) req := &evmtypes.QueryCodeRequest{ Address: address.String(), } @@ -81,7 +81,7 @@ func (b *Backend) GetProof(ctx context.Context, address common.Address, storageK height = int64(bn) //#nosec G115 -- checked for int overflow already } - ctx = rpctypes.ContextWithHeight(height, ctx) + ctx = rpctypes.ContextWithHeight(ctx, height) clientCtx := b.ClientCtx.WithHeight(height).WithCmdContext(ctx) // query storage proofs @@ -144,7 +144,7 @@ func (b *Backend) GetStorageAt(ctx context.Context, address common.Address, key return nil, err } - ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockNum.Int64()) req := &evmtypes.QueryStorageRequest{ Address: address.String(), Key: key, @@ -168,7 +168,7 @@ func (b *Backend) GetBalance(ctx context.Context, address common.Address, blockN if err != nil { return nil, err } - ctx = rpctypes.ContextWithHeight(blockNum.Int64(), ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockNum.Int64()) req := &evmtypes.QueryBalanceRequest{ Address: address.String(), diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 55d20e929..a278a7017 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -376,10 +376,10 @@ func (b *Backend) EstimateGas( Overrides: bzOverrides, } - // From ContextWithHeight: if the provided height is 0, + // From NewContextWithHeight: if the provided height is 0, // it will return an empty context and the gRPC query will use // the latest block height for querying. - ctx = rpctypes.ContextWithHeight(blockNr.Int64(), ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockNr.Int64()) res, err := b.QueryClient.EstimateGas(ctx, &req) if err != nil { return 0, err @@ -428,10 +428,10 @@ func (b *Backend) DoCall( Overrides: bzOverrides, } - // From ContextWithHeight: if the provided height is 0, + // From NewContextWithHeight: if the provided height is 0, // it will return an empty context and the gRPC query will use // the latest block height for querying. - ctx = rpctypes.ContextWithHeight(blockNr.Int64(), ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockNr.Int64()) timeout := b.RPCEVMTimeout() // Setup context so it may be canceled the call has completed diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 0b4eb26f1..863e06e34 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -78,7 +78,7 @@ func (b *Backend) BaseFee(ctx context.Context, blockRes *cmtrpctypes.ResultBlock defer func() { evmtrace.EndSpanErr(span, err) }() // return BaseFee if London hard fork is activated and feemarket is enabled - ctx = rpctypes.ContextWithHeight(blockRes.Height, ctx) + ctx = rpctypes.ContextWithHeight(ctx, blockRes.Height) res, err := b.QueryClient.BaseFee(ctx, &evmtypes.QueryBaseFeeRequest{}) if err != nil || res.BaseFee == nil { // we can't tell if it's london HF not enabled or the state is pruned, diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index f035e7346..18efa09b4 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -169,7 +169,7 @@ func (b *Backend) EthBlockFromCometBlock( } // 3. get block gasLimit - ctx = rpctypes.ContextWithHeight(cmtBlock.Height, ctx) + ctx = rpctypes.ContextWithHeight(ctx, cmtBlock.Height) gasLimit, err := rpctypes.BlockMaxGasFromConsensusParams(ctx, b.ClientCtx, cmtBlock.Height) if err != nil { b.Logger.Error("failed to query consensus params", "error", err.Error()) @@ -230,7 +230,7 @@ func (b *Backend) MinerFromCometBlock( var validatorAccAddr sdk.AccAddress - ctx = rpctypes.ContextWithHeight(cmtBlock.Height, ctx) + ctx = rpctypes.ContextWithHeight(ctx, cmtBlock.Height) res, err := b.QueryClient.ValidatorAccount(ctx, req) if err != nil { b.Logger.Debug( diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index 1053100a9..39201fd8d 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -127,7 +127,7 @@ func (b *Backend) TraceTransaction(ctx context.Context, hash common.Hash, config // So here we set the minimum requested height to 1. contextHeight = 1 } - traceResult, err := b.QueryClient.TraceTx(rpctypes.ContextWithHeight(contextHeight, ctx), &traceTxRequest) + traceResult, err := b.QueryClient.TraceTx(rpctypes.ContextWithHeight(ctx, contextHeight), &traceTxRequest) if err != nil { return nil, err } @@ -202,10 +202,10 @@ func (b *Backend) TraceBlock(ctx context.Context, height rpctypes.BlockNumber, // minus one to get the context at the beginning of the block contextHeight := height - 1 if contextHeight < 1 { - // 0 is a special value for `ContextWithHeight`. + // 0 is a special value for `NewContextWithHeight`. contextHeight = 1 } - ctxWithHeight := rpctypes.ContextWithHeight(int64(contextHeight), ctx) + ctxWithHeight := rpctypes.ContextWithHeight(ctx, int64(contextHeight)) nc, ok := b.ClientCtx.Client.(tmrpcclient.NetworkClient) if !ok { @@ -298,7 +298,7 @@ func (b *Backend) TraceCall( } // Use the block height as context for the query - ctxWithHeight := rpctypes.ContextWithHeight(contextHeight, ctx) + ctxWithHeight := rpctypes.ContextWithHeight(ctx, contextHeight) traceResult, err := b.QueryClient.TraceCall(ctxWithHeight, &traceCallRequest) if err != nil { return nil, err diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index c8bbded75..439cf9bb3 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -375,7 +375,7 @@ func TestCreateAccessList(t *testing.T) { require.NotEqual(t, common.Address{}, args.GetFrom(), "From address should not be zero") } - result, err := backend.CreateAccessList(rpctypes.ContextWithHeight(1), args, blockNumOrHash, tc.overrides) + result, err := backend.CreateAccessList(rpctypes.NewContextWithHeight(1), args, blockNumOrHash, tc.overrides) if tc.expectError { require.Error(t, err) @@ -490,7 +490,7 @@ func TestReceiptsFromCometBlock(t *testing.T) { backend.Indexer = mockIndexer mockEVMQueryClient := backend.QueryClient.QueryClient.(*mocks.EVMQueryClient) mockEVMQueryClient.On("BaseFee", mock.Anything, mock.Anything).Return(&evmtypes.QueryBaseFeeResponse{}, nil) - receipts, err := backend.ReceiptsFromCometBlock(rpctypes.ContextWithHeight(1), resBlock, blockRes, msgs) + receipts, err := backend.ReceiptsFromCometBlock(rpctypes.NewContextWithHeight(1), resBlock, blockRes, msgs) require.NoError(t, err) require.Len(t, receipts, 1) actualTxIndex := receipts[0].TransactionIndex diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index f12301005..3175a8449 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -56,7 +56,7 @@ func (b *Backend) getAccountNonce(ctx context.Context, accAddr common.Address, p defer func() { evmtrace.EndSpanErr(span, err) }() queryClient := authtypes.NewQueryClient(b.ClientCtx) adr := sdk.AccAddress(accAddr.Bytes()).String() - ctx = types.ContextWithHeight(height, ctx) + ctx = types.ContextWithHeight(ctx, height) res, err := queryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: adr}) if err != nil { st, ok := status.FromError(err) @@ -184,7 +184,7 @@ func (b *Backend) ProcessBlock( targetOneFeeHistory.BlobGasUsedRatio = 0 if cfg.IsLondon(big.NewInt(blockHeight + 1)) { - ctx = types.ContextWithHeight(blockHeight, ctx) + ctx = types.ContextWithHeight(ctx, blockHeight) params, err := b.QueryClient.FeeMarket.Params(ctx, &feemarkettypes.QueryParamsRequest{}) if err != nil { return err diff --git a/rpc/types/block.go b/rpc/types/block.go index 8f4146f4f..b57e80a9f 100644 --- a/rpc/types/block.go +++ b/rpc/types/block.go @@ -48,21 +48,22 @@ func NewBlockNumber(n *big.Int) BlockNumber { return BlockNumber(n.Int64()) } -// ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is -// 0, it will return an empty context and the gRPC query will use the latest block height for querying. -// Note that all metadata is processed and removed by the CometBFT layer, so it won't be accessible at gRPC server level. -func ContextWithHeight(height int64, ctxs ...context.Context) context.Context { - var ctx context.Context - if len(ctxs) == 0 { - ctx = context.Background() - } else { - ctx = ctxs[0] +// ContextWithHeight wraps a context with the GRPCBlockHeightHeader set. +// If height == 0, the original context is returned unmodified. +func ContextWithHeight(ctx context.Context, height int64) context.Context { + if height == 0 { + return ctx } + return metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height)) +} +// NewContextWithHeight wraps a new background context with the gRPC block height header. If the provided height is +// 0, it will return an empty context and the gRPC query will use the latest block height for querying. +func NewContextWithHeight(height int64) context.Context { + ctx := context.Background() if height == 0 { return ctx } - return metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height)) } diff --git a/tests/integration/rpc/backend/test_backend_suite.go b/tests/integration/rpc/backend/test_backend_suite.go index 9d45db0ca..b4807f9c6 100644 --- a/tests/integration/rpc/backend/test_backend_suite.go +++ b/tests/integration/rpc/backend/test_backend_suite.go @@ -110,7 +110,7 @@ func (s *TestSuite) SetupTest() { // Ctx returns a context with height set for testing func (s *TestSuite) Ctx() context.Context { - return rpctypes.ContextWithHeight(1, context.Background()) + return rpctypes.NewContextWithHeight(1, context.Background()) } // buildEthereumTx returns an example legacy Ethereum transaction @@ -198,7 +198,7 @@ func (s *TestSuite) buildEthBlock( // 1) Gas limit from consensus params // if failed to query consensus params, default gasLimit is applied. - gasLimit, _ := rpctypes.BlockMaxGasFromConsensusParams(rpctypes.ContextWithHeight(cmtHeader.Height), s.backend.ClientCtx, cmtHeader.Height) + gasLimit, _ := rpctypes.BlockMaxGasFromConsensusParams(rpctypes.NewContextWithHeight(cmtHeader.Height), s.backend.ClientCtx, cmtHeader.Height) // 2) Miner from provided validator miner := common.BytesToAddress(validator.Bytes()) diff --git a/tests/integration/rpc/backend/test_client.go b/tests/integration/rpc/backend/test_client.go index f9af73be9..f6e21f904 100644 --- a/tests/integration/rpc/backend/test_client.go +++ b/tests/integration/rpc/backend/test_client.go @@ -40,17 +40,17 @@ var _ cmtrpcclient.Client = &mocks.Client{} func RegisterTxSearch(client *mocks.Client, query string, txBz []byte) { resulTxs := []*cmtrpctypes.ResultTx{{Tx: txBz}} - client.On("TxSearch", rpc.ContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). + client.On("TxSearch", rpc.NewContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). Return(&cmtrpctypes.ResultTxSearch{Txs: resulTxs, TotalCount: 1}, nil) } func RegisterTxSearchEmpty(client *mocks.Client, query string) { - client.On("TxSearch", rpc.ContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). + client.On("TxSearch", rpc.NewContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). Return(&cmtrpctypes.ResultTxSearch{}, nil) } func RegisterTxSearchError(client *mocks.Client, query string) { - client.On("TxSearch", rpc.ContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). + client.On("TxSearch", rpc.NewContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). Return(nil, errortypes.ErrInvalidRequest) } @@ -69,31 +69,31 @@ func RegisterBroadcastTxError(client *mocks.Client, tx types.Tx) { // Unconfirmed Transactions func RegisterUnconfirmedTxs(client *mocks.Client, limit *int, txs []types.Tx) { - client.On("UnconfirmedTxs", rpc.ContextWithHeight(1), limit). + client.On("UnconfirmedTxs", rpc.NewContextWithHeight(1), limit). Return(&cmtrpctypes.ResultUnconfirmedTxs{Txs: txs}, nil) } func RegisterUnconfirmedTxsEmpty(client *mocks.Client, limit *int) { - client.On("UnconfirmedTxs", rpc.ContextWithHeight(1), limit). + client.On("UnconfirmedTxs", rpc.NewContextWithHeight(1), limit). Return(&cmtrpctypes.ResultUnconfirmedTxs{ Txs: make([]types.Tx, 2), }, nil) } func RegisterUnconfirmedTxsError(client *mocks.Client, limit *int) { - client.On("UnconfirmedTxs", rpc.ContextWithHeight(1), limit). + client.On("UnconfirmedTxs", rpc.NewContextWithHeight(1), limit). Return(nil, errortypes.ErrInvalidRequest) } // Status func RegisterStatus(client *mocks.Client) { - client.On("Status", rpc.ContextWithHeight(1)). + client.On("Status", rpc.NewContextWithHeight(1)). Return(&cmtrpctypes.ResultStatus{}, nil) } func RegisterStatusError(client *mocks.Client) { - client.On("Status", rpc.ContextWithHeight(1)). + client.On("Status", rpc.NewContextWithHeight(1)). Return(nil, errortypes.ErrInvalidRequest) } @@ -107,7 +107,7 @@ func RegisterBlockMultipleTxs( block := types.MakeBlock(height, txs, nil, nil) block.ChainID = ChainID.ChainID resBlock := &cmtrpctypes.ResultBlock{Block: block} - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) return resBlock } @@ -121,7 +121,7 @@ func RegisterBlock( emptyBlock := types.MakeBlock(height, []types.Tx{}, nil, nil) emptyBlock.ChainID = ChainID.ChainID resBlock := &cmtrpctypes.ResultBlock{Block: emptyBlock} - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) return resBlock } @@ -129,14 +129,14 @@ func RegisterBlock( block := types.MakeBlock(height, []types.Tx{tx}, nil, nil) block.ChainID = ChainID.ChainID resBlock := &cmtrpctypes.ResultBlock{Block: block} - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) return resBlock } // Block returns error func RegisterBlockError(client *mocks.Client, height int64) { - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(nil, errortypes.ErrInvalidRequest) } @@ -146,7 +146,7 @@ func RegisterBlockNotFound( client *mocks.Client, height int64, ) *cmtrpctypes.ResultBlock { - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(&cmtrpctypes.ResultBlock{Block: nil}, nil) return &cmtrpctypes.ResultBlock{Block: nil} @@ -155,7 +155,7 @@ func RegisterBlockNotFound( // Block panic func RegisterBlockPanic(client *mocks.Client, height int64) { - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("Block", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(func(context.Context, *int64) *cmtrpctypes.ResultBlock { panic("Block call panic") }, nil) @@ -166,7 +166,7 @@ func TestRegisterBlock(t *testing.T) { height := rpc.BlockNumber(1).Int64() RegisterBlock(client, height, nil) - res, err := client.Block(rpc.ContextWithHeight(height), &height) + res, err := client.Block(rpc.NewContextWithHeight(height), &height) emptyBlock := types.MakeBlock(height, []types.Tx{}, nil, nil) emptyBlock.ChainID = ChainID.ChainID @@ -179,12 +179,12 @@ func TestRegisterBlock(t *testing.T) { func RegisterConsensusParams(client *mocks.Client, height int64) { consensusParams := types.DefaultConsensusParams() - client.On("ConsensusParams", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("ConsensusParams", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(&cmtrpctypes.ResultConsensusParams{ConsensusParams: *consensusParams}, nil) } func RegisterConsensusParamsError(client *mocks.Client, height int64) { - client.On("ConsensusParams", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("ConsensusParams", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(nil, errortypes.ErrInvalidRequest) } @@ -193,7 +193,7 @@ func TestRegisterConsensusParams(t *testing.T) { height := int64(1) RegisterConsensusParams(client, height) - res, err := client.ConsensusParams(rpc.ContextWithHeight(height), &height) + res, err := client.ConsensusParams(rpc.NewContextWithHeight(height), &height) consensusParams := types.DefaultConsensusParams() require.Equal(t, &cmtrpctypes.ResultConsensusParams{ConsensusParams: *consensusParams}, res) require.NoError(t, err) @@ -219,7 +219,7 @@ func RegisterBlockResultsWithEventLog(client *mocks.Client, height int64) (*cmtr {Code: 0, GasUsed: 0, Data: data}, }, } - client.On("BlockResults", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("BlockResults", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(res, nil) return res, nil } @@ -240,13 +240,13 @@ func RegisterBlockResultsWithTxs( Height: height, TxsResults: txsResults, } - client.On("BlockResults", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("BlockResults", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(res, nil) return res } func RegisterBlockResultsError(client *mocks.Client, height int64) { - client.On("BlockResults", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). + client.On("BlockResults", rpc.NewContextWithHeight(height), mock.AnythingOfType("*int64")). Return(nil, errortypes.ErrInvalidRequest) } @@ -255,7 +255,7 @@ func TestRegisterBlockResults(t *testing.T) { height := int64(1) RegisterBlockResults(client, height) - res, err := client.BlockResults(rpc.ContextWithHeight(height), &height) + res, err := client.BlockResults(rpc.NewContextWithHeight(height), &height) expRes := &cmtrpctypes.ResultBlockResults{ Height: height, TxsResults: []*abci.ExecTxResult{{Code: 0, GasUsed: 0}}, @@ -274,18 +274,18 @@ func RegisterBlockByHash( block := types.MakeBlock(1, []types.Tx{tx}, nil, nil) resBlock := &cmtrpctypes.ResultBlock{Block: block} - client.On("BlockByHash", rpc.ContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). + client.On("BlockByHash", rpc.NewContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(resBlock, nil) return resBlock } func RegisterBlockByHashError(client *mocks.Client, _ common.Hash, _ []byte) { - client.On("BlockByHash", rpc.ContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). + client.On("BlockByHash", rpc.NewContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(nil, errortypes.ErrInvalidRequest) } func RegisterBlockByHashNotFound(client *mocks.Client, _ common.Hash, _ []byte) { - client.On("BlockByHash", rpc.ContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). + client.On("BlockByHash", rpc.NewContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(nil, nil) } @@ -304,18 +304,18 @@ func RegisterHeaderByHash( Header: header, } - client.On("HeaderByHash", rpc.ContextWithHeight(1), bytes.HexBytes{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). + client.On("HeaderByHash", rpc.NewContextWithHeight(1), bytes.HexBytes{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(resHeader, nil) return resHeader } func RegisterHeaderByHashError(client *mocks.Client, _ common.Hash, _ []byte) { - client.On("HeaderByHash", rpc.ContextWithHeight(1), bytes.HexBytes{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). + client.On("HeaderByHash", rpc.NewContextWithHeight(1), bytes.HexBytes{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(nil, errortypes.ErrInvalidRequest) } func RegisterHeaderByHashNotFound(client *mocks.Client, hash common.Hash, tx []byte) { - client.On("HeaderByHash", rpc.ContextWithHeight(1), bytes.HexBytes(hash.Bytes())). + client.On("HeaderByHash", rpc.NewContextWithHeight(1), bytes.HexBytes(hash.Bytes())). Return(&coretypes.ResultHeader{Header: nil}, nil) } @@ -324,18 +324,18 @@ func RegisterHeaderByHashNotFound(client *mocks.Client, hash common.Hash, tx []b func RegisterHeader(client *mocks.Client, height *int64, tx []byte) *coretypes.ResultHeader { block := types.MakeBlock(*height, []types.Tx{tx}, nil, nil) resHeader := &coretypes.ResultHeader{Header: &block.Header} - client.On("Header", rpc.ContextWithHeight(*height), mock.AnythingOfType("*int64")).Return(resHeader, nil) + client.On("Header", rpc.NewContextWithHeight(*height), mock.AnythingOfType("*int64")).Return(resHeader, nil) return resHeader } func RegisterHeaderError(client *mocks.Client, height *int64) { - client.On("Header", rpc.ContextWithHeight(*height), height).Return(nil, errortypes.ErrInvalidRequest) + client.On("Header", rpc.NewContextWithHeight(*height), height).Return(nil, errortypes.ErrInvalidRequest) } // Header not found func RegisterHeaderNotFound(client *mocks.Client, height int64) { - client.On("Header", rpc.ContextWithHeight(height), mock.MatchedBy(func(arg *int64) bool { + client.On("Header", rpc.NewContextWithHeight(height), mock.MatchedBy(func(arg *int64) bool { return arg != nil && height == *arg })).Return(&coretypes.ResultHeader{Header: nil}, nil) } diff --git a/tests/integration/rpc/backend/test_evm_query_client.go b/tests/integration/rpc/backend/test_evm_query_client.go index be7f1ed9a..b93f63dba 100644 --- a/tests/integration/rpc/backend/test_evm_query_client.go +++ b/tests/integration/rpc/backend/test_evm_query_client.go @@ -55,57 +55,57 @@ var _ evmtypes.QueryClient = &mocks.EVMQueryClient{} // TraceTransaction func RegisterTraceTransactionWithPredecessors(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx, predecessors []*evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceTx", rpc.ContextWithHeight(1), + queryClient.On("TraceTx", rpc.NewContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: predecessors, ChainId: int64(constants.ExampleChainID.EVMChainID), BlockMaxGas: -1})). //nolint:gosec // G115 Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil) } func RegisterTraceTransaction(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceTx", rpc.ContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: int64(constants.ExampleChainID.EVMChainID), BlockMaxGas: -1})). //nolint:gosec // G115 - Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil) + queryClient.On("TraceTx", rpc.NewContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: int64(constants.ExampleChainID.EVMChainID), BlockMaxGas: -1})). //nolint:gosec // G115 + Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil) } func RegisterTraceTransactionError(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) { - queryClient.On("TraceTx", rpc.ContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: int64(constants.ExampleChainID.EVMChainID)})). //nolint:gosec // G115 - Return(nil, errortypes.ErrInvalidRequest) + queryClient.On("TraceTx", rpc.NewContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: int64(constants.ExampleChainID.EVMChainID)})). //nolint:gosec // G115 + Return(nil, errortypes.ErrInvalidRequest) } // TraceBlock func RegisterTraceBlock(queryClient *mocks.EVMQueryClient, txs []*evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceBlock", rpc.ContextWithHeight(1), + queryClient.On("TraceBlock", rpc.NewContextWithHeight(1), MatchByProto(&evmtypes.QueryTraceBlockRequest{Txs: txs, BlockNumber: 1, TraceConfig: &evmtypes.TraceConfig{}, ChainId: int64(constants.ExampleChainID.EVMChainID), BlockMaxGas: -1})). //nolint:gosec // G115 Return(&evmtypes.QueryTraceBlockResponse{Data: data}, nil) } func RegisterTraceBlockError(queryClient *mocks.EVMQueryClient) { - queryClient.On("TraceBlock", rpc.ContextWithHeight(1), &evmtypes.QueryTraceBlockRequest{}). + queryClient.On("TraceBlock", rpc.NewContextWithHeight(1), &evmtypes.QueryTraceBlockRequest{}). Return(nil, errortypes.ErrInvalidRequest) } // TraceCall func RegisterTraceCall(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x22, 0x7d} // {"test": "trace_call"} - queryClient.On("TraceCall", rpc.ContextWithHeight(1), mock.AnythingOfType("*types.QueryTraceCallRequest")). + queryClient.On("TraceCall", rpc.NewContextWithHeight(1), mock.AnythingOfType("*types.QueryTraceCallRequest")). Return(&evmtypes.QueryTraceCallResponse{Data: data}, nil) } func RegisterTraceCallWithTracer(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx, tracer string) { data := []byte{0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x43, 0x41, 0x4c, 0x4c, 0x22, 0x7d} // {"type": "CALL"} - queryClient.On("TraceCall", rpc.ContextWithHeight(1), mock.MatchedBy(func(req *evmtypes.QueryTraceCallRequest) bool { + queryClient.On("TraceCall", rpc.NewContextWithHeight(1), mock.MatchedBy(func(req *evmtypes.QueryTraceCallRequest) bool { return req.TraceConfig != nil && req.TraceConfig.Tracer == tracer })).Return(&evmtypes.QueryTraceCallResponse{Data: data}, nil) } func RegisterTraceCallError(queryClient *mocks.EVMQueryClient) { - queryClient.On("TraceCall", rpc.ContextWithHeight(1), mock.AnythingOfType("*types.QueryTraceCallRequest")). + queryClient.On("TraceCall", rpc.NewContextWithHeight(1), mock.AnythingOfType("*types.QueryTraceCallRequest")). Return(nil, errortypes.ErrInvalidRequest) } // Params func RegisterParams(queryClient *mocks.EVMQueryClient, header *metadata.MD, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). Return(&evmtypes.QueryParamsResponse{}, nil). Run(func(args mock.Arguments) { // If Params call is successful, also update the header height @@ -117,12 +117,12 @@ func RegisterParams(queryClient *mocks.EVMQueryClient, header *metadata.MD, heig } func RegisterParamsWithoutHeader(queryClient *mocks.EVMQueryClient, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}). Return(&evmtypes.QueryParamsResponse{Params: evmtypes.DefaultParams()}, nil) } func RegisterParamsInvalidHeader(queryClient *mocks.EVMQueryClient, header *metadata.MD, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). Return(&evmtypes.QueryParamsResponse{}, nil). Run(func(args mock.Arguments) { // If Params call is successful, also update the header height @@ -133,7 +133,7 @@ func RegisterParamsInvalidHeader(queryClient *mocks.EVMQueryClient, header *meta } func RegisterParamsInvalidHeight(queryClient *mocks.EVMQueryClient, header *metadata.MD, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). Return(&evmtypes.QueryParamsResponse{}, nil). Run(func(args mock.Arguments) { // If Params call is successful, also update the header height @@ -145,13 +145,13 @@ func RegisterParamsInvalidHeight(queryClient *mocks.EVMQueryClient, header *meta } func RegisterParamsWithoutHeaderError(queryClient *mocks.EVMQueryClient, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}). Return(nil, errortypes.ErrInvalidRequest) } // Params returns error func RegisterParamsError(queryClient *mocks.EVMQueryClient, header *metadata.MD, height int64) { - queryClient.On("Params", rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). + queryClient.On("Params", rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(header)). Return(nil, errortypes.ErrInvalidRequest) } @@ -162,7 +162,7 @@ func TestRegisterParams(t *testing.T) { height := int64(1) RegisterParams(queryClient, &header, height) - _, err := queryClient.Params(rpc.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) + _, err := queryClient.Params(rpc.NewContextWithHeight(height), &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) require.NoError(t, err) blockHeightHeader := header.Get(grpctypes.GRPCBlockHeightHeader) headerHeight, err := strconv.ParseInt(blockHeightHeader[0], 10, 64) @@ -173,19 +173,19 @@ func TestRegisterParams(t *testing.T) { func TestRegisterParamsError(t *testing.T) { queryClient := mocks.NewEVMQueryClient(t) RegisterBaseFeeError(queryClient) - _, err := queryClient.BaseFee(rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) + _, err := queryClient.BaseFee(rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) require.Error(t, err) } // ETH Call func RegisterEthCall(queryClient *mocks.EVMQueryClient, request *evmtypes.EthCallRequest) { - ctx, _ := context.WithCancel(rpc.ContextWithHeight(1)) //nolint + ctx, _ := context.WithCancel(rpc.NewContextWithHeight(1)) //nolint queryClient.On("EthCall", ctx, request). Return(&evmtypes.MsgEthereumTxResponse{}, nil) } func RegisterEthCallError(queryClient *mocks.EVMQueryClient, request *evmtypes.EthCallRequest) { - ctx, _ := context.WithCancel(rpc.ContextWithHeight(1)) //nolint + ctx, _ := context.WithCancel(rpc.NewContextWithHeight(1)) //nolint queryClient.On("EthCall", ctx, request). Return(nil, errortypes.ErrInvalidRequest) } @@ -193,35 +193,35 @@ func RegisterEthCallError(queryClient *mocks.EVMQueryClient, request *evmtypes.E // Estimate Gas func RegisterEstimateGas(queryClient *mocks.EVMQueryClient, args evmtypes.TransactionArgs) { bz, _ := json.Marshal(args) - queryClient.On("EstimateGas", rpc.ContextWithHeight(1), &evmtypes.EthCallRequest{Args: bz, ChainId: args.ChainID.ToInt().Int64()}). + queryClient.On("EstimateGas", rpc.NewContextWithHeight(1), &evmtypes.EthCallRequest{Args: bz, ChainId: args.ChainID.ToInt().Int64()}). Return(&evmtypes.EstimateGasResponse{Gas: 21000}, nil) } func RegisterEstimateGasError(queryClient *mocks.EVMQueryClient, req *evmtypes.EthCallRequest) { - queryClient.On("EstimateGas", rpc.ContextWithHeight(1), req). + queryClient.On("EstimateGas", rpc.NewContextWithHeight(1), req). Return(nil, errortypes.ErrInvalidRequest) } func RegisterEstimateGasWithOverrides(queryClient *mocks.EVMQueryClient, req *evmtypes.EthCallRequest) { - queryClient.On("EstimateGas", rpc.ContextWithHeight(1), req). + queryClient.On("EstimateGas", rpc.NewContextWithHeight(1), req). Return(&evmtypes.EstimateGasResponse{Gas: 21000}, nil) } // BaseFee func RegisterBaseFee(queryClient *mocks.EVMQueryClient, baseFee math.Int) { - queryClient.On("BaseFee", rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). + queryClient.On("BaseFee", rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). Return(&evmtypes.QueryBaseFeeResponse{BaseFee: &baseFee}, nil) } // Base fee returns error func RegisterBaseFeeError(queryClient *mocks.EVMQueryClient) { - queryClient.On("BaseFee", rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). + queryClient.On("BaseFee", rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). Return(&evmtypes.QueryBaseFeeResponse{}, evmtypes.ErrInvalidBaseFee) } // Base fee not enabled func RegisterBaseFeeDisabled(queryClient *mocks.EVMQueryClient) { - queryClient.On("BaseFee", rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). + queryClient.On("BaseFee", rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}). Return(&evmtypes.QueryBaseFeeResponse{}, nil) } @@ -229,7 +229,7 @@ func TestRegisterBaseFee(t *testing.T) { baseFee := math.NewInt(1) queryClient := mocks.NewEVMQueryClient(t) RegisterBaseFee(queryClient, baseFee) - res, err := queryClient.BaseFee(rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) + res, err := queryClient.BaseFee(rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) require.Equal(t, &evmtypes.QueryBaseFeeResponse{BaseFee: &baseFee}, res) require.NoError(t, err) } @@ -237,7 +237,7 @@ func TestRegisterBaseFee(t *testing.T) { func TestRegisterBaseFeeError(t *testing.T) { queryClient := mocks.NewEVMQueryClient(t) RegisterBaseFeeError(queryClient) - res, err := queryClient.BaseFee(rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) + res, err := queryClient.BaseFee(rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) require.Equal(t, &evmtypes.QueryBaseFeeResponse{}, res) require.Error(t, err) } @@ -245,19 +245,19 @@ func TestRegisterBaseFeeError(t *testing.T) { func TestRegisterBaseFeeDisabled(t *testing.T) { queryClient := mocks.NewEVMQueryClient(t) RegisterBaseFeeDisabled(queryClient) - res, err := queryClient.BaseFee(rpc.ContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) + res, err := queryClient.BaseFee(rpc.NewContextWithHeight(1), &evmtypes.QueryBaseFeeRequest{}) require.Equal(t, &evmtypes.QueryBaseFeeResponse{}, res) require.NoError(t, err) } // ValidatorAccount func RegisterValidatorAccount(queryClient *mocks.EVMQueryClient, validator sdk.AccAddress) { - queryClient.On("ValidatorAccount", rpc.ContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}). + queryClient.On("ValidatorAccount", rpc.NewContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}). Return(&evmtypes.QueryValidatorAccountResponse{AccountAddress: validator.String()}, nil) } func RegisterValidatorAccountError(queryClient *mocks.EVMQueryClient) { - queryClient.On("ValidatorAccount", rpc.ContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}). + queryClient.On("ValidatorAccount", rpc.NewContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}). Return(nil, status.Error(codes.InvalidArgument, "empty request")) } @@ -266,35 +266,35 @@ func TestRegisterValidatorAccount(t *testing.T) { validator := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) RegisterValidatorAccount(queryClient, validator) - res, err := queryClient.ValidatorAccount(rpc.ContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}) + res, err := queryClient.ValidatorAccount(rpc.NewContextWithHeight(1), &evmtypes.QueryValidatorAccountRequest{}) require.Equal(t, &evmtypes.QueryValidatorAccountResponse{AccountAddress: validator.String()}, res) require.NoError(t, err) } // Code func RegisterCode(queryClient *mocks.EVMQueryClient, addr common.Address, code []byte) { - queryClient.On("Code", rpc.ContextWithHeight(1), &evmtypes.QueryCodeRequest{Address: addr.String()}). + queryClient.On("Code", rpc.NewContextWithHeight(1), &evmtypes.QueryCodeRequest{Address: addr.String()}). Return(&evmtypes.QueryCodeResponse{Code: code}, nil) } func RegisterCodeError(queryClient *mocks.EVMQueryClient, addr common.Address) { - queryClient.On("Code", rpc.ContextWithHeight(1), &evmtypes.QueryCodeRequest{Address: addr.String()}). + queryClient.On("Code", rpc.NewContextWithHeight(1), &evmtypes.QueryCodeRequest{Address: addr.String()}). Return(nil, errortypes.ErrInvalidRequest) } // Storage func RegisterStorageAt(queryClient *mocks.EVMQueryClient, addr common.Address, key string, storage string) { - queryClient.On("Storage", rpc.ContextWithHeight(1), &evmtypes.QueryStorageRequest{Address: addr.String(), Key: key}). + queryClient.On("Storage", rpc.NewContextWithHeight(1), &evmtypes.QueryStorageRequest{Address: addr.String(), Key: key}). Return(&evmtypes.QueryStorageResponse{Value: storage}, nil) } func RegisterStorageAtError(queryClient *mocks.EVMQueryClient, addr common.Address, key string) { - queryClient.On("Storage", rpc.ContextWithHeight(1), &evmtypes.QueryStorageRequest{Address: addr.String(), Key: key}). + queryClient.On("Storage", rpc.NewContextWithHeight(1), &evmtypes.QueryStorageRequest{Address: addr.String(), Key: key}). Return(nil, errortypes.ErrInvalidRequest) } func RegisterAccount(queryClient *mocks.EVMQueryClient, addr common.Address, height int64) { - queryClient.On("Account", rpc.ContextWithHeight(height), &evmtypes.QueryAccountRequest{Address: addr.String()}). + queryClient.On("Account", rpc.NewContextWithHeight(height), &evmtypes.QueryAccountRequest{Address: addr.String()}). Return(&evmtypes.QueryAccountResponse{ Balance: "0", CodeHash: "", @@ -306,27 +306,27 @@ func RegisterAccount(queryClient *mocks.EVMQueryClient, addr common.Address, hei // Balance func RegisterBalance(queryClient *mocks.EVMQueryClient, addr common.Address, height int64) { - queryClient.On("Balance", rpc.ContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). + queryClient.On("Balance", rpc.NewContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). Return(&evmtypes.QueryBalanceResponse{Balance: "1"}, nil) } func RegisterBalanceInvalid(queryClient *mocks.EVMQueryClient, addr common.Address, height int64) { - queryClient.On("Balance", rpc.ContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). + queryClient.On("Balance", rpc.NewContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). Return(&evmtypes.QueryBalanceResponse{Balance: "invalid"}, nil) } func RegisterBalanceNegative(queryClient *mocks.EVMQueryClient, addr common.Address, height int64) { - queryClient.On("Balance", rpc.ContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). + queryClient.On("Balance", rpc.NewContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). Return(&evmtypes.QueryBalanceResponse{Balance: "-1"}, nil) } func RegisterBalanceError(queryClient *mocks.EVMQueryClient, addr common.Address, height int64) { - queryClient.On("Balance", rpc.ContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). + queryClient.On("Balance", rpc.NewContextWithHeight(height), &evmtypes.QueryBalanceRequest{Address: addr.String()}). Return(nil, errortypes.ErrInvalidRequest) } // GlobalMinGasPrice func RegisterGlobalMinGasPrice(queryClient *mocks.EVMQueryClient, height int64) { - queryClient.On("GlobalMinGasPrice", rpc.ContextWithHeight(height), &evmtypes.QueryGlobalMinGasPriceRequest{}). + queryClient.On("GlobalMinGasPrice", rpc.NewContextWithHeight(height), &evmtypes.QueryGlobalMinGasPriceRequest{}). Return(&evmtypes.QueryGlobalMinGasPriceResponse{MinGasPrice: math.OneInt()}, nil) } diff --git a/tests/integration/rpc/backend/test_feemarket_query_client.go b/tests/integration/rpc/backend/test_feemarket_query_client.go index 47e961ac3..352cbd432 100644 --- a/tests/integration/rpc/backend/test_feemarket_query_client.go +++ b/tests/integration/rpc/backend/test_feemarket_query_client.go @@ -12,11 +12,11 @@ var _ feemarkettypes.QueryClient = &mocks.FeeMarketQueryClient{} // Params func RegisterFeeMarketParams(feeMarketClient *mocks.FeeMarketQueryClient, height int64) { - feeMarketClient.On("Params", rpc.ContextWithHeight(height), &feemarkettypes.QueryParamsRequest{}). + feeMarketClient.On("Params", rpc.NewContextWithHeight(height), &feemarkettypes.QueryParamsRequest{}). Return(&feemarkettypes.QueryParamsResponse{Params: feemarkettypes.DefaultParams()}, nil) } func RegisterFeeMarketParamsError(feeMarketClient *mocks.FeeMarketQueryClient, height int64) { - feeMarketClient.On("Params", rpc.ContextWithHeight(height), &feemarkettypes.QueryParamsRequest{}). + feeMarketClient.On("Params", rpc.NewContextWithHeight(height), &feemarkettypes.QueryParamsRequest{}). Return(nil, sdkerrors.ErrInvalidRequest) } diff --git a/x/vm/client/cli/query.go b/x/vm/client/cli/query.go index e3ecc752b..8395e444b 100644 --- a/x/vm/client/cli/query.go +++ b/x/vm/client/cli/query.go @@ -70,7 +70,7 @@ func GetStorageCmd() *cobra.Command { Key: key, } - res, err := queryClient.Storage(rpctypes.ContextWithHeight(clientCtx.Height), req) + res, err := queryClient.Storage(rpctypes.NewContextWithHeight(clientCtx.Height), req) if err != nil { return err } @@ -107,7 +107,7 @@ func GetCodeCmd() *cobra.Command { Address: address, } - res, err := queryClient.Code(rpctypes.ContextWithHeight(clientCtx.Height), req) + res, err := queryClient.Code(rpctypes.NewContextWithHeight(clientCtx.Height), req) if err != nil { return err } @@ -144,7 +144,7 @@ func GetAccountCmd() *cobra.Command { Address: address, } - res, err := queryClient.Account(rpctypes.ContextWithHeight(clientCtx.Height), req) + res, err := queryClient.Account(rpctypes.NewContextWithHeight(clientCtx.Height), req) if err != nil { return err } From f66f004941339ee4d33257f7f6fc73e91ebdb216 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:10:53 -0800 Subject: [PATCH 14/14] fix --- tests/integration/rpc/backend/test_backend_suite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/rpc/backend/test_backend_suite.go b/tests/integration/rpc/backend/test_backend_suite.go index b4807f9c6..c204faa8c 100644 --- a/tests/integration/rpc/backend/test_backend_suite.go +++ b/tests/integration/rpc/backend/test_backend_suite.go @@ -110,7 +110,7 @@ func (s *TestSuite) SetupTest() { // Ctx returns a context with height set for testing func (s *TestSuite) Ctx() context.Context { - return rpctypes.NewContextWithHeight(1, context.Background()) + return rpctypes.NewContextWithHeight(1) } // buildEthereumTx returns an example legacy Ethereum transaction