Closed franklywatson closed 3 months ago
This is a functionality that has been addressed in the code-base. For example:
curl -s -XPOST 'localhost:8545' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["earliest",true],"id":7}' | jq
Returns:
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"number": "0x0",
"hash": "0x0cf424e9cc06db58d0575287b97e5a0343996ba5d17abe836b44005ac7cf1dd2",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0100000000000000",
"sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"extraData": "0x",
"size": "0x0",
"gasLimit": "0xe4e1c0",
"gasUsed": "0x0",
"timestamp": "0x662af2a1",
"transactions": [],
"uncles": [],
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": "0x0"
}
}
However, this block has not been yet indexed in PreviewNet
, as it was added after the bootstrap of the Pebble DB. That's why it returns no response.
curl -s -XPOST 'https://previewnet.evm.nodes.onflow.org' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["earliest",true],"id":7}' | jq
{
"jsonrpc": "2.0",
"id": 7,
"result": null
}
Reopening because we should still provide the response for genesis even if we have to hardcode it temporarily on previewnet. We can remove after previewnet deprecation cc @m-Peter can you work on this. It was asked by a team integrating EVM.
A minor change here as per the standard RPC, when requesting eth_getBlockByNumber
for the earliest block without any transactions in it, the previewnet RPC returns a response transactions
argument is null
instead it should return an empty array([]
).
{
number: '0x0',
hash: '0xc027833535a9b51799eacdb6815ac59dafb5fec47c333931a2fe3cfbf18f24bc',
parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
nonce: '0x0100000000000000',
sha3Uncles: '0x0000000000000000000000000000000000000000000000000000000000000000',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
transactionsRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
stateRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
miner: '0x0000000000000000000000000000000000000000',
difficulty: '0x0',
totalDifficulty: '0x0',
extraData: '0x',
size: '0x70',
gasLimit: '0xe4e1c0',
gasUsed: '0x0',
timestamp: '0x662af2a1',
transactions: null,
uncles: [],
mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
baseFeePerGas: '0x0'
}
Should be updated to:
{
number: '0x0',
hash: '0xc027833535a9b51799eacdb6815ac59dafb5fec47c333931a2fe3cfbf18f24bc',
parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
nonce: '0x0100000000000000',
sha3Uncles: '0x0000000000000000000000000000000000000000000000000000000000000000',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
transactionsRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
stateRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
miner: '0x0000000000000000000000000000000000000000',
difficulty: '0x0',
totalDifficulty: '0x0',
extraData: '0x',
size: '0x70',
gasLimit: '0xe4e1c0',
gasUsed: '0x0',
timestamp: '0x662af2a1',
transactions: [],
uncles: [],
mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
baseFeePerGas: '0x0'
}
@m-Peter ^
@blockchainguyy Nice catch :+1: I'll fix that :+1:
Problem
earliest
flag on eth_getBlockByNumber() is not working as expectedSteps to Reproduce
n/a
Acceptance Criteria
Context
Partner is blocked by this