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
87 changes: 87 additions & 0 deletions src/testing/testing_commitBlockV1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
- name: testing_commitBlockV1
summary: Builds a block from the provided parameters, inserts it into the chain, and sets it as the canonical head. This is a testing-only method for advancing a chain deterministically.
description: |
This method is a testing tool that combines block production and canonical head advancement into a single call. It is the writing equivalent of [`testing_buildBlockV1`](./testing_buildBlockV1.yaml): it produces the same block, but additionally inserts it into the chain and sets it as the new canonical head, skipping the `engine_newPayload` + `engine_forkchoiceUpdated` round-trip and the associated payload serialization overhead.

**Specification:**
- The client MUST build a new execution payload on top of its current canonical head.
- The client MUST use the provided `payloadAttributes` to define the context of the new block.
- If the `transactions` parameter is an empty array `[]`, the client MUST build an empty block (no transactions).
- If the `transactions` parameter is JSON `null`, the client MAY build a block from its local transaction pool (mempool).
- If the `transactions` parameter is a non-empty array, the client MUST include all transactions from the array on the block's transaction list, in the order they were provided, and MUST NOT include any transactions from its local transaction pool.
- If `extraData` is provided, the client MUST set the `extraData` field of the resulting block to this value.
- On success, the client MUST insert the block into its database, set it as the canonical head, emit the same chain events it would for any new head, and return the new head's block hash.
- If the block cannot be built or applied (for example, an unapplicable transaction), the client MUST return a JSON-RPC error and MUST NOT modify the canonical head.

