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

Import snapshots and import chains #789

Merged
merged 13 commits into from
Oct 29, 2020
Merged

Import snapshots and import chains #789

merged 13 commits into from
Oct 29, 2020

Conversation

ec2
Copy link
Member

@ec2 ec2 commented Oct 26, 2020

Summary of changes
Changes introduced in this pull request:

  • Import a snapshot through --import-snapshot <filename>
  • Import a chain through --import-chain <filename>

Reference issue to close (if applicable)

Closes
#761

Other information and links

forest/src/daemon.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Show resolved Hide resolved
@@ -60,6 +93,16 @@ pub(super) async fn start(config: Config) {
let mut db = RocksDb::new(config.data_dir + "/db");
db.open().unwrap();
let db = Arc::new(db);

// Sync from snapshot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly we dont actually sync from snapshot rather we set the snapshot? Reason I mention this is because I dont think any sync logic is called in import_chain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we populate our blockstore from the snapshot file. And furthermore, we can also recompute all the state if we import with --import-chain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if you're wondering why not full block valation, that is intended, it's just calculating intermediate states and validating those roots are correct (full block validation would be too slow when you want to trust the export)

blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
@ec2 ec2 requested review from dutterbutter and austinabell and removed request for RajarupanSampanthan October 29, 2020 18:38
@ec2 ec2 merged commit ca3c131 into main Oct 29, 2020
@ec2 ec2 deleted the ec2/import-snapshot branch October 29, 2020 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants