Update for `FeesPerGas`

This commit is contained in:
Etan Kissling 2024-05-20 14:12:31 +02:00
parent 2bd41c6ae9
commit e6d0e7ef89
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
2 changed files with 23 additions and 6 deletions

View File

@ -1625,6 +1625,12 @@ proc ETHTransactionsCreateFromJson(
MAX_BLOB_COMMITMENTS_PER_BLOCK = 4_096 MAX_BLOB_COMMITMENTS_PER_BLOCK = 4_096
type type
FeePerGas = UInt256
FeesPerGas {.sszStableContainer: 16.} = object
regular: Opt[FeePerGas]
blob: Opt[FeePerGas]
Eip6493AccessTuple = object Eip6493AccessTuple = object
address: ExecutionAddress address: ExecutionAddress
storage_keys: List[Eth2Digest, Limit MAX_ACCESS_LIST_STORAGE_KEYS] storage_keys: List[Eth2Digest, Limit MAX_ACCESS_LIST_STORAGE_KEYS]
@ -1637,7 +1643,7 @@ proc ETHTransactionsCreateFromJson(
chain_id: Opt[ChainId] chain_id: Opt[ChainId]
nonce: uint64 nonce: uint64
max_fee_per_gas: UInt256 max_fees_per_gas: Opt[FeesPerGas]
gas: uint64 gas: uint64
to: Opt[ExecutionAddress] to: Opt[ExecutionAddress]
value: UInt256 value: UInt256
@ -1647,10 +1653,9 @@ proc ETHTransactionsCreateFromJson(
access_list: Opt[List[Eip6493AccessTuple, Limit MAX_ACCESS_LIST_SIZE]] access_list: Opt[List[Eip6493AccessTuple, Limit MAX_ACCESS_LIST_SIZE]]
# EIP-1559 # EIP-1559
max_priority_fee_per_gas: Opt[UInt256] max_priority_fees_per_gas: Opt[FeesPerGas]
# EIP-4844 # EIP-4844
max_fee_per_blob_gas: Opt[UInt256]
blob_versioned_hashes: blob_versioned_hashes:
Opt[List[deneb.VersionedHash, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]] Opt[List[deneb.VersionedHash, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]]
@ -1677,7 +1682,13 @@ proc ETHTransactionsCreateFromJson(
# With replay protection # With replay protection
eip6493Tx.payload.chain_id.ok tx.chainId eip6493Tx.payload.chain_id.ok tx.chainId
eip6493Tx.payload.nonce = tx.nonce eip6493Tx.payload.nonce = tx.nonce
eip6493Tx.payload.max_fee_per_gas = tx.maxFee.u256 eip6493Tx.payload.max_fees_per_gas.ok FeesPerGas(
regular: Opt.some tx.maxFee.u256,
blob:
if tx.txType == TxEip4844:
Opt.some tx.maxFeePerBlobGas
else:
Opt.none FeePerGas)
eip6493Tx.payload.gas = tx.gasLimit.uint64 eip6493Tx.payload.gas = tx.gasLimit.uint64
if tx.to.isSome: if tx.to.isSome:
eip6493Tx.payload.to.ok(ExecutionAddress(data: tx.to.get)) eip6493Tx.payload.to.ok(ExecutionAddress(data: tx.to.get))
@ -1699,7 +1710,13 @@ proc ETHTransactionsCreateFromJson(
storage_keys: List[Eth2Digest, Limit MAX_ACCESS_LIST_STORAGE_KEYS] storage_keys: List[Eth2Digest, Limit MAX_ACCESS_LIST_STORAGE_KEYS]
.init(it.storageKeys.mapIt(Eth2Digest(data: it))))))) .init(it.storageKeys.mapIt(Eth2Digest(data: it)))))))
if tx.txType >= TxEip1559: if tx.txType >= TxEip1559:
eip6493Tx.payload.max_priority_fee_per_gas.ok(tx.maxPriorityFee.u256) eip6493Tx.payload.max_priority_fees_per_gas.ok FeesPerGas(
regular: Opt.some tx.maxPriorityFee.u256,
blob:
if tx.txType == TxEip4844:
Opt.some FeePerGas(UInt256.zero)
else:
Opt.none FeePerGas)
eip6493Tx.signature.`from` = ExecutionAddress(data: fromAddress) eip6493Tx.signature.`from` = ExecutionAddress(data: fromAddress)
eip6493Tx.signature.ecdsa_signature = rawSig eip6493Tx.signature.ecdsa_signature = rawSig

@ -1 +1 @@
Subproject commit 3e9111729a1046c07b9559959fde499a0fe0075b Subproject commit 5de55bab8c4e161d3ae1c39f284c26262b5ebf82