2025-02-07 01:45:03 +00:00
|
|
|
# Copyright (c) 2021-2025 Status Research & Development GmbH
|
2022-05-09 15:04:48 +01:00
|
|
|
# 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.
|
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
{.push raises: [].}
|
2022-05-09 15:04:48 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
from eth/common import Account, Hash32
|
2022-05-23 17:53:19 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
type
|
|
|
|
SnapAccount = object
|
|
|
|
accHash: Hash32
|
|
|
|
accBody: Account
|
2022-05-09 15:04:48 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapProof* = distinct seq[byte]
|
|
|
|
## RLP-coded node data, to be handled differently from a generic `Blob`
|
2022-05-09 15:04:48 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapProofNodes = object
|
|
|
|
## Wrapper around `seq[SnapProof]` for controlling serialisation.
|
|
|
|
nodes: seq[SnapProof]
|
2022-05-10 09:02:34 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapStorage* = object
|
|
|
|
slotHash*: Hash32
|
|
|
|
slotData*: seq[byte]
|
2022-06-06 14:42:08 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapAccountRange* = object
|
|
|
|
accounts: seq[SnapAccount]
|
|
|
|
proof: SnapProofNodes
|
2022-05-23 17:53:19 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapStorageRanges* = object
|
|
|
|
slotLists: seq[seq[SnapStorage]]
|
|
|
|
proof: SnapProofNodes
|
2022-08-04 09:04:30 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapByteCodes* = object
|
|
|
|
codes: seq[seq[byte]]
|
2022-05-09 15:04:48 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
SnapTrieNodes* = object
|
|
|
|
nodes: seq[seq[byte]]
|
2023-02-15 11:14:40 +01:00
|
|
|
|
2025-02-07 01:45:03 +00:00
|
|
|
func to*(data: seq[byte]; T: type SnapProof): T = data.T
|
|
|
|
func to*(node: SnapProof; T: type seq[byte]): T = node.T
|