-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
Description
New (updated) logic
For this task we are creating an updated Root Account File. The purpose of this is to provide more frequent on-disk backups of account information and allow for faster syncing for new validators coming onto the network.
- https://docs.google.com/document/d/1sZY48ks8geUrFC1-jUxB7DFKSMlIa8dPwkr4TXp1jo4/edit?usp=sharing
- Trimmer.pdf
Documentation:
Old (original) logic
This is older logic from the previous GitHub issue. I wanted to leave it in here as reference though since it does a good job of explaining the problem we are solving.
Basic steps:
- Read the
HEAD_BLOCK_HASH
into memory (this will mark where to stop) - Read in all account data from the
SelfConfig.root_account_file
- Starting with the first block in the blockchain (find using
get_initial_block_identifier()
) apply theupdated_balances
changes to the new temporary root account file - Continue along the blockchain until reaching the stored
HEAD_BLOCK_HASH
(end of the blockchain) - Once the new root account file has been generated, update the following
SelfConfiguration
fieldsroot_account_file
,root_account_file_hash
, andseed_block_identifier
Notes:
- This will be a periodic task scheduled using celery beat - it will run every hour
- We can't simply make a backup from the Account table due to performance issues/race conditions
For reference: