Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions crates/starknet_os_flow_tests/src/os_resources_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ async fn test_execute_txs_inner_resources() {
let version = StarknetVersion::LATEST;
let mut raw_vc: RawVersionedConstants =
serde_json::from_str(VersionedConstants::json_str(&version).unwrap()).unwrap();
const N_TXS: usize = 6;
const N_TXS: usize = 7;

let OsResourcesTestSetup {
stable_contract_address,
Expand Down Expand Up @@ -584,6 +584,13 @@ async fn test_execute_txs_inner_resources() {
calldata![Felt::from(100), Felt::ZERO],
None,
);
test_builder.add_l1_handler(
stable_contract_address,
"l1_handler",
// From address, extra args.
calldata![Felt::from(100), Felt::ONE, Felt::ZERO],
None,
);

// Execute the business logic and extract the business logic resources for each tx.
let test_runner = test_builder.build().await;
Expand Down Expand Up @@ -623,7 +630,8 @@ async fn test_execute_txs_inner_resources() {
declare_overhead,
deploy_account_base,
deploy_account_extra,
l1_handler_overhead,
l1_handler_base,
l1_handler_extra,
]: [ExecutionResources; N_TXS] = test_output
.runner_output
.txs_trace
Expand Down Expand Up @@ -719,7 +727,6 @@ async fn test_execute_txs_inner_resources() {
);

// L1 handler: variable cost, unscaled.
// TODO(Dori): Compute linear factor cost.
let VariableResourceParams::WithFactor(mut l1_handler_resources_params) =
raw_vc.os_resources.execute_txs_inner.get(&TransactionType::L1Handler).unwrap().clone()
else {
Expand All @@ -734,7 +741,10 @@ async fn test_execute_txs_inner_resources() {
"L1 handler scaling factor has unexpected structure: {:?}",
l1_handler_resources_params.calldata_factor
);
l1_handler_resources_params.constant = l1_handler_overhead;
l1_handler_resources_params.calldata_factor = VariableCallDataFactor::Unscaled(
(&l1_handler_extra - &l1_handler_base).filter_unused_builtins(),
);
l1_handler_resources_params.constant = l1_handler_base;
Comment thread
cursor[bot] marked this conversation as resolved.
raw_vc.os_resources.execute_txs_inner.insert(
TransactionType::L1Handler,
VariableResourceParams::WithFactor(l1_handler_resources_params),
Expand Down
Loading