Skip to content

Commit

Permalink
eth: EIP-4844 and EIP-4788 updates for cancun (#477)
Browse files Browse the repository at this point in the history
* Add Parent Beacon Block Root to Block (#450)

* Add EIP-4844 transaction and receipt (#398)

* Add dataGasUsed to receipt

* Make dataGasUsed optional

* Add dataGasPrice

* Update src/schemas/receipt.yaml

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>

* Update src/schemas/receipt.yaml

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>

* Update src/schemas/receipt.yaml

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>

* rename data gas to blob gas - eip 7354

* schemas/tx: add 4844 tx

* schemas/tx: add 4844 blob fields to generic transaction

* eth/submit: make note that 4844 txs must be in network form for sendRawTransaction

* schemas: fix typo in 4844 tx uint ref

* schemas: remove some extra spacing

* schema: update required fields for blob tx repr

---------

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>

* eth: add new 4844 header fields

* tests: update for cancun

* tests: non-zero parent beacon block root

---------

Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
4 people authored Oct 18, 2023
1 parent 150a7b6 commit 057892b
Show file tree
Hide file tree
Showing 41 changed files with 169 additions and 39 deletions.
4 changes: 3 additions & 1 deletion src/eth/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
schema:
$ref: '#/components/schemas/hash32'
- name: eth_sendRawTransaction
summary: Submits a raw transaction.
summary: Submits a raw transaction. For EIP-4844 transactions, the raw form
must be the network form. This means it includes the blobs, KZG
commitments, and KZG proofs.
params:
- name: Transaction
required: true
Expand Down
9 changes: 9 additions & 0 deletions src/schemas/block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ Block:
withdrawalsRoot:
title: Withdrawals root
$ref: '#/components/schemas/hash32'
blobGasUsed:
title: Blob gas used
$ref: '#/components/schemas/uint'
excessBlobGas:
title: Excess blob gas
$ref: '#/components/schemas/uint'
parentBeaconBlockRoot:
title: Parent Beacon Block Root
$ref: '#/components/schemas/hash32'
size:
title: Block size
$ref: '#/components/schemas/uint'
Expand Down
10 changes: 9 additions & 1 deletion src/schemas/receipt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ ReceiptInfo:
title: gas used
description: The amount of gas used for this specific transaction alone.
$ref: '#/components/schemas/uint'
blobGasUsed:
title: blob gas used
description: The amount of blob gas used for this specific transaction. Only specified for blob transactions as defined by EIP-4844.
$ref: '#/components/schemas/uint'
contractAddress:
title: contract address
description: The contract address created, if the transaction was a contract creation, otherwise null.
Expand All @@ -109,5 +113,9 @@ ReceiptInfo:
$ref: '#/components/schemas/uint'
effectiveGasPrice:
title: effective gas price
description: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).
description: The actual value per gas deducted from the sender's account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).
$ref: '#/components/schemas/uint'
blobGasPrice:
title: blob gas price
description: The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844.
$ref: '#/components/schemas/uint'
100 changes: 100 additions & 0 deletions src/schemas/transaction.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
Transaction4844Unsigned:
type: object
title: EIP-4844 transaction.
required:
- type
- nonce
- to
- gas
- value
- input
- maxPriorityFeePerGas
- maxFeePerGas
- maxFeePerBlobGas
- accessList
- blobVersionedHashes
- chainId
properties:
type:
title: type
$ref: '#/components/schemas/byte'
nonce:
title: nonce
$ref: '#/components/schemas/uint'
to:
title: to address
$ref: '#/components/schemas/address'
gas:
title: gas limit
$ref: '#/components/schemas/uint'
value:
title: value
$ref: '#/components/schemas/uint'
input:
title: input data
$ref: '#/components/schemas/bytes'
maxPriorityFeePerGas:
title: max priority fee per gas
description: Maximum fee per gas the sender is willing to pay to miners in wei
$ref: '#/components/schemas/uint'
maxFeePerGas:
title: max fee per gas
description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei
$ref: '#/components/schemas/uint'
maxFeePerBlobGas:
title: max fee per blob gas
description: The maximum total fee per gas the sender is willing to pay for blob gas in wei
$ref: '#/components/schemas/uint'
accessList:
title: accessList
description: EIP-2930 access list
$ref: '#/components/schemas/AccessList'
blobVersionedHashes:
title: blobVersionedHashes
description: List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.
type: array
items:
$ref: '#/components/schemas/hash32'
chainId:
title: chainId
description: Chain ID that this transaction is valid on.
$ref: '#/components/schemas/uint'
AccessListEntry:
title: Access list entry
type: object
Expand Down Expand Up @@ -164,9 +225,31 @@ TransactionLegacyUnsigned:
$ref: '#/components/schemas/uint'
TransactionUnsigned:
oneOf:
- $ref: '#/components/schemas/Transaction4844Unsigned'
- $ref: '#/components/schemas/Transaction1559Unsigned'
- $ref: '#/components/schemas/Transaction2930Unsigned'
- $ref: '#/components/schemas/TransactionLegacyUnsigned'
Transaction4844Signed:
title: Signed 4844 Transaction
type: object
allOf:
- $ref: '#/components/schemas/Transaction4844Unsigned'
- title: EIP-4844 transaction signature properties.
required:
- yParity
- r
- s
properties:
yParity:
title: yParity
description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.
$ref: '#/components/schemas/uint'
r:
title: r
$ref: '#/components/schemas/uint'
s:
title: s
$ref: '#/components/schemas/uint'
Transaction1559Signed:
title: Signed 1559 Transaction
type: object
Expand Down Expand Up @@ -239,6 +322,7 @@ TransactionLegacySigned:
$ref: '#/components/schemas/uint'
TransactionSigned:
oneOf:
- $ref: '#/components/schemas/Transaction4844Signed'
- $ref: '#/components/schemas/Transaction1559Signed'
- $ref: '#/components/schemas/Transaction2930Signed'
- $ref: '#/components/schemas/TransactionLegacySigned'
Expand Down Expand Up @@ -313,10 +397,26 @@ GenericTransaction:
title: max fee per gas
description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei
$ref: '#/components/schemas/uint'
maxFeePerBlobGas:
title: max fee per blob gas
description: The maximum total fee per gas the sender is willing to pay for blob gas in wei
$ref: '#/components/schemas/uint'
accessList:
title: accessList
description: EIP-2930 access list
$ref: '#/components/schemas/AccessList'
blobVersionedHashes:
title: blobVersionedHashes
description: List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.
type: array
items:
$ref: '#/components/schemas/hash32'
blobs:
title: blobs
description: Raw blob data.
type: array
items:
$ref: '#/components/schemas/bytes'
chainId:
title: chainId
description: Chain ID that this transaction is valid on.
Expand Down
Binary file modified tests/bad.rlp
Binary file not shown.
Binary file modified tests/chain.rlp
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/debug_getRawBlock/get-block-n.io
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
>> {"jsonrpc":"2.0","id":1,"method":"debug_getRawBlock","params":["0x3"]}
<< {"jsonrpc":"2.0","id":1,"result":"0xf90276f90218a0b019ea73504c933a601125fc37ebfd9629a2119a91792a5653365ed73ec56acba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0f17a0db4c6c1d9461d74a6c8d9426769b68d1146ca14a9175cb629b7aaeb600da0b7123db22d2b11088a0c80e4e44e0740ce7965754b75e366b9d1f297e5ea8181a0223f7b7cb197a5886eb3ffc6d05896b38539cefbbf8c3da4855a61e7a854bf4ab90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b4082cf501e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f857f85502842806be9d82cf6c80808460806040820a95a030e29b76d4ce26f1f5c69e6fb814d9a138ee5f5238f0bf7ed80ede0db82406bfa07e81c4c6d80b3e5a333bb16ff95dca3f11d9f33421bd8234ab54d57b35cbcb8bc0c0"}
<< {"jsonrpc":"2.0","id":1,"result":"0xf90299f9023ba093249d84f3844ed3dd9746eb5bfec7b7f64174c3a68ce3751d9d1752c1590511a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0bc29f1eff715d414be2201419a80f53599ffcf0951fb442bbc29297dd65aef60a0b7123db22d2b11088a0c80e4e44e0740ce7965754b75e366b9d1f297e5ea8181a0223f7b7cb197a5886eb3ffc6d05896b38539cefbbf8c3da4855a61e7a854bf4ab90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b4082cf501e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00200000000000000000000000000000000000000000000000000000000000000f857f85502842806be9d82cf6c80808460806040820a95a030e29b76d4ce26f1f5c69e6fb814d9a138ee5f5238f0bf7ed80ede0db82406bfa07e81c4c6d80b3e5a333bb16ff95dca3f11d9f33421bd8234ab54d57b35cbcb8bc0c0"}
2 changes: 1 addition & 1 deletion tests/debug_getRawBlock/get-genesis.io
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
>> {"jsonrpc":"2.0","id":1,"method":"debug_getRawBlock","params":["0x0"]}
<< {"jsonrpc":"2.0","id":1,"result":"0xf9021cf90216a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a05db86e9a500ed3158bdd0e8a01927f070bbf6630f39118510283150efe9aa31ba056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180834c4b40808080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000843b9aca00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421c0c0c0"}
<< {"jsonrpc":"2.0","id":1,"result":"0xf9023ff90239a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0f67fe3cde4dc2950fa5c1c58a7d5a62682e57e9400b494a9172fcd15311ed599a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180834c4b40808080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000843b9aca00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000c0c0c0"}
2 changes: 1 addition & 1 deletion tests/debug_getRawHeader/get-block-n.io
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
>> {"jsonrpc":"2.0","id":1,"method":"debug_getRawHeader","params":["0x3"]}
<< {"jsonrpc":"2.0","id":1,"result":"0xf90218a0b019ea73504c933a601125fc37ebfd9629a2119a91792a5653365ed73ec56acba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0f17a0db4c6c1d9461d74a6c8d9426769b68d1146ca14a9175cb629b7aaeb600da0b7123db22d2b11088a0c80e4e44e0740ce7965754b75e366b9d1f297e5ea8181a0223f7b7cb197a5886eb3ffc6d05896b38539cefbbf8c3da4855a61e7a854bf4ab90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b4082cf501e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}
<< {"jsonrpc":"2.0","id":1,"result":"0xf9023ba093249d84f3844ed3dd9746eb5bfec7b7f64174c3a68ce3751d9d1752c1590511a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0bc29f1eff715d414be2201419a80f53599ffcf0951fb442bbc29297dd65aef60a0b7123db22d2b11088a0c80e4e44e0740ce7965754b75e366b9d1f297e5ea8181a0223f7b7cb197a5886eb3ffc6d05896b38539cefbbf8c3da4855a61e7a854bf4ab90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b4082cf501e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00200000000000000000000000000000000000000000000000000000000000000"}
2 changes: 1 addition & 1 deletion tests/debug_getRawHeader/get-genesis.io
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
>> {"jsonrpc":"2.0","id":1,"method":"debug_getRawHeader","params":["0x0"]}
<< {"jsonrpc":"2.0","id":1,"result":"0xf90216a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a05db86e9a500ed3158bdd0e8a01927f070bbf6630f39118510283150efe9aa31ba056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180834c4b40808080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000843b9aca00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}
<< {"jsonrpc":"2.0","id":1,"result":"0xf90239a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0f67fe3cde4dc2950fa5c1c58a7d5a62682e57e9400b494a9172fcd15311ed599a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180834c4b40808080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000843b9aca00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000"}
2 changes: 1 addition & 1 deletion tests/eth_getBalance/get-balance-blockhash.io
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
>> {"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["0xaa00000000000000000000000000000000000000","0x7cb4dd3daba1f739d0c1ec7d998b4a2f6fd83019116455afa54ca4f49dfa0ad4"]}
>> {"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["0xaa00000000000000000000000000000000000000","0x76734e0205d8c4b711990ab957e86d3dc56d129600e60750552c95448a449794"]}
<< {"jsonrpc":"2.0","id":1,"result":"0x1"}
Loading

0 comments on commit 057892b

Please sign in to comment.