Add eth_capabilities method for routing capability discovery#755
Add eth_capabilities method for routing capability discovery#755Termina1 wants to merge 4 commits intoethereum:mainfrom
Conversation
|
IMO this should be under the |
I generally agree, just wanted to be more cautious. Solana, for example, has method getfirstavailableblock. If nobody sees any downsides, I can change the namespace to eth. |
I would propose blocks, receipts, tx, state, trienodes. Receipts as parent types of logs might make more sense here. I assume pruning behavior is at receipt level rather than log level in most clients. Also proposing addition of trienodes for eth_getProof. It will become more normal for clients to have a window of proof data. |
|
I am not 100% sure but for some clients receipts are basically logs + transactions setting, but I may be wrong |
|
I updated the spec, but moved to eth_ and added trienodes and kept receipts and logs both, so to not depend on client implementation of pruning |
|
I don't think this API is viable for a few reasons:
I could see this being somewhat useful for aload balancer, like eRPC, to call the node and make note of its specific capabilities but exposing it back to end users on the eth namespace doesn't make as much sense to me. If you run your own node you know its capabilities, if you're not running your own node, you're likely going through some load balancing system anyway that would/could/should abstract the capabilities of the backend nodes anyway. |
The response will be that they support the full range for all data models. As for the CLI flags I think they can return empty simply. It can still be a valid response. Would you say that still causes issues if they return such a blanket response? |
|
It might be OK if the spec is written in a way that returning config is optional, and RPC providers can more or less hardcode a generic response to the API. It would have to be scoped in a way on every client that it would only expose certain flags and not sensitive information (secrets, paths, etc.) that you might find in a cli flag. Also, some configs are done via TOML or ENV. I do see the value in the use case DRPC has here, I'm mostly just questioning its necessity. Writing tests would be challenging with the current setup, but we could just ignore the config flags. Honestly, I'd probably just remove the config part entirely, and focus on the effective retention policy. |
Nothing against that from my side |
|
@s1na @MysticRyuujin what do you think if we move the config part to the admin namespace? I think it's actually very important for whoever wants to build something akin to dRPC (like any service that wants to redistribute traffic to other providers' nodes). |
|
I do not have any serious objections to an admin namespace defined method that can return node configuration. With that said I think you're going to have one heck of an uphill battle getting all the clients to implement such a thing.
Then there's the problem of exposing the admin namespace publicly to begin with, you're asking decentralized nodes to allow you to call |
|
Ok, thanks for the input. I will at least update the spec to exclude the config from eth namespace. |
|
Removed the |
|
Question re |
|
Yeah, One thing though — in production we observe cases where pruning is non-linear, e.g. on Arbitrum nodes there are gaps in tx data rather than a clean cutoff. But I think that's an edge case we can ignore for now and keep it simple with a single |
|
Comments from discussion on the RPC call:
And a proposal came up during the call to do this in shape of a subscription. I.e. the node will keep notifying the node whenever the block ranges it persists changes. It means that for data resources with a window retention strategy the consumer will get an update on every block that the block window has shifted. The goal would be to avoid returning the strategy type and only block range info. What do you think of this idea as the OG author @Termina1? |
|
Renamed Re subscription idea — sounds good, could be a separate |
Summary
Add a new public-facing capability discovery method,
eth_capabilities, to the OpenRPC spec, plus schemas and happy-path.iofixtures.etheth_capabilities[]{ config, effective }Motivation
We (dRPC, drpc.org) operate an RPC marketplace/router and route traffic across many independent node operators. A recurring operational problem is that an RPC endpoint typically does not tell you what historical data it actually has (state at old blocks, tx/receipt lookup depth, log search range, block data, proof-related trie node availability).
Today we approximate this via heuristics and active probing. Probing is expensive and still often wrong, causing misrouting and retries.
Background discussion + example response (discussion with the geth team):
ethereum/go-ethereum#33828
Proposal
eth_capabilitiesreturns:config (client-specific snapshot)
configis intentionally client-specific and generic: a map of sections to arbitrary objects. This keeps the spec from standardizing per-client flags/settings while still allowing operators to expose useful config context for observability.effective (routing-focused)
effectiveis strict and intended for routing decisions. It contains:state: historical account/storage state availability.tx: historical transaction lookup availability.logs: log-indexed search/filter availability.receipts: receipt lookup availability (tx/block receipt data).blocks: historical block/header/body availability.trienodes: proof/trie-node availability (e.g.eth_getProofdepth window).Each resource has:
disabled(boolean)oldestBlock(hex quantity; earliest block expected to be served correctly)deleteStrategy:nonewindow+retentionBlocks(integer)Routers should use
effective. If the method is unavailable or access is restricted, routers should treat capabilities as unknown and fall back to existing behavior.Exposure
This method is in
eth_*because capability discovery is useful to public API consumers and routing layers. Operators can still gate access or serve gateway-level aggregated capabilities where applicable.Scope / Compatibility
execution-apis(OpenRPC). Client implementations are out of scope.Validation
make buildmake test(all passing)