Skip to content
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_consensus_orchestrator): use InternalConsensusTransacti… #3821

Conversation

ShahakShama
Copy link
Contributor

…on in consensus

dorimedini-starkware and others added 2 commits January 29, 2025 17:29
…3806)

* feat(starknet_os): add hints from moonsong's mod.rs

* feat(starknet_os): update the exit_syscall hints to the single hint
@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

github-actions bot commented Jan 30, 2025

@ShahakShama ShahakShama force-pushed the shahak/copy_noam_batcher_internal_tx branch from 0e1431e to dc59e43 Compare January 30, 2025 09:11
@ShahakShama ShahakShama force-pushed the shahak/use_internal_consensus_transaction_in_consensus branch from cbcd34b to a7f5ee5 Compare January 30, 2025 09:12
idan-starkware and others added 3 commits January 30, 2025 09:29
Make scraper track also the last processed block hash, in addition to
number.
Whenever the scraper is about to start scraping again, check if the
last processed block number:
1. Still exists.
2. Fetch it's current block_hash on L1, and compare to the block_hash
   saved after the last scraping ended.
If either of the above checks fail, then this means an L1 reorg has
occured, so the infra should crash the provider and initiate the
provider/scraper startup flow.

Co-authored-by: Gilad Chase <[email protected]>
Copy link
Contributor

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9 of 9 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ShahakShama)


crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 156 at r2 (raw file):

    pub fn new(
        config: ContextConfig,
        class_manager_client: SharedClassManagerClient,

Hmm I had thought the plan was to pass in TransactionConverter and make the context generic over that. Instead we are "generic" (Box) over the class manager.

Code quote:

        class_manager_client: SharedClassManagerClient,

crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 408 at r2 (raw file):

                bouncer_weights: central_objects.bouncer_weights,
            })
            .await;

Suggestion:

let                 transactions= futures::future::join_all(transactions.into_iter().map(|tx| {
                    self.transaction_converter.convert_internal_consensus_tx_to_executable_tx(tx)
                }))
                .await
                .into_iter().collect::<Result<Vec<_>, _>>()
                // TODO(shahak): Do not panic here.
                .expect("Failed converting transactions for cende");
                
        self.cende_ambassador
            .prepare_blob_for_next_height(BlobParameters {
                // TODO(dvir): use the real `BlockInfo` when consensus will save it.
                block_info: BlockInfo { block_number: BlockNumber(height), ..Default::default() },
                state_diff,
                compressed_state_diff: central_objects.compressed_state_diff,
                transactions,
                execution_infos: central_objects.execution_infos,
                bouncer_weights: central_objects.bouncer_weights,
            })
            .await;

crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 811 at r2 (raw file):

            // TODO(shahak): Don't panic here.
            .expect("Failed converting consensus transaction to internal representation");
            debug!("Converted transactions to internal representation.");

This pattern keeps repeating, wanna try creating a helper function?

Code quote:

            let txs = futures::future::join_all(txs.into_iter().map(|tx| {
                transaction_converter.convert_consensus_tx_to_internal_consensus_tx(tx)
            }))
            .await
            .into_iter()
            .collect::<Result<Vec<_>, _>>()
            // TODO(shahak): Don't panic here.
            .expect("Failed converting consensus transaction to internal representation");
            debug!("Converted transactions to internal representation.");

yair-starkware and others added 4 commits January 30, 2025 11:07
#3839)

* feat(starknet_class_manager): adding config to class_manager

commit-id:5fb70d46

* feat(starknet_sequencer_node): adding class_manager config to node config

commit-id:9b946640

* feat(starknet_sequencer_node,starknet_class_manager): adding class_manager to node components

commit-id:267190ec

* feat(starknet_class_manager): adding skeleton implementaation of the ComponentRequestHandler trait

commit-id:6c5e5276
@ShahakShama ShahakShama force-pushed the shahak/use_internal_consensus_transaction_in_consensus branch from a7f5ee5 to 9a76b23 Compare January 30, 2025 11:47
Copy link
Contributor Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 8 of 9 files reviewed, 2 unresolved discussions (waiting on @matan-starkware)


crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 156 at r2 (raw file):

Previously, matan-starkware wrote…

Hmm I had thought the plan was to pass in TransactionConverter and make the context generic over that. Instead we are "generic" (Box) over the class manager.

Yes. There's a TODO in the test to do that. Added also here


crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 811 at r2 (raw file):

Previously, matan-starkware wrote…

This pattern keeps repeating, wanna try creating a helper function?

I think the helper function will be either unreadable (in terms of what it does) or the call to the helper function will be longer than these lines

Copy link
Contributor

@matan-starkware matan-starkware left a 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 r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ShahakShama)


crates/starknet_consensus_orchestrator/src/sequencer_consensus_context.rs line 811 at r2 (raw file):

Previously, ShahakShama wrote…

I think the helper function will be either unreadable (in terms of what it does) or the call to the helper function will be longer than these lines

It wasn't so bad:

Callsite:

        let transactions = convert_all(
            |tx| self.transaction_converter.convert_internal_consensus_tx_to_executable_tx(tx),
            transactions,
        )
        .await;

Definition - generic so can handle any converter:

async fn convert_all<FromT, IntoT, ConverterT, FutT>(
    converter: ConverterT,
    txs: Vec<FromT>,
) -> Vec<IntoT>
where
    ConverterT: Fn(FromT) -> FutT,
    FutT: Future<Output = TransactionConverterResult<IntoT>>,
{
    futures::future::join_all(txs.into_iter().map(|tx| { converter(tx) }))
    .await
    .into_iter().collect::<Result<Vec<_>, _>>()
    // TODO(shahak): Do not panic here.
    .expect("Failed converting transactions for cende")
}

Not blocking just consider it.

AlonLStarkWare and others added 3 commits January 30, 2025 14:55
rename GetProposalContent to GetProposalContentDeprecated
rename SendProposalContent to SendProposalContentDeprecated
block builder convert internal to exe tx using class manager
@ShahakShama ShahakShama force-pushed the shahak/use_internal_consensus_transaction_in_consensus branch from 9a76b23 to def9b3a Compare January 30, 2025 12:55
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.