diff --git a/beacon_chain/libnimbus_lc/libnimbus_lc.nim b/beacon_chain/libnimbus_lc/libnimbus_lc.nim index 48b050dab9..a8569a9383 100644 --- a/beacon_chain/libnimbus_lc/libnimbus_lc.nim +++ b/beacon_chain/libnimbus_lc/libnimbus_lc.nim @@ -1296,7 +1296,7 @@ proc ETHExecutionBlockHeaderCreateFromJson( Opt.some data.requestsHash.get.asEth2Digest.to(Hash32) else: Opt.none(Hash32)) - if blockHeader.computeRlpHash() != executionHash[]: + if blockHeader.computeRlpHash().asEth2Digest() != executionHash[]: return nil # Construct withdrawals @@ -1326,15 +1326,15 @@ proc ETHExecutionBlockHeaderCreateFromJson( bytes: rlpBytes) let tr = orderedTrieRoot(wds) - if tr != data.withdrawalsRoot.get.asEth2Digest: + if tr != data.withdrawalsRoot.get: return nil let executionBlockHeader = ETHExecutionBlockHeader.new() executionBlockHeader[] = ETHExecutionBlockHeader( - transactionsRoot: blockHeader.txRoot, - withdrawalsRoot: blockHeader.withdrawalsRoot.get(zeroHash32), + transactionsRoot: blockHeader.txRoot.asEth2Digest(), + withdrawalsRoot: blockHeader.withdrawalsRoot.get(zeroHash32).asEth2Digest(), withdrawals: wds, - requestsHash: blockHeader.requestsHash.get(zeroHash32)) + requestsHash: blockHeader.requestsHash.get(zeroHash32).asEth2Digest()) executionBlockHeader.toUnmanagedPtr() proc ETHExecutionBlockHeaderDestroy( @@ -1600,7 +1600,7 @@ proc ETHTransactionsCreateFromJson( except RlpError: raiseAssert "Unreachable" hash = keccak256(rlpBytes) - if data.hash.asEth2Digest != hash: + if data.hash != hash: return nil func packSignature(r, s: UInt256, yParity: uint8): array[65, byte] = @@ -1667,7 +1667,7 @@ proc ETHTransactionsCreateFromJson( signature: @sig) txs.add ETHTransaction( - hash: keccak256(rlpBytes), + hash: keccak256(rlpBytes).asEth2Digest, chainId: tx.chainId, `from`: ExecutionAddress(data: fromAddress), nonce: tx.nonce, @@ -1688,7 +1688,7 @@ proc ETHTransactionsCreateFromJson( signature: @rawSig, bytes: rlpBytes.TypedTransaction) - if orderedTrieRoot(txs) != transactionsRoot[]: + if orderedTrieRoot(txs).asEth2Digest() != transactionsRoot[]: return nil let transactions = seq[ETHTransaction].new() @@ -2396,7 +2396,7 @@ proc ETHReceiptsCreateFromJson( ReceiptStatusType.Root else: ReceiptStatusType.Status, - root: rec.hash, + root: rec.hash.asEth2Digest(), status: rec.status, gasUsed: distinctBase(data.gasUsed), # Validated during sanity checks. logsBloom: BloomLogs(data: rec.logsBloom.data), @@ -2406,7 +2406,7 @@ proc ETHReceiptsCreateFromJson( data: it.data)), bytes: rlpBytes) - if orderedTrieRoot(recs) != receiptsRoot[]: + if orderedTrieRoot(recs).asEth2Digest() != receiptsRoot[]: return nil let receipts = seq[ETHReceipt].new() diff --git a/tests/testblockutil.nim b/tests/testblockutil.nim index 3dc7c501c2..40de5dbd58 100644 --- a/tests/testblockutil.nim +++ b/tests/testblockutil.nim @@ -11,6 +11,7 @@ import chronicles, stew/endians2, ../beacon_chain/consensus_object_pools/sync_committee_msg_pool, + ../beacon_chain/el/engine_api_conversions, ../beacon_chain/spec/datatypes/bellatrix, ../beacon_chain/spec/[ beaconstate, helpers, keystore, signatures, state_transition, validator] @@ -102,7 +103,7 @@ func build_empty_merge_execution_payload(state: bellatrix.BeaconState): var payload = bellatrix.ExecutionPayload( parent_hash: latest.block_hash, state_root: latest.state_root, # no changes to the state - receipts_root: EMPTY_ROOT_HASH, + receipts_root: EMPTY_ROOT_HASH.asEth2Digest, block_number: latest.block_number + 1, prev_randao: randao_mix, gas_limit: 30000000, # retain same limit @@ -134,7 +135,7 @@ func build_empty_execution_payload( parent_hash: latest.block_hash, fee_recipient: bellatrix.ExecutionAddress(data: distinctBase(feeRecipient)), state_root: latest.state_root, # no changes to the state - receipts_root: EMPTY_ROOT_HASH, + receipts_root: EMPTY_ROOT_HASH.asEth2Digest, block_number: latest.block_number + 1, prev_randao: randao_mix, gas_limit: latest.gas_limit, # retain same limit diff --git a/vendor/nim-eth b/vendor/nim-eth index 5c3969a5c1..92a02b672f 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 5c3969a5c12c7c5acc3d223723a8c005467deea6 +Subproject commit 92a02b672f60e6b5e5ea570d684904c289b495fa