From efadecfb10ef8bd137a2eff188371b018ae23819 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 24 Oct 2023 23:08:39 +0200 Subject: [PATCH] X --- beacon_chain/libnimbus_lc/libnimbus_lc.nim | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/beacon_chain/libnimbus_lc/libnimbus_lc.nim b/beacon_chain/libnimbus_lc/libnimbus_lc.nim index 31fe64234..68e78816b 100644 --- a/beacon_chain/libnimbus_lc/libnimbus_lc.nim +++ b/beacon_chain/libnimbus_lc/libnimbus_lc.nim @@ -1557,6 +1557,9 @@ proc ETHTransactionsCreateFromJson( value: UInt256 input: List[byte, Limit MAX_CALLDATA_SIZE] + # EIP-2718 + `type`: Opt[uint8] + # EIP-2930 access_list: Opt[List[Eip6493AccessTuple, Limit MAX_ACCESS_LIST_SIZE]] @@ -1572,9 +1575,6 @@ proc ETHTransactionsCreateFromJson( `from`: ExecutionAddress ecdsa_signature: array[65, byte] - # EIP-2718 - `type`: Opt[uint8] - Eip6493Transaction = object payload: PartialContainer[Eip6493TransactionPayload, 32] signature: PartialContainer[Eip6493TransactionSignature, 16] @@ -1591,6 +1591,16 @@ proc ETHTransactionsCreateFromJson( return nil eip6493Tx.payload.input = List[byte, Limit MAX_CALLDATA_SIZE].init(tx.payload) + case tx.txType + of TxLegacy: + if tx.V notin [27'i64, 28'i64]: # With replay protection + `.`(eip6493Tx.payload, `type`).ok(0x00) + of TxEip2930: + `.`(eip6493Tx.payload, `type`).ok(0x01) + of TxEip1559: + `.`(eip6493Tx.payload, `type`).ok(0x02) + of TxEip4844: + `.`(eip6493Tx.payload, `type`).ok(0x03) if tx.txType >= TxEip2930: if tx.accessList.len > MAX_ACCESS_LIST_SIZE: return nil @@ -1608,16 +1618,6 @@ proc ETHTransactionsCreateFromJson( eip6493Tx.signature.`from` = ExecutionAddress(data: fromAddress) eip6493Tx.signature.ecdsa_signature = rawSig - case tx.txType - of TxLegacy: - if tx.V notin [27'i64, 28'i64]: # With replay protection - `.`(eip6493Tx.signature, `type`).ok(0x00) - of TxEip2930: - `.`(eip6493Tx.signature, `type`).ok(0x01) - of TxEip1559: - `.`(eip6493Tx.signature, `type`).ok(0x02) - of TxEip4844: - `.`(eip6493Tx.signature, `type`).ok(0x03) # Nim 1.6.14: Inlining `SSZ.encode` into constructor may corrupt memory. let eip6493Bytes = SSZ.encode(eip6493Tx)