mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-17 15:50:57 +00:00
488bdbc267
* Provide portal proof functions in `aristo_api` why: So it can be fully supported by `CoreDb` * Fix prototype in `kvt_api` * Fix node constructor for account leafs with storage trees * Provide simple path check based on portal proof functionality * Provide portal proof functionality in `CoreDb` * Update TODO list
51 lines
1.6 KiB
Nim
51 lines
1.6 KiB
Nim
# nimbus-eth1
|
|
# Copyright (c) 2023-2024 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.
|
|
|
|
{.push raises: [].}
|
|
|
|
import
|
|
eth/common,
|
|
results,
|
|
".."/[aristo_compute, aristo_desc, aristo_fetch, aristo_part]
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Public functions
|
|
# ------------------------------------------------------------------------------
|
|
|
|
proc checkTwig*(
|
|
db: AristoDbRef; # Database
|
|
root: VertexID; # Start node
|
|
path: openArray[byte]; # Data path
|
|
): Result[void,AristoError] =
|
|
let
|
|
proof = ? db.partGenericTwig(root, path)
|
|
key = ? db.computeKey (root,root)
|
|
pyl = ? proof.partUntwigGeneric(key.to(Hash256), path)
|
|
|
|
ok()
|
|
|
|
proc checkTwig*(
|
|
db: AristoDbRef; # Database
|
|
accPath: Hash256; # Account key
|
|
stoPath: Hash256; # Storage key
|
|
): Result[void,AristoError] =
|
|
let
|
|
proof = ? db.partStorageTwig(accPath, stoPath)
|
|
vid = ? db.fetchStorageID accPath
|
|
key = ? db.computeKey (VertexID(1),vid)
|
|
pyl = ? proof.partUntwigPath(key.to(Hash256), stoPath)
|
|
|
|
ok()
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# End
|
|
# ------------------------------------------------------------------------------
|
|
|