Description
eth_baseFee is an Avalanche C-Chain JSON-RPC extension (Avalanche Builder Hub docs) for reading the base fee of the next block. Calling it through a nodecore instance configured with an avalanche/avalanche-fuji upstream returns:
{"jsonrpc":"2.0","error":{"code":-32601,"message":"the method eth_baseFee does not exist/is not available"},"id":...}
with a response-provider: NoUpstream response header — even though every configured upstream answers the same call correctly when hit directly:
$ curl -s https://api.avax-test.network/ext/bc/C/rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_baseFee","params":[],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0xa"}
$ curl -s https://avalanche-fuji-c-chain-rpc.publicnode.com \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_baseFee","params":[],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0xa"}
Root cause (confirmed by reading nodecore's source, drpcorg/nodecore @ tag 1.13.0)
nodecore's MethodMatcher (internal/upstreams/flow/matchers.go) only routes a call to an upstream if the method is present in the chain's method spec, resolved via specs.GetSpecMethodsByConnectors(methodSpecName, ...) from this repo. Avalanche's entry in chains.yaml is:
- id: avalanche
label: Avalanche
type: eth
settings:
expected-block-time: 2s
...
There's no method-spec override, so it falls back to the bare eth spec, which has no knowledge of eth_baseFee (an Avalanche-only extension).
This is exactly the situation method-spec overrides exist to solve, and ~18 other EVM chains already use this pattern for their own vendor-specific extension methods. The closest analog is fantom:
- id: fantom
...
settings:
method-spec: "fantom"
whose fantom.json does "spec-imports": ["eth"] and adds ftm_effectiveBaseFee — Fantom's own base-fee extension, functionally identical to what Avalanche needs for eth_baseFee. Avalanche was simply never given the equivalent spec file, so it inherits only the generic eth method set that every other plain EVM chain gets.
Proposed fix
Opening a PR that:
- adds
pkg/methods/specs/avalanche.json (imports eth, adds eth_baseFee as a non-cacheable method — it reflects the next block, so it must never be cached)
- sets
method-spec: "avalanche" on Avalanche's chains.yaml entry
- updates
docs/method-specs.md's spec table
- adds a
TestAvalancheSpecLoads test
mirroring the fantom pattern exactly.
Workaround in the meantime
nodecore's per-upstream methods.enable config (documented in nodecore's docs/nodecore/05-upstream-config.md) already provides an immediate workaround without needing this repo changed, e.g.:
methods:
enable: [eth_baseFee]
on the avalanche upstream config. This repo-level fix removes the need for that override and matches how every other chain with its own extension methods is already handled.
Environment
- nodecore version:
1.13.0
- Chain:
avalanche / avalanche-fuji (Avalanche C-Chain)
- Connector type:
json-rpc
Description
eth_baseFeeis an Avalanche C-Chain JSON-RPC extension (Avalanche Builder Hub docs) for reading the base fee of the next block. Calling it through a nodecore instance configured with anavalanche/avalanche-fujiupstream returns:{"jsonrpc":"2.0","error":{"code":-32601,"message":"the method eth_baseFee does not exist/is not available"},"id":...}with a
response-provider: NoUpstreamresponse header — even though every configured upstream answers the same call correctly when hit directly:$ curl -s https://api.avax-test.network/ext/bc/C/rpc \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_baseFee","params":[],"id":1}' {"jsonrpc":"2.0","id":1,"result":"0xa"} $ curl -s https://avalanche-fuji-c-chain-rpc.publicnode.com \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_baseFee","params":[],"id":1}' {"jsonrpc":"2.0","id":1,"result":"0xa"}Root cause (confirmed by reading nodecore's source,
drpcorg/nodecore@ tag1.13.0)nodecore's
MethodMatcher(internal/upstreams/flow/matchers.go) only routes a call to an upstream if the method is present in the chain's method spec, resolved viaspecs.GetSpecMethodsByConnectors(methodSpecName, ...)from this repo. Avalanche's entry inchains.yamlis:There's no
method-specoverride, so it falls back to the bareethspec, which has no knowledge ofeth_baseFee(an Avalanche-only extension).This is exactly the situation
method-specoverrides exist to solve, and ~18 other EVM chains already use this pattern for their own vendor-specific extension methods. The closest analog isfantom:whose
fantom.jsondoes"spec-imports": ["eth"]and addsftm_effectiveBaseFee— Fantom's own base-fee extension, functionally identical to what Avalanche needs foreth_baseFee. Avalanche was simply never given the equivalent spec file, so it inherits only the genericethmethod set that every other plain EVM chain gets.Proposed fix
Opening a PR that:
pkg/methods/specs/avalanche.json(importseth, addseth_baseFeeas a non-cacheable method — it reflects the next block, so it must never be cached)method-spec: "avalanche"on Avalanche'schains.yamlentrydocs/method-specs.md's spec tableTestAvalancheSpecLoadstestmirroring the
fantompattern exactly.Workaround in the meantime
nodecore's per-upstream
methods.enableconfig (documented in nodecore'sdocs/nodecore/05-upstream-config.md) already provides an immediate workaround without needing this repo changed, e.g.:on the avalanche upstream config. This repo-level fix removes the need for that override and matches how every other chain with its own extension methods is already handled.
Environment
1.13.0avalanche/avalanche-fuji(Avalanche C-Chain)json-rpc