diff --git a/CHANGELOG.md b/CHANGELOG.md index dd43a3d7bf..fd61d3f28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next release +- feat: use actual vm resource costs - fix: add setup and run for rpc tests - fix: fix clap for run command - fix: add `madara_path` flag for setup command diff --git a/crates/pallets/starknet/src/tests/deploy_account_tx.rs b/crates/pallets/starknet/src/tests/deploy_account_tx.rs index 9397f58980..f035ef7e69 100644 --- a/crates/pallets/starknet/src/tests/deploy_account_tx.rs +++ b/crates/pallets/starknet/src/tests/deploy_account_tx.rs @@ -50,7 +50,7 @@ fn given_contract_run_deploy_account_tx_works() { data: EventData(vec![ address.0.0, // From StarkFelt::try_from("0xdead").unwrap(), // To - StarkFelt::try_from("0xa582").unwrap(), // Amount low + StarkFelt::try_from("0x195a").unwrap(), // Amount low StarkFelt::from(0u128), // Amount high ]), }, diff --git a/crates/pallets/starknet/src/tests/erc20.rs b/crates/pallets/starknet/src/tests/erc20.rs index afbcd02e06..40444250da 100644 --- a/crates/pallets/starknet/src/tests/erc20.rs +++ b/crates/pallets/starknet/src/tests/erc20.rs @@ -104,7 +104,7 @@ fn given_erc20_transfer_when_invoke_then_it_works() { sender_account.0.0, // From StarkFelt::try_from("0x000000000000000000000000000000000000000000000000000000000000dead") .unwrap(), // Sequencer address - StarkFelt::try_from("0x0000000000000000000000000000000000000000000000000000000000028942") + StarkFelt::try_from("0x00000000000000000000000000000000000000000000000000000000000198de") .unwrap(), // Amount low StarkFelt::from(0u128), // Amount high ]), @@ -198,7 +198,7 @@ fn given_erc20_transfer_when_invoke_then_it_works() { data: EventData(vec![ sender_account.0.0, // From StarkFelt::try_from("0xdead").unwrap(), // Sequencer address - StarkFelt::try_from("0x1b85a").unwrap(), // Amount low + StarkFelt::try_from("0xf118").unwrap(), // Amount low StarkFelt::from(0u128), // Amount high ])}, from_address: Starknet::fee_token_address(), diff --git a/crates/pallets/starknet/src/tests/invoke_tx.rs b/crates/pallets/starknet/src/tests/invoke_tx.rs index 1fd32d8f99..6f603a4c2b 100644 --- a/crates/pallets/starknet/src/tests/invoke_tx.rs +++ b/crates/pallets/starknet/src/tests/invoke_tx.rs @@ -96,7 +96,7 @@ fn given_hardcoded_contract_run_invoke_tx_then_it_works() { StarkFelt::try_from(BLOCKIFIER_ACCOUNT_ADDRESS).unwrap(), StarkFelt::try_from("0x000000000000000000000000000000000000000000000000000000000000dead") .unwrap(), - StarkFelt::try_from("0x000000000000000000000000000000000000000000000000000000000000a136") + StarkFelt::try_from("0x00000000000000000000000000000000000000000000000000000000000001a4") .unwrap(), StarkFelt::from(0u128), ]), @@ -142,7 +142,7 @@ fn given_hardcoded_contract_run_invoke_tx_then_event_is_emitted() { StarkFelt::try_from("0x01a3339ec92ac1061e3e0f8e704106286c642eaf302e94a582e5f95ef5e6b4d0") .unwrap(), // From StarkFelt::try_from("0xdead").unwrap(), // To - StarkFelt::try_from("0xa334").unwrap(), // Amount low + StarkFelt::try_from("0x1a4").unwrap(), // Amount low StarkFelt::from(0u128), // Amount high ]), }, diff --git a/crates/primitives/fee/src/lib.rs b/crates/primitives/fee/src/lib.rs index a4838da243..25160dd443 100644 --- a/crates/primitives/fee/src/lib.rs +++ b/crates/primitives/fee/src/lib.rs @@ -33,17 +33,14 @@ pub const FEE_TRANSFER_N_STORAGE_CHANGES: u8 = 2; // Sender and sequencer balanc /// Number of storage updates to actually charge for the fee transfer tx. pub const FEE_TRANSFER_N_STORAGE_CHANGES_TO_CHARGE: u8 = FEE_TRANSFER_N_STORAGE_CHANGES - 1; // Exclude the sequencer balance update, since it's charged once throughout the batch. -// TODO: add real values here. -// FIXME: https://github.com/keep-starknet-strange/madara/issues/330 static VM_RESOURCE_FEE_COSTS: phf::Map<&'static str, f64> = phf_map! { - "n_steps" => 1_f64, - "pedersen_builtin" => 1_f64, - "range_check_builtin" => 1_f64, - "ecdsa_builtin" => 1_f64, - "bitwise_builtin" => 1_f64, - "poseidon_builtin" => 1_f64, - "output_builtin" => 1_f64, - "ec_op_builtin" => 1_f64, + "n_steps" => 0.01_f64, + "pedersen_builtin" => 0.32_f64, + "range_check_builtin" => 0.16_f64, + "ecdsa_builtin" => 20.48_f64, + "bitwise_builtin" => 0.64_f64, + "poseidon_builtin" => 0.32_f64, + "ec_op_builtin" => 10.24_f64, }; /// Gets the transaction resources.