**Security Considerations:**
- This method is intended for testing environments ONLY and MUST NOT be exposed on public-facing RPC APIs.
- It is strongly recommended that this method be disabled by default.
params:
- name: Payload attributes
required: true
schema:
title: PayloadAttributesV3
type: object
properties:
timestamp:
$ref: '#/components/schemas/uint'
prevRandao:
$ref: '#/components/schemas/hash32'
suggestedFeeRecipient:
$ref: '#/components/schemas/address'
withdrawals:
title: Withdrawals
type: array
items:
$ref: '#/components/schemas/Withdrawal'
parentBeaconBlockRoot:
$ref: '#/components/schemas/hash32'
- name: Transactions
required: true
description: |
An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.
- If an empty array `[]`: The client MUST build an empty block (no transactions).
- If `null`: The client MAY build a block from its local transaction pool (mempool).
- If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.
schema:
title: Transactions
oneOf:
- type: array
items:
$ref: '#/components/schemas/bytes'
- type: 'null'
- name: Extra data
required: false
description: |
Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.
schema:
oneOf:
- $ref: '#/components/schemas/bytes'
- type: 'null'
result:
name: Block hash
schema:
title: Committed block hash
$ref: '#/components/schemas/hash32'
errors:
- code: -32602
message: Invalid parameters
- code: -32603
message: Internal error
examples:
- name: testing_commitBlockV1 example
params:
- name: Payload attributes
value:
timestamp: '0x1ce'
prevRandao: '0x0000000000000000000000000000000000000000000000000000000000000000'
suggestedFeeRecipient: '0x0000000000000000000000000000000000000000'
withdrawals: []
parentBeaconBlockRoot: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822'
- name: Transactions
value: []
- name: Extra data
value: null
result:
name: Block hash
value: '0x1234567890123456789012345678901234567890123456789012345678901234'
1 change: 1 addition & 0 deletions tests/forkenv.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"HIVE_FORK_TANGERINE": "3",
"HIVE_MERGE_BLOCK_ID": "36",
"HIVE_NETWORK_ID": "3503995874084926",
"HIVE_TARGET_GAS_LIMIT": "60000000",
"HIVE_PRAGUE_BLOB_BASE_FEE_UPDATE_FRACTION": "5007716",
"HIVE_PRAGUE_BLOB_MAX": "9",
"HIVE_PRAGUE_BLOB_TARGET": "6",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// commits an empty block using testing_commitBlockV1 and advances the canonical head
>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["latest",true]}
<< {"jsonrpc":"2.0","id":1,"result":{"baseFeePerGas":"0x5763d64","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0x0","extraData":"0x","gasLimit":"0x47e7c40","gasUsed":"0x54a92","hash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","logsBloom":"0x00000000008000000000000000000040000000000000000000000000800000000000000008000000000000000000000000000000000000000000000000000000000000000000000000004000000000020200000000000000000000000000002000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x2d","parentBeaconBlockRoot":"0x4b118bd31ed2c4eeb81dc9e3919e9989994333fe36f147c2930f12c53f0d3c78","parentHash":"0x4b9d85c6787612e87e0659e11a347d415040465e492358f79cc7e2e293f38aa7","receiptsRoot":"0x2c86b2791cdd088d3c3e9d6225f71724d3e8c67bdd13cd6208831058cee1043f","requestsHash":"0x57cac3e52cdcd73e52bd9e54956e0eae370f00ed41f68edc78266bdb46c3a543","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x633","stateRoot":"0xf61892bbb9a9df427d1f941dc8c536d72c41efed598244726ea21a0f183ff232","timestamp":"0x1c2","transactions":[{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0x11c32","gasPrice":"0x5763d65","hash":"0x2fbbd036996c7487316c92b9e5798edb98fd57f32a6c1075e904a734821e1cd2","input":"0x600d380380600d6000396000f336156009575f355f555b305f525f5460205260405ff3","nonce":"0x9a","to":null,"transactionIndex":"0x0","value":"0x0","type":"0x0","chainId":"0xc72dd9d5e883e","v":"0x18e5bb3abd109f","r":"0x551fe45ccebb0318196e31dbc60da87c43dc60b8fb01afb3286693fa09878730","s":"0x40d33e9afecfe1516b045d61a3272bddbc83f482a7f2c749311248b50fe62e81"},{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0xb3b0","gasPrice":"0x5763d65","maxFeePerGas":"0x5763d65","maxPriorityFeePerGas":"0x1","hash":"0x16f6724ad864e7664c367893cae3e176d362bea3a47495cec3b246555a7228da","input":"0x","nonce":"0x9b","to":"0x0000000000000000000000000000000000000000","transactionIndex":"0x1","value":"0x0","type":"0x4","accessList":[],"chainId":"0xc72dd9d5e883e","authorizationList":[{"chainId":"0xc72dd9d5e883e","address":"0x58f8fe237b593c19546e1e758a2544561d04bfe0","nonce":"0x0","yParity":"0x1","r":"0xec6caeb1b7071f1b3ae36aeaa7bf0eaecb8e006e83b3e50d792870ea95af4c59","s":"0x1d1225f76d6faac3d904c0635193e83d3867c101b2e6f6c9bb7b1fdeeed923ab"}],"v":"0x1","r":"0x8ae3402e4f63751c895532b94aee0f7b6b8ff5d0b0a689f6d63b3dbd19d69059","s":"0x2e63e4d140b0d282d56289b34f3df82cbcb2f3aa385f5438a423584fe0c2b467","yParity":"0x1"},{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0x11170","gasPrice":"0x5763d65","hash":"0xddf234c5f149d2d1a4d01276d42e38a6234bfa7b987c49ba889b028b429aac8f","input":"0x696e766f6b6564","nonce":"0x9c","to":"0xeda8645ba6948855e3b3cd596bbb07596d59c603","transactionIndex":"0x2","value":"0x0","type":"0x0","chainId":"0xc72dd9d5e883e","v":"0x18e5bb3abd10a0","r":"0xfea7e18c82a1270f142572533bc2e6e33d6d41a3f1303403dd0a90dd7a4f35d","s":"0x4a4ab6c5bb4c31c3a5f8991ae45bad2303c45923404571f7b4c66adbd03b7936"},{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0x249f0","gasPrice":"0x5763d65","maxFeePerGas":"0x5763d65","maxPriorityFeePerGas":"0x2","hash":"0x3d3d02e1bdc39a6eab20f7b44ed299ca61eb1d642806bfa07e3a7ee8edd700e5","input":"0xb917cfdc0d25b72d55cf94db328e1629b7f4fde2c30cdacf873b664416f76a0c7f7cc50c9f72a3cb84be88144cde91250000000000000d80","nonce":"0x9d","to":"0x00000961ef480eb55e80d19ad83579a64c007002","transactionIndex":"0x3","value":"0x3b9aca00","type":"0x2","accessList":[],"chainId":"0xc72dd9d5e883e","v":"0x1","r":"0x5f8b300cf80f7fb7e511460fa1a803278b47223f2c0a82857c5c0e5f7c900d23","s":"0x290bf2495235a106352786403ed937df8385a2356472569020fd952913690ec9","yParity":"0x1"},{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0x186a0","gasPrice":"0x5763d65","hash":"0x195a09414344f56e7a202d1493b258b2394b9b93811ce4ee96212a7d34ffb04f","input":"0x6b3b937565afc29f656d6974","nonce":"0x9e","to":"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df","transactionIndex":"0x4","value":"0x2","type":"0x1","accessList":[{"address":"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df","storageKeys":["0x0000000000000000000000000000000000000000000000000000000000000000","0xe8481f0a1ea7b2528784efff1d1b33cbd66ac97ebe2ae35c7997cacb2863430b"]}],"chainId":"0xc72dd9d5e883e","v":"0x0","r":"0x84f8b48ac6fbf39054c7794e6ff4e16a3bacbd0964b53d4d03ff668e7eda365","s":"0x2e4e86f2f5fbb8dad4ee8907eee4488f70c75bb646522b5197c4dcdc29ea31bf","yParity":"0x0"},{"blockHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","blockNumber":"0x2d","blockTimestamp":"0x1c2","from":"0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f","gas":"0x5208","gasPrice":"0x5763d65","hash":"0xdf66bea01c5cf47b48ec11453822d751a5daaf1d16959772c2196c5ab8cf8438","input":"0x","nonce":"0x9f","to":"0x4340ee1b812acb40a1eb561c019c327b243b92df","transactionIndex":"0x5","value":"0x1","type":"0x1","accessList":[],"chainId":"0xc72dd9d5e883e","v":"0x1","r":"0xec839e20a6f8ff0fb1043022e5816454191436ba7f6607bf6efe6517fdd1e2dd","s":"0x7903b3dd48963c0404f99807fd89cde2b66091c32178f66920120cb10981019","yParity":"0x1"}],"transactionsRoot":"0xc541c333ff4a96a17d3601f7d628ea27ecf4597a11077e5d9d1c4dbed6c7f401","uncles":[],"withdrawals":[],"withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}}
>> {"jsonrpc":"2.0","id":2,"method":"testing_commitBlockV1","params":[{"parentBeaconBlockRoot":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822","prevRandao":"0x1111111111111111111111111111111111111111111111111111111111111111","suggestedFeeRecipient":"0x0000000000000000000000000000000000000000","timestamp":"0x1ce","withdrawals":[]},[],"0x"]}
<< {"jsonrpc":"2.0","id":2,"result":"0xf716541a4f889e10bf75f9796cc8212f6868f138c6a1c589008d33197edb19b7"}
>> {"jsonrpc":"2.0","id":3,"method":"eth_getBlockByNumber","params":["latest",true]}
<< {"jsonrpc":"2.0","id":3,"result":{"baseFeePerGas":"0x4c9114a","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0x0","extraData":"0x","gasLimit":"0x47d5ca2","gasUsed":"0x0","hash":"0xf716541a4f889e10bf75f9796cc8212f6868f138c6a1c589008d33197edb19b7","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x1111111111111111111111111111111111111111111111111111111111111111","nonce":"0x0000000000000000","number":"0x2e","parentBeaconBlockRoot":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822","parentHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","requestsHash":"0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x266","stateRoot":"0x4c6709fca84ff2bcca8609b4a54cb96fc1c001862d450d334088cd5694cad374","timestamp":"0x1ce","transactions":[],"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","uncles":[],"withdrawals":[],"withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// calls testing_commitBlockV1 with an unapplicable transaction (wrong nonce); client MUST return an error and not modify the canonical head
>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["latest",true]}
<< {"jsonrpc":"2.0","id":1,"result":{"baseFeePerGas":"0x4c9114a","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0x0","extraData":"0x","gasLimit":"0x47d5ca2","gasUsed":"0x0","hash":"0xf716541a4f889e10bf75f9796cc8212f6868f138c6a1c589008d33197edb19b7","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x1111111111111111111111111111111111111111111111111111111111111111","nonce":"0x0000000000000000","number":"0x2e","parentBeaconBlockRoot":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822","parentHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","requestsHash":"0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x266","stateRoot":"0x4c6709fca84ff2bcca8609b4a54cb96fc1c001862d450d334088cd5694cad374","timestamp":"0x1ce","transactions":[],"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","uncles":[],"withdrawals":[],"withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}}
>> {"jsonrpc":"2.0","id":2,"method":"testing_commitBlockV1","params":[{"parentBeaconBlockRoot":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822","prevRandao":"0x1111111111111111111111111111111111111111111111111111111111111111","suggestedFeeRecipient":"0x0000000000000000000000000000000000000000","timestamp":"0x1da","withdrawals":[]},["0x02f873870c72dd9d5e883e8203e78201f48404c9133e825208947dcd17433742f4c0ca53122ab541d0ba67fc27df8203e880c001a0c8b048f65d5225e1418625c96e146fb671f998da69a420371ce233a6c2d3759ba0106de16d8d9e4de84ee0012baaca7e94d9d4b82a1b2dbade8a50818b78ada7d1"],"0x"]}
<< {"jsonrpc":"2.0","id":2,"error":{"code":-32000,"message":"nonce too high: address 0x16c57eDF7Fa9D9525378B0b81Bf8A3cEd0620C1c, tx: 999 state: 0"}}
>> {"jsonrpc":"2.0","id":3,"method":"eth_getBlockByNumber","params":["latest",true]}
<< {"jsonrpc":"2.0","id":3,"result":{"baseFeePerGas":"0x4c9114a","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0x0","extraData":"0x","gasLimit":"0x47d5ca2","gasUsed":"0x0","hash":"0xf716541a4f889e10bf75f9796cc8212f6868f138c6a1c589008d33197edb19b7","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x1111111111111111111111111111111111111111111111111111111111111111","nonce":"0x0000000000000000","number":"0x2e","parentBeaconBlockRoot":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822","parentHash":"0xe27a3e81bd7cfe2aec2cc9e832c73a17c93e7efcf659cf4b39883b96c48708c2","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","requestsHash":"0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x266","stateRoot":"0x4c6709fca84ff2bcca8609b4a54cb96fc1c001862d450d334088cd5694cad374","timestamp":"0x1ce","transactions":[],"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","uncles":[],"withdrawals":[],"withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}}
Loading
Loading