-
Notifications
You must be signed in to change notification settings - Fork 72
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
Pico consensus #3285
base: albatross
Are you sure you want to change the base?
Pico consensus #3285
Conversation
872c575
to
29a54cf
Compare
consensus/src/sync/light/mod.rs
Outdated
@@ -4,4 +4,4 @@ mod sync_stream; | |||
#[cfg(feature = "full")] | |||
mod validity_window; | |||
|
|||
pub use sync::LightMacroSync; | |||
pub use sync::{EpochIds, LightMacroSync, PeerMacroRequests}; |
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.
Why do we need to make it public?
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.
Because they need to be accesible from the pico variant, otherwise:
rror[E0432]: unresolved imports `crate::sync::light::EpochIds`, `crate::sync::light::PeerMacroRequests`
--> consensus/src/sync/pico/sync_requests.rs:17:17
|
17 | light::{EpochIds, PeerMacroRequests},
| ^^^^^^^^ ^^^^^^^^^^^^^^^^^ no `PeerMacroRequests` in `sync::light`
| |
| no `EpochIds` in `sync::light`
|
note: these structs exist but are inaccessible
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.
Another option would be to move those structs to some shared file between light and macro sync
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.
Yeah, to me it means they maybe don't belong here
)); | ||
} | ||
} else { | ||
// We only accept macro blocks from the current epoch |
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.
Shouldn't we check this is a macro block?
Could you also consider adding a pico node to the devnet scenarios? I think it would be valuable to test it as well |
8e4b560
to
ba33b5e
Compare
The PicoMacroSync is a macro sync mechanism that pushes the latest election block that is obtained from a peer, if subsequent (sufficient) peers also have the same latest election (and latest checkpoint blocks) then we move all the peers to live sync and we establish consensus. If some peer has a different state than the initial state we obtained, we need to fallback to the regular light macro sync.
ba33b5e
to
cd63bab
Compare
Create a sync_interface file where common functionality from the different sync implementations can be imported
e750ddc
to
b1b7cdd
Compare
3ab735b
to
da6079e
Compare
When processing epoch ids it could happen that by the time we requested the epoch ids and the time we received those we no longer have anything new to learn from the peer, so we emit it as good.
Pico Consensus Implementation
The PicoMacroSync is a macro sync mechanism that pushes the latest election block
that is obtained from a peer, if subsequent (sufficient) peers also have the same latest election
(and latest checkpoint blocks) then we move all the peers to live sync and we establish consensus.
If some peer has a different state than the initial state we obtained, we need to fallback to the
regular light macro sync.
To use it or try it in the web client:
web-client/src/client/lib.rs
let mut config = builder.volatile().pico().build().expect("Build configuration failed");
You can also set consensus sync mode to 'pico' if you want to test it in a light client
Pull request checklist
clippy
andrustfmt
warnings.