mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-03-01 04:10:45 +00:00
* renamed nimbus folder to execution_chain * Renamed "nimbus" references to "execution_chain" * fixed wrongly changed http reference * delete snap types file given that it was deleted before this PR merge * missing 'execution_chain' replacement --------- Co-authored-by: pmmiranda <pedro.miranda@nimbus.team>
49 lines
1.6 KiB
Nim
49 lines
1.6 KiB
Nim
# Nimbus
|
|
# Copyright (c) 2024-2025 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
# http://opensource.org/licenses/MIT)
|
|
# at your option. This file may not be copied, modified, or
|
|
# distributed except according to those terms.
|
|
|
|
{.used.}
|
|
|
|
import unittest2, std/sequtils, ../../execution_chain/db/aristo/aristo_blobify
|
|
|
|
suite "Aristo blobify":
|
|
test "VertexRef roundtrip":
|
|
let
|
|
leafAccount = VertexRef(
|
|
vType: Leaf,
|
|
pfx: NibblesBuf.nibble(1),
|
|
lData: LeafPayload(
|
|
pType: AccountData, account: AristoAccount(nonce: 100, balance: 123.u256)
|
|
),
|
|
)
|
|
leafStoData = VertexRef(
|
|
vType: Leaf,
|
|
pfx: NibblesBuf.nibble(3),
|
|
lData: LeafPayload(pType: StoData, stoData: 42.u256),
|
|
)
|
|
branch = VertexRef(vType: Branch, startVid: VertexID(0x334452), used: 0x43'u16)
|
|
|
|
extension = VertexRef(
|
|
vType: Branch,
|
|
pfx: NibblesBuf.nibble(2),
|
|
startVid: VertexID(0x55),
|
|
used: 0x12'u16,
|
|
)
|
|
|
|
key = HashKey.fromBytes(repeat(0x34'u8, 32))[]
|
|
|
|
check:
|
|
deblobify(blobify(leafAccount, key), VertexRef)[] == leafAccount
|
|
deblobify(blobify(leafStoData, key), VertexRef)[] == leafStoData
|
|
deblobify(blobify(branch, key), VertexRef)[] == branch
|
|
deblobify(blobify(extension, key), VertexRef)[] == extension
|
|
|
|
deblobify(blobify(branch, key), HashKey)[] == key
|
|
deblobify(blobify(extension, key), HashKey)[] == key
|