-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(starknet_batcher): pass block info from consensus to batcher #2238
chore(starknet_batcher): pass block info from consensus to batcher #2238
Conversation
Artifacts upload triggered. View details here |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2238 +/- ##
===========================================
- Coverage 40.10% 13.20% -26.91%
===========================================
Files 26 144 +118
Lines 1895 17078 +15183
Branches 1895 17078 +15183
===========================================
+ Hits 760 2255 +1495
- Misses 1100 14707 +13607
- Partials 35 116 +81 ☔ 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 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @dafnamatsry)
a discussion (no related file):
Do gas prices and kzg determined at each proposal, or are they determined at the beginning of each height?
If per height, we can move them to the start height input
crates/starknet_batcher/src/proposal_manager_test.rs
line 37 at r1 (raw file):
static BLOCK_INFO_AT_INITIAL_HEIGHT: LazyLock<BlockInfo> = LazyLock::new(|| BlockInfo { block_number: INITIAL_HEIGHT, ..Default::default() });
Same
Code quote:
static BLOCK_INFO_AT_INITIAL_HEIGHT: LazyLock<BlockInfo> =
LazyLock::new(|| BlockInfo { block_number: INITIAL_HEIGHT, ..Default::default() });
crates/starknet_batcher/src/batcher_test.rs
line 60 at r1 (raw file):
static BLOCK_INFO_AT_INITIAL_HEIGHT: LazyLock<BlockInfo> = LazyLock::new(|| BlockInfo { block_number: INITIAL_HEIGHT, ..Default::default() });
Consider using dummy values so you won't need the lazy lock.
You're supposed to remove the default anyway, right?
Code quote:
static BLOCK_INFO_AT_INITIAL_HEIGHT: LazyLock<BlockInfo> =
LazyLock::new(|| BlockInfo { block_number: INITIAL_HEIGHT, ..Default::default() });
crates/starknet_batcher/src/batcher.rs
line 431 at r1 (raw file):
} // TODO: Move to a common place.
to starknet_batcher_types
Code quote:
common place
crates/starknet_batcher/src/block_builder.rs
line 316 at r1 (raw file):
}, // TODO: Override the use_kzg_da flag. use_kzg_da: self.block_builder_config.use_kzg_da,
Why don't you take these from the next_block_info
?
Code quote:
gas_prices: {
let tmp_val = NonzeroGasPrice::MIN;
GasPrices::new(tmp_val, tmp_val, tmp_val, tmp_val, tmp_val, tmp_val)
},
// TODO: Override the use_kzg_da flag.
use_kzg_da: self.block_builder_config.use_kzg_da,
a18703c
to
66a6242
Compare
228b125
to
2611e29
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 7 files reviewed, 2 unresolved discussions (waiting on @alonh5, @dafnamatsry, and @yair-starkware)
a discussion (no related file):
Previously, yair-starkware (Yair) wrote…
Do gas prices and kzg determined at each proposal, or are they determined at the beginning of each height?
If per height, we can move them to the start height input
IIUC, gas prices are determined at each proposal.
crates/starknet_batcher/src/batcher.rs
line 431 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
to
starknet_batcher_types
Done.
crates/starknet_batcher/src/batcher_test.rs
line 60 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Consider using dummy values so you won't need the lazy lock.
You're supposed to remove the default anyway, right?
Initializing static ContractAddress is difficult, so I do not see how we can lose the lazy lock (other than using a function and computing the value for each test).
Now, we are using create_for_testing()
so that we will not use default when it is not needed.
crates/starknet_batcher/src/block_builder.rs
line 316 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Why don't you take these from the
next_block_info
?
The value of next_block_info
originally comes from: ProposeBlockInput
, which still needs to be filled. Once it is filled, the values should be propagated here.
https://reviewable.io/reviews/starkware-libs/sequencer/2237#-OCTUZwq3yG6618ECY0s
I can see why it is confusing - and maybe some other approach should be taken.
crates/starknet_batcher/src/proposal_manager_test.rs
line 37 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Same
Done.
Benchmark movements: |
66a6242
to
5a70511
Compare
2611e29
to
309ea13
Compare
5a70511
to
90e2c47
Compare
1686844
to
34b91f6
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 10 files reviewed, 2 unresolved discussions (waiting on @alonh5, @dafnamatsry, and @yair-starkware)
-- commits
line 2 at r3:
Update the commit message before merging.
Code quote:
- 34b91f6: chore(batcher): use thin block info to create block info
90e2c47
to
63b74a5
Compare
34b91f6
to
5ee76d7
Compare
522d4cc
to
521b91e
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: 5 of 11 files reviewed, 1 unresolved discussion (waiting on @alonh5, @dafnamatsry, and @yair-starkware)
crates/starknet_batcher/src/block_builder.rs
line 221 at r5 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
If it's not trivial then you're right it shouldn't be in this PR. But in general, do you think it would be possible? Where is the retrospective block hash received now in the OS?
TL;DR: I do not think it is correct to move retrospective block hash
into BlockInfo
.
The term retrospective block hash
appears only in the context of the batcher.
The point where they diverge is here:
sequencer/crates/blockifier/src/blockifier/transaction_executor.rs
Lines 60 to 74 in 111c6fd
pub fn pre_process_and_create( | |
initial_state_reader: S, | |
block_context: BlockContext, | |
old_block_number_and_hash: Option<BlockHashAndNumber>, | |
config: TransactionExecutorConfig, | |
) -> StateResult<Self> { | |
let mut block_state = CachedState::new(initial_state_reader); | |
pre_process_block( | |
&mut block_state, | |
old_block_number_and_hash, | |
block_context.block_info().block_number, | |
&block_context.versioned_constants.os_constants, | |
)?; | |
Ok(Self::new(block_state, block_context, config)) | |
} |
The retrospective block hash is used in this code to pre-process the storage.
The block info is hidden inside the block context - and is later sent to the OS.
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 all commit messages.
Reviewable status: 5 of 11 files reviewed, 1 unresolved discussion (waiting on @alonh5 and @dafnamatsry)
b469204
to
38d7da8
Compare
521b91e
to
87dd372
Compare
38d7da8
to
c2fba98
Compare
87dd372
to
f8df7da
Compare
Benchmark movements: |
c2fba98
to
4fab329
Compare
f8df7da
to
30ae007
Compare
30ae007
to
50bb19b
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: 5 of 11 files reviewed, 3 unresolved discussions (waiting on @alonh5, @dafnamatsry, and @yair-starkware)
crates/starknet_batcher/src/block_builder.rs
line 316 at r15 (raw file):
sequencer_address: block_builder_config.sequencer_address, ..block_metadata.block_info };
Suggestion:
let mut block_info = block_metadata.block_info;
// TODO(Arni): Remove this override, and the corresponding config.
block_info.sequencer_address = block_builder_config.sequencer_address;
crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs
line 169 at r15 (raw file):
}), // TODO(Dan, Matan): Fill block info. Override the sequencer address in the block info // in the BlockBuilderFactory.
Revert. X2.
Suggestion:
// TODO(Dan, Matan): Fill block info.
50bb19b
to
616d561
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: 5 of 11 files reviewed, 1 unresolved discussion (waiting on @alonh5, @dafnamatsry, and @yair-starkware)
crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs
line 169 at r15 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Revert. X2.
Done.
crates/starknet_batcher/src/block_builder.rs
line 316 at r15 (raw file):
sequencer_address: block_builder_config.sequencer_address, ..block_metadata.block_info };
Done.
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 7 files at r11, 2 of 4 files at r13, 2 of 2 files at r16, all commit messages.
Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @alonh5 and @dafnamatsry)
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 7 files at r11, 1 of 1 files at r12, 2 of 4 files at r13, 2 of 2 files at r16, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)
crates/starknet_batcher/src/block_builder.rs
line 221 at r5 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
TL;DR: I do not think it is correct to move
retrospective block hash
intoBlockInfo
.The term
retrospective block hash
appears only in the context of the batcher.
The point where they diverge is here:sequencer/crates/blockifier/src/blockifier/transaction_executor.rs
Lines 60 to 74 in 111c6fd
pub fn pre_process_and_create( initial_state_reader: S, block_context: BlockContext, old_block_number_and_hash: Option<BlockHashAndNumber>, config: TransactionExecutorConfig, ) -> StateResult<Self> { let mut block_state = CachedState::new(initial_state_reader); pre_process_block( &mut block_state, old_block_number_and_hash, block_context.block_info().block_number, &block_context.versioned_constants.os_constants, )?; Ok(Self::new(block_state, block_context, config)) } The retrospective block hash is used in this code to pre-process the storage.
The block info is hidden inside the block context - and is later sent to the OS.
Okay, I didn't fully understand, but it's not important for now. I'll add a task to Monday to reconsider it
Previously, alonh5 (Alon Haramati) wrote…
I think it should not even be on Monday. |
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: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)
You agreed on DMs that all discussions are closed.
* chore(starknet_batcher): delete obsolete todo (starkware-libs#2389) * chore(blockifier): add global max_sierra_gas to versioned constants (starkware-libs#2330) * feat(starknet_api): checked mul for gas vector (starkware-libs#2300) * feat(consensus): proposer rotates across validators (starkware-libs#2405) * feat(sequencing): validate streamed proposals (starkware-libs#2305) * feat(ci): deny rust warnings in all workflows (starkware-libs#2388) Signed-off-by: Dori Medini <[email protected]> * feat(blockifier): compute allocation cost (starkware-libs#2301) * chore(starknet_sequencer_infra): add dynamic logging util fn commit-id:9ffe9fbe * chore(starknet_sequencer_infra): add tracing test commit-id:76d16e9a * chore(starknet_sequencer_infra): add run_until utility fn commit-id:194a4b6c * chore(infra_utils): change run_until to support async functions commit-id:92e1f8a3 * chore(starknet_integration_tests): use run_until to await for block creation commit-id:667e001c * chore(infra_utils): rename logger struct commit-id:6520ae54 * chore(blockifier): explicit creation of AccountTransaction (starkware-libs#2331) * test(starknet_integration_tests): test commit blocks by running multiple heights * chore(starknet_batcher): set temp gas prices in propose block input (starkware-libs#2341) * chore(starknet_batcher): set use_kzg_da flag in build block input (starkware-libs#2345) * feat(ci): inherit the rust toolchain toml in moonrepo action (starkware-libs#2423) Signed-off-by: Dori Medini <[email protected]> * chore(blockifier): enforce_fee() impl by api::executable_transaction::AccountTransaction (starkware-libs#2377) * chore(starknet_integration_tests): inherit sequencer node's stdout (starkware-libs#2427) * chore(blockifier): invoke() declare() deploy_account() change ret val to api_tx (starkware-libs#2412) * chore(starknet_consensus_manager): set proposer address in propose block input (starkware-libs#2346) * feat(consensus): add observer mode * feat(consensus): sequencer context broadcasts votes (starkware-libs#2422) * chore(deployment): support unified deployment config (starkware-libs#2378) * feat(starknet_api): add sierra version to class info (starkware-libs#2313) * refactor(starknet_api): change default sierra contract class to valid one (starkware-libs#2439) * feat(starknet_l1_provider): add uninitiailized state and make it the default (starkware-libs#2434) This is to comply with upcoming integration with infra, which separates instantiation with initialization. In particular, `Pending` state should be already post-syncing with L1, whereas `Uninitialized` is unsynced and unusable. Co-Authored-By: Gilad Chase <[email protected]> * feat(papyrus_storage)!: bump storage version for version 13.4 (starkware-libs#2333) * feat(native_blockifier): allow deserialization of python l1_data_gas (starkware-libs#2447) * refactor(blockifier): split FC to groups base on their tags (starkware-libs#2236) * test(consensus): remove warning on into mock propsal part (starkware-libs#2448) * chore(blockifier): use test_utils::invoke_tx() instead of trans::test_utils::account_invoke_tx() (starkware-libs#2428) * chore(blockifier): save sierra to Feature contracts (starkware-libs#2370) * feat(blockifier): don't count Sierra gas in CairoSteps mode (starkware-libs#2440) * chore(blockifier): convert Sierra gas to L1 gas if in L1 gas mode (starkware-libs#2451) * feat(blockifier): add comprehensive state diff versioned constant (starkware-libs#2407) * chore(starknet_consensus_manager): add chain_id to config * refactor(papyrus_p2p_sync): add random_header utility function (starkware-libs#2381) * chore(starknet_batcher): pass block info from consensus to batcher (starkware-libs#2238) * test(starknet_mempool): tx added to mempool are forwarded to propagator client (starkware-libs#2288) * fix: fix CR comments * test(starknet_mempool): tx added to mempool are forwarded to propagator client * feat(sequencing): cache proposals from bigger heights(starkware-libs#2325) * fix: change to latest ubuntu version in feature combo CI (starkware-libs#2414) * chore(blockifier): replace entry_point_gas_cost with initial_budget (starkware-libs#2247) * test(starknet_gateway): handle todo in test_get_block_info (starkware-libs#2267) * chore(starknet_api): revert use get_packaget_dir instead of env var This reverts commit c45f5cc. commit-id:a48736e7 * chore(starknet_api): rely on env::current_dir() instead of CARGO_MANIFEST_DIR commit-id:301ed4eb * chore(blockifier): move env var from run time to compile time commit-id:80a7265d * chore(starknet_sierra_compile): move env var from run time to compile time commit-id:6e7f2a75 * chore: remove the use of zero as a validator id (starkware-libs#2411) * refactor(papyrus_p2p_sync): add_test receives query size instead of constant (starkware-libs#2379) * fix(blockifier): merge state diff with squash (starkware-libs#2310) * feat(blockifier): get revert receipt only in case of revert (starkware-libs#2471) * chore(starknet_integration_tests): create chain info once (starkware-libs#2482) * chore(starknet_sierra_compile): split build utils commit-id:0f504fd7 * chore(starknet_sierra_compile): set runtime-accessible out_dir env var commit-id:539f16db * chore(starknet_sierra_compile): avoid using OUT_DIR in run time commit-id:cd6fba29 * refactor(starknet_api): use const in sierra version (starkware-libs#2477) * chore: cleanups of OUT_DIR env var (starkware-libs#2484) commit-id:18d61b1d * chore(starknet_api): shorten executable_transaction usage path * fix(sequencing): remove old proposal pipes from consensus (starkware-libs#2452) * test(starknet_integration_tests): match sequencer address with default validator id (starkware-libs#2486) * fix(ci): move specific versioned deps to root toml (starkware-libs#2487) * fix(ci): move specific versioned deps to root toml Signed-off-by: Dori Medini <[email protected]> * fix(starknet_sierra_compile): fix build.rs Signed-off-by: Dori Medini <[email protected]> * chore(starknet_batcher): in block builder use the consensus suplied sequncer address (starkware-libs#2409) * chore: cleanups of CARGO_MANIFEST_DIR env var commit-id:c96f2d88 * fix(starknet_sierra_compile): missing import in feature (starkware-libs#2495) commit-id:abd0a286 * chore(blockifier): add keccak_builtin_gas_cost (starkware-libs#2327) * chore(blockifier): add struct ExecutionFlags to AccTx & use instead of transaction::ExecutionFlags (starkware-libs#2429) * chore(blockifier): add new constructor to AccountTransaction (starkware-libs#2431) * chore(blockifier): remove only_qury from IvokeTxArgs (starkware-libs#2437) * chore(blockifier): remove struct ExecutionFlags and replace w concurrency_mode bool (starkware-libs#2470) * chore(blockifier): remove declare.rs deploy_account.rs invoke.rs from blockifier (starkware-libs#2478) --------- Signed-off-by: Dori Medini <[email protected]> Co-authored-by: YaelD <[email protected]> Co-authored-by: aner-starkware <[email protected]> Co-authored-by: yoavGrs <[email protected]> Co-authored-by: matan-starkware <[email protected]> Co-authored-by: guy-starkware <[email protected]> Co-authored-by: dorimedini-starkware <[email protected]> Co-authored-by: Itay Tsabary <[email protected]> Co-authored-by: avivg-starkware <[email protected]> Co-authored-by: Yair Bakalchuk <[email protected]> Co-authored-by: Arnon Hod <[email protected]> Co-authored-by: Alon Haramati <[email protected]> Co-authored-by: Asmaa Magdoub <[email protected]> Co-authored-by: alon-dotan-starkware <[email protected]> Co-authored-by: AvivYossef-starkware <[email protected]> Co-authored-by: giladchase <[email protected]> Co-authored-by: Gilad Chase <[email protected]> Co-authored-by: DvirYo-starkware <[email protected]> Co-authored-by: nimrod-starkware <[email protected]> Co-authored-by: Meshi Peled <[email protected]> Co-authored-by: Yoni <[email protected]> Co-authored-by: Yael Doweck <[email protected]> Co-authored-by: ShahakShama <[email protected]> Co-authored-by: Alon-Lukatch-Starkware <[email protected]> Co-authored-by: Yonatan-Starkware <[email protected]> Co-authored-by: Yair <[email protected]> Co-authored-by: Itay-Tsabary-Starkware <[email protected]>
No description provided.