Skip to content

High-level spec for Full Node and Snapshots #2629

@joshieDo

Description

@joshieDo

High Level

Some draft on the snapshots and full node high level specs. Joining them here since they do share some important similarities, and it might help to keep that in mind. They both work on sliding window intervals during syncing, and any table that can be pruned is a candidate for a snapshot file in the end.

Categories (prunable or moveable to snapshots)

  • Historical: AccountChangeSet / StorageChangeSet / AccountHistory / StorageHistory
  • Transactions: Transactions / TxSenders / TxLookup / TxHashNumber / TransactionBlock
  • Receipts

Full Node:

  • Default pruning. keep data related to the most 256 recent blocks.
  • Any table which has a BlockNumber or TxNumber as key is a candidate for pruning.
  • Customization on what are the most recent blocks [ allow keeping none of the block data, apart from state after verifying ]
  • Each category can be fully pruned (eg. no receipts) if desired so.
  • Prune levels should allow skipping certain stages (eg. TxSenders / TxLookup )

Snapshots:

  • Fixed interval. [ Every N blocks, or every N transactions ]
  • Any table which has a BlockNumber or TxNumber as key is a candidate for moving to static files.
  • Reproducible snapshots. Should include an option to sync from beginning and let the node create all its own snapshots. They should match existing ones.
  • Shared through a centralized host and/or p2p
  • Static file per category or per table
  • Perfect hashing table for keys
  • Compressed values (overall dictionary (across 0 - 17M blocks) / per file / or both [double compression])

Syncing

  • Full node:

    • Requests block height from CL.
    • Sync with pruned options. [eg. don't store/calculate changesets until the most recent blocks or receipt or TxSenders etc.].
    • When approaching a block number close to block_height - 256, recheck latest block height.
    • Once it reaches the desired height, register process to wake-up register (more on it below) and sleep.
  • Snapshots:

    • ??

Tip

Register

  • Wake-up register [condition -> wake-up registered process (channel) -> execute]
    • Loop through registered processes
    • If condition is met, wake-up registered process
    • Execute. [full-node: clean-up tables | snapshot: move from tables]
    • Either on success or failure, update the condition with a new one.
  • Once a block has been handled check wake-up register conditions. [eg. static file waits for an exact block height while full node might execute every N blocks]

Priority

  1. Full node syncing
  2. Wake-up register
  3. Full-node @ tip wake-up process (registration & table clean-up)
  4. Snapshot @ tip wake-up process (registration & moving table data )
  5. Snapshot syncing

Metadata

Metadata

Assignees

Labels

C-discussionA discussion about the direction and design of the project

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions