Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/eth/capabilities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
- name: eth_capabilities
summary: Returns effective capabilities for routing decisions.
description: |
Returns information about the data available on this node, including the
current head block and retention policies for each resource type. This is
useful for RPC routers to determine which historical queries a node can serve.
params: []
result:
name: Capabilities
schema:
$ref: '#/components/schemas/EthCapabilities'
examples:
- name: eth_capabilities example
params: []
result:
name: Capabilities
value:
head:
blockNumber: '0x13f8e3a'
blockHash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3'
state:
disabled: false
oldestBlock: '0x12ab34'
deleteStrategy:
type: window
retentionBlocks: 90000
tx:
disabled: false
oldestBlock: '0xf00aa'
deleteStrategy:
type: window
retentionBlocks: 2350000
logs:
disabled: false
oldestBlock: '0xf00aa'
deleteStrategy:
type: window
retentionBlocks: 2350000
receipts:
disabled: false
oldestBlock: '0xf00aa'
deleteStrategy:
type: window
retentionBlocks: 2350000
blocks:
disabled: false
oldestBlock: '0x0'
deleteStrategy:
type: none
stateproofs:
disabled: false
oldestBlock: '0x120000'
deleteStrategy:
type: window
retentionBlocks: 90000
95 changes: 95 additions & 0 deletions src/schemas/capabilities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
EthCapabilities:
title: Effective routing capabilities
description: Describes the data available on the node. Each resource reports the oldest available block and the deletion strategy, allowing RPC routers to determine which historical queries a node can serve.
type: object
additionalProperties: false
required:
- head
- state
- tx
- logs
- receipts
- blocks
- stateproofs
properties:
head:
title: Current head block
description: The latest block known to the node, useful for determining sync status.
$ref: '#/components/schemas/EthCapabilitiesHead'
state:
description: "Account and contract state including balances, nonces, code, and storage. Determines the available range for historical state queries. Affects: eth_getBalance, eth_getCode, eth_getStorageAt, eth_getTransactionCount, eth_call, eth_estimateGas, eth_createAccessList."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'
tx:
description: "Transaction data and lookup indices. Determines the available range for transaction lookups by hash or block position. Affects: eth_getTransactionByHash, eth_getTransactionByBlockHashAndIndex, eth_getTransactionByBlockNumberAndIndex."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'
logs:
description: "Event logs emitted by smart contracts. Determines the available block range for log queries and filters. Affects: eth_getLogs, eth_getFilterLogs, eth_getFilterChanges, eth_newFilter."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'
receipts:
description: "Transaction execution receipts including status, gas used, and logs bloom. Determines the available range for receipt lookups. Affects: eth_getTransactionReceipt, eth_getBlockReceipts."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'
blocks:
description: "Block headers and bodies including transactions and uncles. Determines the available range for block retrieval. Affects: eth_getBlockByHash, eth_getBlockByNumber, eth_getBlockTransactionCountByHash, eth_getBlockTransactionCountByNumber, eth_getUncleCountByBlockHash, eth_getUncleCountByBlockNumber."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'
stateproofs:
description: "Merkle proofs for account and storage state. Determines the available range for proof generation. Affects: eth_getProof."
$ref: '#/components/schemas/EthCapabilitiesEffectiveResource'

EthCapabilitiesEffectiveResource:
title: Effective resource capability
type: object
additionalProperties: false
required:
- disabled
- oldestBlock
- deleteStrategy
properties:
disabled:
type: boolean
oldestBlock:
$ref: '#/components/schemas/uint'
deleteStrategy:
$ref: '#/components/schemas/EthCapabilitiesDeleteStrategy'

EthCapabilitiesHead:
title: Current head block
type: object
additionalProperties: false
required:
- blockNumber
- blockHash
properties:
blockNumber:
title: Head block number
$ref: '#/components/schemas/uint'
blockHash:
title: Head block hash
$ref: '#/components/schemas/hash32'

EthCapabilitiesDeleteStrategy:
title: Delete strategy
oneOf:
- title: No deletion
type: object
additionalProperties: false
required:
- type
properties:
type:
type: string
enum:
- none
- title: Sliding window deletion
type: object
additionalProperties: false
required:
- type
- retentionBlocks
properties:
type:
type: string
enum:
- window
retentionBlocks:
type: integer
minimum: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Returns effective capabilities when state proofs are unavailable.
>> {"jsonrpc":"2.0","id":1,"method":"eth_capabilities"}
<< {"jsonrpc":"2.0","id":1,"result":{"head":{"blockNumber":"0x13f8e3a","blockHash":"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"},"state":{"disabled":false,"oldestBlock":"0x1a2b3c","deleteStrategy":{"type":"window","retentionBlocks":50000}},"tx":{"disabled":false,"oldestBlock":"0x10203","deleteStrategy":{"type":"window","retentionBlocks":1200000}},"logs":{"disabled":false,"oldestBlock":"0x10203","deleteStrategy":{"type":"window","retentionBlocks":1200000}},"receipts":{"disabled":false,"oldestBlock":"0x10203","deleteStrategy":{"type":"window","retentionBlocks":1200000}},"blocks":{"disabled":false,"oldestBlock":"0x0","deleteStrategy":{"type":"none"}},"stateproofs":{"disabled":true,"oldestBlock":"0x0","deleteStrategy":{"type":"none"}}}}
3 changes: 3 additions & 0 deletions tests/eth_capabilities/get-capabilities.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Returns effective routing capabilities.
>> {"jsonrpc":"2.0","id":1,"method":"eth_capabilities"}
<< {"jsonrpc":"2.0","id":1,"result":{"head":{"blockNumber":"0x13f8e3a","blockHash":"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"},"state":{"disabled":false,"oldestBlock":"0x12ab34","deleteStrategy":{"type":"window","retentionBlocks":90000}},"tx":{"disabled":false,"oldestBlock":"0xf00aa","deleteStrategy":{"type":"window","retentionBlocks":2350000}},"logs":{"disabled":false,"oldestBlock":"0xf00aa","deleteStrategy":{"type":"window","retentionBlocks":2350000}},"receipts":{"disabled":false,"oldestBlock":"0xf00aa","deleteStrategy":{"type":"window","retentionBlocks":2350000}},"blocks":{"disabled":false,"oldestBlock":"0x0","deleteStrategy":{"type":"none"}},"stateproofs":{"disabled":false,"oldestBlock":"0x120000","deleteStrategy":{"type":"window","retentionBlocks":90000}}}}