Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Refactor bank and track root and live bank checkpoints. #2640

Closed
wants to merge 26 commits into from

Conversation

aeyakovenko
Copy link
Member

@aeyakovenko aeyakovenko commented Feb 1, 2019

Problem

Need a way to track root and live bank state in the system and handle rollback.

Summary of Changes

  • bank split into BankCheckpoint and BankState that composes the checkpoints
  • live and root BankState is reachable from the bank
  • made the RpcSubscriptions explicit. Trait objects are really not great in rust. They require a dynamic allocation, the compiler implements them as dynamic dispatch, and they cannot really compose the traits up through the Box, so you end up passing a bunch of trait level descriptions through every api that uses them.
  • Checkpoints module that implements a dag to keep track of the checkpoints
  • Forks that merges and purges the live chain as it moves along

What is not done:

  • refactoring the system to not use a global bank. I think in a lot places, the expected BankState instance should be passed in as a function parameter. Instead of using a bank instance to reach for the live or root fork. The problem that there are some things that should be computed from the root, and others from the live fork. last_id for a client should probably come from root, but for a vote needs to come from the live branch that is being voted on.

Fixes #2555

@aeyakovenko aeyakovenko changed the title reforkering Refactor bank and track root and live bank checkpoints. Feb 4, 2019
}
}

impl Default for BankCheckpoint {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this can be derived automatically

@aeyakovenko
Copy link
Member Author

aeyakovenko commented Feb 5, 2019

#2646 design doc

@garious
Copy link
Contributor

garious commented Feb 5, 2019

@rob-solana, Anatoly posted a bunch of name-change comments at the end of #2646 that also apply to this PR. Can you make those updates before this goes in?

self.process_block(&block)?;
let slot = block[0].tick_height / DEFAULT_TICKS_PER_SLOT;
if slot > 0 && block[0].tick_height % DEFAULT_TICKS_PER_SLOT == 0 {
//TODO: EntryTree should provide base slot
Copy link
Contributor

Choose a reason for hiding this comment

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

EntryTree isn't a thing anymore. And is the base slot needed? Is that just slot zero now?

@garious
Copy link
Contributor

garious commented Feb 7, 2019

What's the point of Bank after this PR? Why not delete the existing Bank and call the new thing Bank?

@garious
Copy link
Contributor

garious commented Feb 8, 2019

Moved to #2689

@garious garious closed this Feb 8, 2019
wen-coding added a commit to wen-coding/solana that referenced this pull request Aug 25, 2024
…s#2640)

Enable wen_restart from command line and update comments.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Aug 27, 2024
…s#2640)

Enable wen_restart from command line and update comments.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants