diff --git a/eth/common/eth_types_rlp.nim b/eth/common/eth_types_rlp.nim index 5a76c08..07b1f19 100644 --- a/eth/common/eth_types_rlp.nim +++ b/eth/common/eth_types_rlp.nim @@ -7,16 +7,13 @@ import "."/[ accounts_rlp, addresses_rlp, base_rlp, blocks_rlp, eth_types, hashes_rlp, - receipts_rlp, transactions_rlp, + headers_rlp, receipts_rlp, times_rlp, transactions_rlp, ], ../rlp export accounts_rlp, addresses_rlp, base_rlp, blocks_rlp, eth_types, hashes_rlp, - receipts_rlp, transactions_rlp, rlp - -proc read*(rlp: var Rlp, T: type EthTime): T {.raises: [RlpError].} = - EthTime rlp.read(uint64) + headers_rlp, receipts_rlp, times_rlp, transactions_rlp, rlp proc append*(rlpWriter: var RlpWriter, value: BlockHashOrNumber) = case value.isHash @@ -31,9 +28,6 @@ proc read*(rlp: var Rlp, T: type BlockHashOrNumber): T = else: BlockHashOrNumber(isHash: false, number: rlp.read(BlockNumber)) -proc append*(rlpWriter: var RlpWriter, t: EthTime) {.inline.} = - rlpWriter.append(t.uint64) - proc rlpHash*[T](v: T): Hash32 = keccak256(rlp.encode(v)) diff --git a/eth/common/headers_rlp.nim b/eth/common/headers_rlp.nim new file mode 100644 index 0000000..67a02f5 --- /dev/null +++ b/eth/common/headers_rlp.nim @@ -0,0 +1,12 @@ +# eth +# Copyright (c) 2024 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + +{.push raises: [].} + +import ./[headers, base_rlp, times_rlp], ../rlp + +export headers, base_rlp, times_rlp, rlp diff --git a/eth/common/times_rlp.nim b/eth/common/times_rlp.nim new file mode 100644 index 0000000..3103153 --- /dev/null +++ b/eth/common/times_rlp.nim @@ -0,0 +1,18 @@ +# eth +# Copyright (c) 2024 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + +{.push raises: [].} + +import ./times, ../rlp + +export times, rlp + +proc read*(rlp: var Rlp, T: type EthTime): T {.raises: [RlpError].} = + EthTime rlp.read(uint64) + +proc append*(rlpWriter: var RlpWriter, t: EthTime) {.inline.} = + rlpWriter.append(t.uint64)