-
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(starknet_batcher): implement sync_block #2604
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## arni/sync_block/batcher_side_communications #2604 +/- ##
=============================================================================
Coverage ? 6.39%
=============================================================================
Files ? 141
Lines ? 17233
Branches ? 17233
=============================================================================
Hits ? 1102
Misses ? 16055
Partials ? 76 ☔ View full report in Codecov by Sentry. |
d30c9d7
to
390db80
Compare
abf48d5
to
2b5c9c3
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 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)
crates/starknet_batcher/src/batcher.rs
line 353 at r1 (raw file):
} pub async fn add_sync_block(&mut self, sync_block: SyncBlock) -> BatcherResult<()> {
We should also abort the active height if there is one, right?
crates/starknet_batcher/src/batcher.rs
line 353 at r1 (raw file):
} pub async fn add_sync_block(&mut self, sync_block: SyncBlock) -> BatcherResult<()> {
Test?
crates/starknet_batcher/src/batcher.rs
line 377 at r1 (raw file):
proposal_output; // TODO(Arni): Move the height and the `info` level log into the function // `commit_proposal_and_block`.
Why not do it here?
Code quote:
// TODO(Arni): Move the height and the `info` level log into the function
// `commit_proposal_and_block`.
c120aea
to
1f28c79
Compare
2b5c9c3
to
bc538a5
Compare
Is this the correct height to be synced to? Code quote: // TODO: Keep the height from start_height or get it from the input. |
1f28c79
to
631a378
Compare
bc538a5
to
aac90c3
Compare
490a9be
to
e6a1c63
Compare
aac90c3
to
ef3461a
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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @alonh5)
crates/starknet_batcher/src/batcher.rs
line 353 at r1 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
We should also abort the active height if there is one, right?
Done.
crates/starknet_batcher/src/batcher.rs
line 353 at r1 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Test?
Done.
crates/starknet_batcher/src/batcher.rs
line 377 at r1 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Why not do it here?
Because it is incorrect!
We talked on DMs. The height for decision_reached
should be the current height.
The height for add_sync_block
should be current height + 1.
e6a1c63
to
7df7381
Compare
ef3461a
to
e200f3e
Compare
8f88d9a
to
d1790d9
Compare
bec2219
to
ede2ad9
Compare
d1790d9
to
1f2e9c0
Compare
ede2ad9
to
f9e62f0
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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @alonh5)
crates/starknet_batcher/src/batcher.rs
line 377 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Because it is incorrect!
We talked on DMs. The height fordecision_reached
should be the current height.
The height foradd_sync_block
should be current height + 1.
- Reverted the changes to the height marker.
- Followed through with the original TODO.
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 r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)
crates/starknet_batcher/src/batcher.rs
line 369 at r5 (raw file):
let info_callback = |height: BlockNumber| { info!("Syncing block at height {} and notifying mempool of the block.", height); };
This callback is cool, but can't we just have the same message for both?
Also add #[instrument(skip(self), err)]
at the top and that way we'll be able to distinct the two.
Code quote:
let info_callback = |height: BlockNumber| {
info!("Syncing block at height {} and notifying mempool of the block.", height);
};
crates/starknet_batcher/src/batcher_test.rs
line 499 at r5 (raw file):
tx_hashes: test_tx_hashes(), })) .returning(|_| Ok(()));
add times(1) so we know they're called.
Code quote:
mock_dependencies
.storage_writer
.expect_commit_proposal()
.with(eq(INITIAL_HEIGHT), eq(test_state_diff()))
.returning(|_, _| Ok(()));
mock_dependencies
.mempool_client
.expect_commit_block()
.with(eq(CommitBlockArgs {
address_to_nonce: test_contract_nonces(),
tx_hashes: test_tx_hashes(),
}))
.returning(|_| Ok(()));
crates/starknet_batcher/src/batcher_test.rs
line 510 at r5 (raw file):
let get_height_response = batcher.get_height().await.unwrap(); assert_eq!(get_height_response.height, INITIAL_HEIGHT);
This should be the next height after syncing one block, no?
But the storage reader is mocked anyway, so there's no need for this check.
Suggestion:
INITIAL_HEIGHT.next()
f9e62f0
to
bc3e41b
Compare
bc3e41b
to
358cf0e
Compare
1f2e9c0
to
0a60f8f
Compare
358cf0e
to
dc171ca
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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @alonh5)
crates/starknet_batcher/src/batcher.rs
line 369 at r5 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
This callback is cool, but can't we just have the same message for both?
Also add#[instrument(skip(self), err)]
at the top and that way we'll be able to distinct the two.
Done. The log changed slightly. For decision_reached
, the info will no longer contain the proposal_id
- we count on the fact that the proposal_id
appears on the call to decision_reached
.
crates/starknet_batcher/src/batcher_test.rs
line 499 at r5 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
add times(1) so we know they're called.
Done.
crates/starknet_batcher/src/batcher_test.rs
line 510 at r5 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
This should be the next height after syncing one block, no?
But the storage reader is mocked anyway, so there's no need for this check.
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 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
Previously, ArniStarkware (Arnon Hod) wrote…
|
No description provided.