-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactor(consensus): create manager which encapsulates messages cached between heights #200
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @matan-starkware and the rest of your teammates on Graphite |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
+ Coverage 76.88% 76.91% +0.03%
==========================================
Files 312 313 +1
Lines 34445 34448 +3
Branches 34445 34448 +3
==========================================
+ Hits 26482 26496 +14
+ Misses 5681 5665 -16
- Partials 2282 2287 +5 ☔ View full report in Codecov by Sentry. |
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.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @matan-starkware)
f50d408
to
63a79b9
Compare
c698a12
to
cf37628
Compare
cf37628
to
f55d15e
Compare
63a79b9
to
4d7d319
Compare
f55d15e
to
b178c8e
Compare
4d7d319
to
69f6412
Compare
b178c8e
to
f06ec08
Compare
69f6412
to
240bd76
Compare
f06ec08
to
00833b3
Compare
240bd76
to
e44b622
Compare
00833b3
to
3e510b3
Compare
e44b622
to
58392fa
Compare
3e510b3
to
2787166
Compare
58392fa
to
c85cf92
Compare
2787166
to
f3c4fd1
Compare
c85cf92
to
502e872
Compare
f3c4fd1
to
b143026
Compare
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.
Reviewed 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: 3 of 4 files reviewed, 4 unresolved discussions (waiting on @asmaastarkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/lib.rs
line 57 at r3 (raw file):
loop { let decision = manager .run_height(&mut context, current_height, validator_id, &mut network_receiver)
Add TODO to support failed rounds (unless the plan is that run_height will run several rounds until it reaches a decision)
crates/sequencing/papyrus_consensus/src/manager.rs
line 26 at r3 (raw file):
use crate::ProposalWrapper; /// Used run Tendermint. Handles issues which are not explicitly part of the single height consensus
WDYM "Used run Tendermint"? Try to improve this sentence
crates/sequencing/papyrus_consensus/src/manager_test.rs
line 27 at r3 (raw file):
#[derive(Debug, PartialEq, Clone)] pub struct TestBlock { pub content: Vec<Transaction>,
Why not use something simpler than Transaction, like u64?
crates/sequencing/papyrus_consensus/src/manager_test.rs
line 117 at r3 (raw file):
#[tokio::test] async fn run_multiple_heights() {
rename to run_multiple_heights_unordered
502e872
to
3d4cb10
Compare
b143026
to
0ce80cd
Compare
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.
Reviewable status: 1 of 4 files reviewed, 4 unresolved discussions (waiting on @asmaastarkware and @ShahakShama)
crates/sequencing/papyrus_consensus/src/lib.rs
line 57 at r3 (raw file):
Previously, ShahakShama wrote…
Add TODO to support failed rounds (unless the plan is that run_height will run several rounds until it reaches a decision)
A height contains multiple rounds. This is something the manager doesn't need to consider.
crates/sequencing/papyrus_consensus/src/manager.rs
line 26 at r3 (raw file):
Previously, ShahakShama wrote…
WDYM "Used run Tendermint"? Try to improve this sentence
Done.
crates/sequencing/papyrus_consensus/src/manager_test.rs
line 27 at r3 (raw file):
Previously, ShahakShama wrote…
Why not use something simpler than Transaction, like u64?
Because we don't support streaming yet. We have the Proposal
ConsensusMessage which includes the field for Transaction
. When we support streaming I will instead make us generic on:
ConsensusStreamMessage: From<ProposalInit> + From<ProposalFin>
I tried faking this genericness now and it lead to a lot of ugly code, so I'd prefer to have the complexity in my test until we have streaming.
crates/sequencing/papyrus_consensus/src/manager_test.rs
line 117 at r3 (raw file):
Previously, ShahakShama wrote…
rename to run_multiple_heights_unordered
Done.
afcfd46
to
dd1cdfa
Compare
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.
Reviewed 1 of 2 files at r2, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @asmaastarkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/manager.rs
line 28 at r5 (raw file):
/// Runs Tendermint repeatedly across different heights. Handles issues which are not explicitly /// part of the single height consensus algorithm (e.g. messages from future heights). pub struct Manager {
Consider renaming to HeightManager or MultiHeightManager
crates/sequencing/papyrus_consensus/src/manager.rs
line 29 at r5 (raw file):
/// part of the single height consensus algorithm (e.g. messages from future heights). pub struct Manager { cached_messages: Vec<ConsensusMessage>,
Change this to HashMap<Height, Vec>. Then cleaning it up will be much more efficient
crates/sequencing/papyrus_consensus/src/manager.rs
line 70 at r5 (raw file):
let mut current_height_messages = Vec::new(); for msg in std::mem::take(&mut self.cached_messages) { match height.0.cmp(&msg.height()) {
Change the ordering of cmp here so that it will be clearer what's going on in the match arms. You should have in the left the thing that's always changing and in the right the constant thing
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @matan-starkware)
…d between heights
dd1cdfa
to
0321499
Compare
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.
Reviewable status: 1 of 4 files reviewed, all discussions resolved (waiting on @asmaastarkware and @ShahakShama)
crates/sequencing/papyrus_consensus/src/manager.rs
line 29 at r5 (raw file):
Previously, ShahakShama wrote…
Change this to HashMap<Height, Vec>. Then cleaning it up will be much more efficient
Sure, but I consider this to be part of the refactor (next PR). I'd like to keep this one just moving the existing code.
crates/sequencing/papyrus_consensus/src/manager.rs
line 70 at r5 (raw file):
Previously, ShahakShama wrote…
Change the ordering of cmp here so that it will be clearer what's going on in the match arms. You should have in the left the thing that's always changing and in the right the constant thing
You put this comment in 208 earlier and I already did it, so to avoid conflicts I'll just leave it there.
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.
Reviewed 3 of 3 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @matan-starkware)
Merge activity
|
This change is