diff --git a/Cargo.lock b/Cargo.lock index 2174047f7e..29e7099bad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7398,6 +7398,7 @@ version = "0.0.0" dependencies = [ "assert_matches", "async-trait", + "blockifier", "chrono", "futures", "indexmap 2.6.0", diff --git a/crates/sequencing/papyrus_consensus_orchestrator/Cargo.toml b/crates/sequencing/papyrus_consensus_orchestrator/Cargo.toml index b77bbf80b6..1a1f548ec2 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/Cargo.toml +++ b/crates/sequencing/papyrus_consensus_orchestrator/Cargo.toml @@ -29,6 +29,7 @@ tracing.workspace = true url = { workspace = true, features = ["serde"] } [dev-dependencies] +blockifier.workspace = true infra_utils.workspace = true lazy_static.workspace = true mockall.workspace = true diff --git a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_bouncer_weights.json b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_bouncer_weights.json new file mode 100644 index 0000000000..515843c693 --- /dev/null +++ b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_bouncer_weights.json @@ -0,0 +1,20 @@ +{ + "builtin_count": { + "add_mod": 0, + "bitwise": 0, + "ecdsa": 0, + "ec_op": 0, + "keccak": 0, + "mul_mod": 0, + "pedersen": 4948, + "poseidon": 54, + "range_check": 2301, + "range_check96": 0 + }, + "l1_gas": 0, + "message_segment_length": 0, + "n_events": 2, + "n_steps": 121095, + "state_diff_size": 45, + "sierra_gas": 0 +} diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects_test.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects_test.rs index f25aabbbb0..44087495a4 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects_test.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects_test.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use blockifier::bouncer::{BouncerWeights, BuiltinCount}; use indexmap::indexmap; use rstest::rstest; use serde_json::Value; @@ -56,6 +57,7 @@ pub const CENTRAL_INVOKE_TX_JSON_PATH: &str = "central_invoke_tx.json"; pub const CENTRAL_DEPLOY_ACCOUNT_TX_JSON_PATH: &str = "central_deploy_account_tx.json"; pub const CENTRAL_DECLARE_TX_JSON_PATH: &str = "central_declare_tx.json"; pub const CENTRAL_L1_HANDLER_TX_JSON_PATH: &str = "central_l1_handler_tx.json"; +pub const CENTRAL_BOUNCER_WEIGHTS_JSON_PATH: &str = "central_bouncer_weights.json"; fn central_state_diff_json() -> Value { let state_diff = ThinStateDiff { @@ -240,12 +242,30 @@ fn central_l1_handler_tx_json() -> Value { serde_json::to_value(central_transaction_written).unwrap() } +fn central_bouncer_weights_json() -> Value { + let bouncer_weights = BouncerWeights { + builtin_count: BuiltinCount { + pedersen: 4948, + poseidon: 54, + range_check: 2301, + ..BuiltinCount::empty() + }, + n_events: 2, + n_steps: 121095, + state_diff_size: 45, + ..BouncerWeights::empty() + }; + + serde_json::to_value(bouncer_weights).unwrap() +} + #[rstest] #[case::state_diff(central_state_diff_json(), CENTRAL_STATE_DIFF_JSON_PATH)] #[case::invoke_tx(central_invoke_tx_json(), CENTRAL_INVOKE_TX_JSON_PATH)] #[case::deploy_account_tx(central_deploy_account_tx_json(), CENTRAL_DEPLOY_ACCOUNT_TX_JSON_PATH)] #[case::declare_tx(central_declare_tx_json(), CENTRAL_DECLARE_TX_JSON_PATH)] #[case::l1_handler_tx(central_l1_handler_tx_json(), CENTRAL_L1_HANDLER_TX_JSON_PATH)] +#[case::bouncer_weights(central_bouncer_weights_json(), CENTRAL_BOUNCER_WEIGHTS_JSON_PATH)] fn serialize_central_objects(#[case] rust_json: Value, #[case] python_json_path: &str) { let python_json = read_json_file(python_json_path);