mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-02 23:35:31 +00:00
32e1f94d78
* Initial implementation of account and storage proof verification for the portal state network. * Completed initial state proof verification loop test. * Completed proof verification tests. * Minor updates based on PR feedback and comments. * Add state proof verification test to test runner.
31 lines
985 B
Nim
31 lines
985 B
Nim
# Nimbus
|
|
# Copyright (c) 2023 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
|
|
stint,
|
|
eth/[common, trie],
|
|
./state_proof_verification
|
|
|
|
type
|
|
AccountState* = HexaryTrie
|
|
StorageState* = HexaryTrie
|
|
|
|
proc generateAccountProof*(
|
|
state: AccountState,
|
|
address: EthAddress): AccountProof {.raises: [RlpError].} =
|
|
let key = keccakHash(address).data
|
|
state.getBranch(key).AccountProof
|
|
|
|
proc generateStorageProof*(
|
|
state: StorageState,
|
|
slotKey: UInt256): StorageProof {.raises: [RlpError].} =
|
|
let key = keccakHash(toBytesBE(slotKey)).data
|
|
state.getBranch(key).StorageProof
|
|
|