-
Notifications
You must be signed in to change notification settings - Fork 65
apollo_consensus_orchestrator: use the config manager client to update consensus context config #11015
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: guyn/context/utility_func_for_validate
Are you sure you want to change the base?
apollo_consensus_orchestrator: use the config manager client to update consensus context config #11015
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7a30efc to
d096f5a
Compare
1fd82a4 to
5f041a9
Compare
5f041a9 to
cbbf859
Compare
1c15588 to
ad32894
Compare
cbbf859 to
3027fcf
Compare
ad32894 to
f9cbefa
Compare
2626188 to
63c6c8f
Compare
f9cbefa to
ca2bd31
Compare
ShahakShama
left a comment
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.
@ShahakShama reviewed 13 files and all commit messages, and made 6 comments.
Reviewable status: 13 of 14 files reviewed, 6 unresolved discussions (waiting on @guy-starkware and @matanl-starkware).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1050 at r2 (raw file):
// required for decision reached flow deps.state_sync_client.expect_add_new_block().times(2).returning(|_| Ok(())); // We never wrote block 0.
Rewrite this to: mock sync to not learn anything in this test
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1056 at r2 (raw file):
let mut context = deps.build_context(); // Validate block number 0.
Redundant comment IMO
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1067 at r3 (raw file):
assert_eq!(proposal_commitment.0, STATE_DIFF_COMMITMENT.0.0); // Decision reached
Same here
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1082 at r3 (raw file):
let mut modified_block_info = block_info(BlockNumber(1)); modified_block_info.l2_gas_price_fri = GasPrice(ODDLY_SPECIFIC_L2_GAS_PRICE);
Why do you send the price you're overriding to? I thought the idea was to test that we override correctly
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1099 at r3 (raw file):
..Default::default() }; let mut config_manager_client = MockConfigManagerClient::new();
Try to extract some of the common code to a utility function in cases where it makes sense
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1109 at r3 (raw file):
modified_block_info.l1_data_gas_price_wei = GasPrice(ODDLY_SPECIFIC_L1_DATA_GAS_PRICE); context.set_height_and_round(BlockNumber(1), 1).await;
Consider splitting this test to two tests: one for advance to next height and one for advance to next round
guy-starkware
left a comment
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.
@guy-starkware made 5 comments and resolved 1 discussion.
Reviewable status: 13 of 14 files reviewed, 5 unresolved discussions (waiting on @matanl-starkware and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1056 at r2 (raw file):
Previously, ShahakShama wrote…
Redundant comment IMO
Not really. We have validation and building, and rounds 0 and 1 at different points in the test. This helps you know which part you are starting.
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1067 at r3 (raw file):
Previously, ShahakShama wrote…
Same here
Yeah, I agree on this one :)
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1082 at r3 (raw file):
Previously, ShahakShama wrote…
Why do you send the price you're overriding to? I thought the idea was to test that we override correctly
I have two options:
- match the incoming block info to the expected (overridden) value, which makes the validation pass.
- leave the regular block info and expect a failure to validate.
I think (1) is more specific, since I don't need a way to check "why did it fail to validate".
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1099 at r3 (raw file):
Previously, ShahakShama wrote…
Try to extract some of the common code to a utility function in cases where it makes sense
Done.
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1109 at r3 (raw file):
Previously, ShahakShama wrote…
Consider splitting this test to two tests: one for advance to next height and one for advance to next round
Seems like a lot of setup for a couple of very similar (short) cases. I also like that we mix the proposing with validating. I think it is less of a headache to read that last case than to read a whole new test (with similar setup, or the setup is split off into a helper).
ca2bd31 to
c732fee
Compare
63c6c8f to
401f4fb
Compare
dafnamatsry
left a comment
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.
@dafnamatsry reviewed 10 files and all commit messages, and made 2 comments.
Reviewable status: 12 of 14 files reviewed, 7 unresolved discussions (waiting on @guy-starkware, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 719 at r4 (raw file):
self.config.dynamic_config = config_manager_client.get_context_dynamic_config().await.unwrap(); }
This function can be called multiple times for the same round, in which case we don't want the dynamic config to change right?
I think you should move this part down to be after the check that the round has advanced.
Code quote:
if let Some(config_manager_client) = self.deps.config_manager_client.clone() {
self.config.dynamic_config =
config_manager_client.get_context_dynamic_config().await.unwrap();
}crates/apollo_consensus_orchestrator/src/test_utils.rs line 149 at r4 (raw file):
self.batcher .expect_start_height() .times(1)
Why? This is an important check.
Code quote:
.times(1)401f4fb to
aa775a7
Compare
c732fee to
db5f020
Compare
aa775a7 to
57d1598
Compare
db5f020 to
49d1491
Compare
guy-starkware
left a comment
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.
@guy-starkware made 2 comments.
Reviewable status: 4 of 14 files reviewed, 7 unresolved discussions (waiting on @dafnamatsry, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 719 at r4 (raw file):
Previously, dafnamatsry wrote…
This function can be called multiple times for the same round, in which case we don't want the dynamic config to change right?
I think you should move this part down to be after the check that the round has advanced.
I think this function is called when we start a new height and when we start a new round. These are the places I want to update my config.
If I move it down after the first return, I don't get an update when a new height starts.
crates/apollo_consensus_orchestrator/src/test_utils.rs line 149 at r4 (raw file):
Previously, dafnamatsry wrote…
Why? This is an important check.
Your comment caused me to dig deeper into how the consensus context tests set up their expectations. I did a big re-haul of the test setup in the previous PRs. I think it will be good if you have a look at them also.
This specific comment I think is no longer relevant...
dafnamatsry
left a comment
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.
@dafnamatsry made 1 comment.
Reviewable status: 4 of 14 files reviewed, 7 unresolved discussions (waiting on @guy-starkware, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 719 at r4 (raw file):
Previously, guy-starkware wrote…
I think this function is called when we start a new height and when we start a new round. These are the places I want to update my config.
If I move it down after the first return, I don't get an update when a new height starts.
It is called for sure multiple times for a round, so if you want to avoid updating the dynamic config in the middle of the round you must move this line down (maybe call it twice on height change & round change).
guy-starkware
left a comment
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.
@guy-starkware made 1 comment.
Reviewable status: 4 of 14 files reviewed, 7 unresolved discussions (waiting on @dafnamatsry, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 719 at r4 (raw file):
Previously, dafnamatsry wrote…
It is called for sure multiple times for a round, so if you want to avoid updating the dynamic config in the middle of the round you must move this line down (maybe call it twice on height change & round change).
Ok, now I see what you mean.
I added a helper function and called it twice, when updating height and round.
49d1491 to
5c7b29c
Compare
dafnamatsry
left a comment
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.
@dafnamatsry reviewed 4 files and all commit messages, made 2 comments, and resolved 2 discussions.
Reviewable status: 8 of 14 files reviewed, 6 unresolved discussions (waiting on @guy-starkware, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 873 at r6 (raw file):
if let Some(config_manager_client) = self.deps.config_manager_client.clone() { self.config.dynamic_config = config_manager_client.get_context_dynamic_config().await.unwrap();
Just log the error and continue (sorry I didn't noticed it before)
Code quote:
.unwrap()5c7b29c to
7da372e
Compare
320327d to
4e6e120
Compare
299c1d0 to
11e5a6d
Compare
guy-starkware
left a comment
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.
@guy-starkware made 1 comment.
Reviewable status: 1 of 14 files reviewed, 6 unresolved discussions (waiting on @dafnamatsry, @matanl-starkware, and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 873 at r6 (raw file):
Previously, dafnamatsry wrote…
Just log the error and continue (sorry I didn't noticed it before)
Done.
guy-starkware
left a comment
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.
@guy-starkware reviewed 14 files and all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dafnamatsry, @matanl-starkware, and @ShahakShama).
guy-starkware
left a comment
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.
@guy-starkware resolved 2 discussions and dismissed @dafnamatsry from a discussion.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @matanl-starkware and @ShahakShama).
ShahakShama
left a comment
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.
@ShahakShama reviewed all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @guy-starkware and @matanl-starkware).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1082 at r3 (raw file):
Previously, guy-starkware wrote…
I have two options:
- match the incoming block info to the expected (overridden) value, which makes the validation pass.
- leave the regular block info and expect a failure to validate.
I think (1) is more specific, since I don't need a way to check "why did it fail to validate".
If it doesn't make the test over-complicated, I prefer having both (first 2 then 1)
I'll leave this up to you
…e consensus context config
4e6e120 to
c0bac21
Compare
11e5a6d to
bba6f1d
Compare
guy-starkware
left a comment
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.
@guy-starkware made 1 comment.
Reviewable status: 12 of 14 files reviewed, 1 unresolved discussion (waiting on @matanl-starkware and @ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 1082 at r3 (raw file):
Previously, ShahakShama wrote…
If it doesn't make the test over-complicated, I prefer having both (first 2 then 1)
I'll leave this up to you
Yeah, that makes sense.

No description provided.