-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(sequencing): broadcast proposal in a stream #2286
Conversation
0302426
to
4834b5c
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2286 +/- ##
==========================================
- Coverage 40.10% 39.60% -0.50%
==========================================
Files 26 278 +252
Lines 1895 32174 +30279
Branches 1895 32174 +30279
==========================================
+ Hits 760 12744 +11984
- Misses 1100 18365 +17265
- Partials 35 1065 +1030 ☔ View full report in Codecov by Sentry. |
b14f1c8
to
ae10896
Compare
Benchmark movements: |
ae10896
to
1a6c34c
Compare
Benchmark movements: |
5f06879
to
4a79c7e
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 3 of 17 files at r1, 7 of 7 files at r7, all commit messages.
Reviewable status: 10 of 20 files reviewed, 3 unresolved discussions (waiting on @guy-starkware)
crates/starknet_integration_tests/src/utils.rs
line 84 at r7 (raw file):
create_network_config_connected_to_broadcast_channels( papyrus_network::gossipsub_impl::Topic::new( // TODO(guyn): return this to NETWORK_TOPIC once we have integrated streaming.
Are you sure? I think what we want is to add the Vote channel in addition to this streaming one.
Code quote:
// TODO(guyn): return this to NETWORK_TOPIC once we have integrated streaming.
crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs
line 335 at r7 (raw file):
); debug!("Broadcasting proposal fin: {proposal_content_id:?}"); println!("Broadcasting proposal fin: {proposal_content_id:?}");
Suggestion:
debug!("Broadcasting proposal fin: {proposal_content_id:?}");
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 98 at r7 (raw file):
} // Ignore this, in case it comes out of the network before some of the other messages. StreamMessageBody::Fin => (),
Why is this OK? don't we want to check that after Content(Fin) is sent that Stream::Fin is sent? So here this is unexpected, and then after the loop we want to assert this is received?
Code quote:
// Ignore this, in case it comes out of the network before some of the other messages.
StreamMessageBody::Fin => (),
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: 10 of 20 files reviewed, 4 unresolved discussions (waiting on @guy-starkware)
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 79 at r7 (raw file):
broadcasted_messages_receiver.next().await.unwrap().0.unwrap().message, StreamMessageBody::Content(ProposalPart::Init(expected_proposal_init)) );
I think we should get the stream_id from this and assert all messages have this stream_id
Code quote:
assert_eq!(
broadcasted_messages_receiver.next().await.unwrap().0.unwrap().message,
StreamMessageBody::Content(ProposalPart::Init(expected_proposal_init))
);
1a6c34c
to
0271cd9
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: 3 of 20 files reviewed, 4 unresolved discussions (waiting on @matan-starkware)
crates/starknet_integration_tests/src/utils.rs
line 84 at r7 (raw file):
Previously, matan-starkware wrote…
Are you sure? I think what we want is to add the Vote channel in addition to this streaming one.
Yes, this is not related to the voting channel. This is only for the channels that go into Context.
Since I've left the "old plumbing" for passing proposals, there are two NETWORK_TOPICs right now, but we will get rid of the old one soon.
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 79 at r7 (raw file):
Previously, matan-starkware wrote…
I think we should get the stream_id from this and assert all messages have this stream_id
Good idea. I'm also checking that the first message has message_id zero.
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 98 at r7 (raw file):
Previously, matan-starkware wrote…
Why is this OK? don't we want to check that after Content(Fin) is sent that Stream::Fin is sent? So here this is unexpected, and then after the loop we want to assert this is received?
Yeah, this is a little confusing.
I can reorganize this to make sure we get both different fins.
crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs
line 335 at r7 (raw file):
); debug!("Broadcasting proposal fin: {proposal_content_id:?}"); println!("Broadcasting proposal fin: {proposal_content_id:?}");
Thanks! Removed.
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 10 of 17 files at r1, 1 of 7 files at r8, 7 of 7 files at r9, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @guy-starkware)
crates/starknet_integration_tests/src/utils.rs
line 84 at r7 (raw file):
Previously, guy-starkware wrote…
Yes, this is not related to the voting channel. This is only for the channels that go into Context.
Since I've left the "old plumbing" for passing proposals, there are two NETWORK_TOPICs right now, but we will get rid of the old one soon.
Add a TODO that we need to add the vote channels also
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 116 at r9 (raw file):
break; } }
My biggest issue is that I don't like the variables in the loop. I think that they order expected can just be represented in the tests structure.
- Init
- Loop
- Fin
Suggestion:
// Must be const since `assert_matches` ignores variables.
const INCOMING_STREAM_ID: u64 = 0;
assert_eq!(
broadcasted_messages_receiver.next().await.unwrap().0.unwrap(),
StreamMessage {
stream_id: INCOMING_STREAM_ID,
message_id: 0, // Init must be the first message.
message: StreamMessageBody::Content(ProposalPart::Init(expected_proposal_init))
}
);
loop {
let message = broadcasted_messages_receiver.next().await.unwrap().0.unwrap();
assert_eq!(message.stream_id, INCOMING_STREAM_ID);
match message.message {
StreamMessageBody::Content(ProposalPart::Fin(proposal_fin)) => {
assert_eq!(proposal_fin, expected_proposal_fin);
break;
}
StreamMessageBody::Content(ProposalPart::Transactions(transactions)) => {
received_tx_hashes.extend(
transactions
.transactions
.iter()
.map(|tx| tx.calculate_transaction_hash(&chain_id).unwrap()),
);
}
_ => panic!("Unexpected message: {:?}", message),
}
}
assert_matches!(
broadcasted_messages_receiver.next().await.unwrap().0.unwrap(),
StreamMessage {
stream_id: INCOMING_STREAM_ID,
message_id: _,
message: StreamMessageBody::Fin,
}
);
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, 2 unresolved discussions (waiting on @matan-starkware)
crates/starknet_integration_tests/src/utils.rs
line 84 at r7 (raw file):
Previously, matan-starkware wrote…
Add a TODO that we need to add the vote channels also
If I understand this test correctly, it isn't supposed to include the votes. Those go into Consensus. These channels go straight into the Context. I'm not sure where the votes go into the Consensus but it wasn't through this part.
crates/starknet_integration_tests/tests/end_to_end_flow_test.rs
line 116 at r9 (raw file):
Previously, matan-starkware wrote…
My biggest issue is that I don't like the variables in the loop. I think that they order expected can just be represented in the tests structure.
- Init
- Loop
- Fin
This is much nicer, but... I'm not sure the stream ID would be 0 (it can be a lot of things, in general, and it wouldn't even remain a single number for much longer).
Also, I've confirmed that the StreamMessage::Fin
comes before the ProposalPart::Fin
(I'm not sure if this is random order or just the way it comes from the test all the time). So this is a weird test that waits for things to arrive in a weird order.
Let me try to do something more clear.
0271cd9
to
86a41c8
Compare
754fd8d
to
dbcada6
Compare
86a41c8
to
ed17cea
Compare
dbcada6
to
bd0fbd4
Compare
1004131
to
6772663
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 3 of 16 files at r13, 5 of 7 files at r14, all commit messages.
Reviewable status: 8 of 20 files reviewed, 1 unresolved discussion (waiting on @guy-starkware)
crates/starknet_integration_tests/src/utils.rs
line 84 at r7 (raw file):
Previously, guy-starkware wrote…
If I understand this test correctly, it isn't supposed to include the votes. Those go into Consensus. These channels go straight into the Context. I'm not sure where the votes go into the Consensus but it wasn't through this part.
Yes, the test doesn't yet have votes because we don't yet support them... Consensus will need a receiver to receive votes, and the context will need a sender to broadcast votes when we want to support this.
6772663
to
5375ece
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 10 of 16 files at r13, 7 of 7 files at r16, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @guy-starkware)
Benchmark movements: |
03b18a7
to
8821a6f
Compare
8821a6f
to
63a667d
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 12 of 16 files at r13, 8 of 8 files at r21, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @guy-starkware)
This PR adds the ability to broadcast a new proposal from Consensus, using the streamed channel.