Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export of REV vault state (REV balances) #41

Open
tgrospic opened this issue Jul 9, 2021 · 0 comments
Open

Export of REV vault state (REV balances) #41

tgrospic opened this issue Jul 9, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation Implemented Technical Technical Proposal

Comments

@tgrospic
Copy link
Collaborator

tgrospic commented Jul 9, 2021

Overview

The purpose of this RCHIP is to specify the export process from on-chain REV vault contract to get the full list of REV balances. This export is needed for two planned hard forks: Hard Fork 1 and [Hard Fork 2] (not published yet).

Specification

REV vault contract keeps the record of all REV addresses and their current balance. It uses implementation of TreeHashMap with keys as hashed REV addresses and vaults as values.

Traversing of all records in REV vault is implemented in Scala to achieve much better speed than directly in Rholang. The main code is in RhoTrieTraverser and executable entry point is in StateBalanceMain with hard coded unforgeable name of vault map (TreeHashMap) where REV vaults are stored in REV vault contract.

Validation

Validation of the whole export process can be done with the prepared scripts and configurations in repository tgrospic/rnode-rev-export-hard-fork-1.

The process has two steps:

  1. Download Last Finalized State (LFS) of the network on which snapshot (export of REV balances) for Hard Fork 1 is created.
  2. Run state-balance-main command to export REV balances in csv format.

Because exported csv file contain hashed REV addresses we are using data from transaction server to read mapping between hash value and REV address. Because this file can be validated by it own and export requires replay of all blocks as input to transaction server, this file will be provided as part of the specification.

More information can be found in the PR#3411 where is the source code for the export process.

@tgrospic tgrospic added documentation Improvements or additions to documentation Technical Technical Proposal Implemented labels Jul 9, 2021
@tgrospic tgrospic mentioned this issue Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Implemented Technical Technical Proposal
Projects
None yet
Development

No branches or pull requests

1 participant