-
Notifications
You must be signed in to change notification settings - Fork 110
feat(ethexe-consensus
): implement changing validator set for the next era
#4847
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
base: master
Are you sure you want to change the base?
feat(ethexe-consensus
): implement changing validator set for the next era
#4847
Conversation
908490a
to
b3726f6
Compare
ethexe/service/src/tests/mod.rs
Outdated
} | ||
|
||
// #[tokio::test(flavor = "multi_thread")] | ||
// #[ntest::timeout(60_000)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO impl test for validators commitment
ethexe
): Producer validators commitmentethexe-consensus
): implement logic to change validator set for the next era
|
||
# there are patches to disable `memory.grow` and to add offset of reserved memory | ||
wasm-smith = { version = "0.230", git = "https://github.com/gear-tech/wasm-tools", branch = "gear-stable-1.230" } | ||
wasm-smith = { version = "0.230", git = "https://github.com/gear-tech/wasm-tools", branch = "gear-stable-1.230" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
#[debug("ValidatorsVec must be non-empty")] | ||
pub struct TryFromVecError; | ||
|
||
// Usefull conversions from / to `Vec<Address>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful
ethexe/common/src/crypto/address.rs
Outdated
|
||
#[derive(Debug, Display, Error)] | ||
#[display("{:?}", self)] | ||
#[debug("ValidatorsVec must be non-empty")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[debug("ValidatorsVec must be non-empty")] | |
#[debug("Vec must be non-empty")] |
|
||
self.transitions.register_new(actor_id); | ||
} | ||
RouterRequestEvent::NextEraValidatorsCommitted { era_index } => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Processor is not responsible for this kind of events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it to observer
ethexe/observer/src/sync.rs
Outdated
let timelines = self | ||
.db | ||
.gear_exe_timelines() | ||
.ok_or(anyhow!("not fonud gear exe timelines in db"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ok_or(anyhow!("not fonud gear exe timelines in db"))?; | |
.ok_or(anyhow!("not found gear exe timelines in db"))?; |
ethexe/observer/src/sync.rs
Outdated
|
||
self.mark_chain_as_synced(chain.into_iter().rev()); | ||
self.propagate_validators(block, header).await?; | ||
self.propagate_validators_info(block, &header).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propagate_validators_info must be done before mark_chain_as_synced
ethexe/common/src/primitives.rs
Outdated
/// The state switches to [`NextEraValidators::Elected`] at the election checkpoint by calling `makeElectionAt` in the middleware. | ||
/// After the commitment is included in a block, the state switches to [`NextEraValidators::Committed`]. | ||
#[derive(Debug, Clone, Default, PartialEq, Eq, Encode, Decode)] | ||
pub enum NextEraValidators { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like idea of storing next era validators in DB. Why:
- Observer must make election - this is ok right now, but should be moved to consensus service in future (consensus call rpc by self)
- Elected, but not committed validators could be stored in consensus service memory, which is much simpler implementation
- In propagate_validators_info - is the only one case where you use it. It removes rpc access once per era, but increase code complexity all over gear exe code, I don't think is fare trade
/// Static data stored in the database. | ||
/// Expected to be unmutable and set only once. | ||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Encode, Decode)] | ||
pub struct StaticData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use LatestData
ethexe-consensus
): implement logic to change validator set for the next eraethexe-consensus
): implement changing validator set for the next era
…a-validators-support-in-validators
Resolves #4382 #4741
@grishasobol