From 8a0772ac10f042500c1d429dbf318ef2367e950b Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Fri, 14 Jun 2024 12:42:31 +0200 Subject: [PATCH] cleanup a few more rlpHash calls (#2359) --- fluffy/eth_data/era1.nim | 2 +- fluffy/network/state/state_validation.nim | 2 +- fluffy/rpc/rpc_eth_api.nim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fluffy/eth_data/era1.nim b/fluffy/eth_data/era1.nim index 2f4f670eb..150673d8c 100644 --- a/fluffy/eth_data/era1.nim +++ b/fluffy/eth_data/era1.nim @@ -467,7 +467,7 @@ proc verify*(f: Era1File): Result[Digest, string] = ?f.getBlockTuple(blockNumber) txRoot = calcTxRoot(blockBody.transactions) - ommershHash = keccakHash(rlp.encode(blockBody.uncles)) + ommershHash = rlpHash(blockBody.uncles) if blockHeader.txRoot != txRoot: return err("Invalid transactions root") diff --git a/fluffy/network/state/state_validation.nim b/fluffy/network/state/state_validation.nim index 7ad90bc18..200dba922 100644 --- a/fluffy/network/state/state_validation.nim +++ b/fluffy/network/state/state_validation.nim @@ -24,7 +24,7 @@ proc isValidNextNode( let nextHash = if hashOrShortRlp.isList(): # is a short node - keccakHash(rlp.encode(hashOrShortRlp)) + rlpHash(hashOrShortRlp) else: let hash = hashOrShortRlp.toBytes() if hash.len() != 32: diff --git a/fluffy/rpc/rpc_eth_api.nim b/fluffy/rpc/rpc_eth_api.nim index 09b772d48..f9d85dd4a 100644 --- a/fluffy/rpc/rpc_eth_api.nim +++ b/fluffy/rpc/rpc_eth_api.nim @@ -119,7 +119,7 @@ func init*( inc i else: for tx in body.transactions: - blockObject.transactions.add txOrHash(w3Hash keccakHash(rlp.encode(tx))) + blockObject.transactions.add txOrHash(w3Hash rlpHash(tx)) blockObject