From 48740455765ecccc0c30c508c0ad7a6be6ef95c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Delabrouille?= <34384633+tdelabro@users.noreply.github.com> Date: Tue, 3 Oct 2023 11:15:34 +0200 Subject: [PATCH 1/3] fix: update index.json to point to madara instead of d-oak --- configs/index.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/index.json b/configs/index.json index 926e72fdb7..ba20092dc4 100644 --- a/configs/index.json +++ b/configs/index.json @@ -1,5 +1,5 @@ { - "remote_base_path": "https://raw.githubusercontent.com/d-roak/madara/feat/configs-index/configs/", + "remote_base_path": "https://raw.githubusercontent.com/keep-starknet-strange/madara/main/configs/", "genesis_assets": [ { "name": "Account.json", From 6d0d5f7920bb35a884406b3f2fab894d8a284131 Mon Sep 17 00:00:00 2001 From: Thomas Butler <58192340+trbutler4@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:17:38 -0500 Subject: [PATCH 2/3] feat: use actual resource cost (#1139) --- CHANGELOG.md | 1 + .../starknet/src/tests/deploy_account_tx.rs | 2 +- crates/pallets/starknet/src/tests/erc20.rs | 4 ++-- crates/pallets/starknet/src/tests/invoke_tx.rs | 4 ++-- crates/primitives/fee/src/lib.rs | 17 +++++++---------- 5 files changed, 13 insertions(+), 15 deletions(-) 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. From 6207f1c3a1376ac9e26d3a18a9685328422ec580 Mon Sep 17 00:00:00 2001 From: Ayush Tomar <41674634+ayushtom@users.noreply.github.com> Date: Wed, 4 Oct 2023 02:54:08 +0530 Subject: [PATCH 3/3] fix: add mp-sequencer-address in pallet crate (#1162) --- .vscode/settings.json | 7 +------ CHANGELOG.md | 1 + crates/pallets/starknet/Cargo.toml | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4f3a722d44..2fc1a1b5fe 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,3 @@ { - "eslint.workingDirectories": ["tests"], - "workbench.colorCustomizations": { - "activityBar.background": "#561529", - "titleBar.activeBackground": "#781E3A", - "titleBar.activeForeground": "#FEFBFC" - } + "eslint.workingDirectories": ["tests"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index fd61d3f28c..b808400b5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next release +- dev: fix rpc test failing - feat: use actual vm resource costs - fix: add setup and run for rpc tests - fix: fix clap for run command diff --git a/crates/pallets/starknet/Cargo.toml b/crates/pallets/starknet/Cargo.toml index 900e216019..8045bcebc1 100644 --- a/crates/pallets/starknet/Cargo.toml +++ b/crates/pallets/starknet/Cargo.toml @@ -96,6 +96,8 @@ std = [ # Starknet "starknet-crypto/std", "blockifier/std", + "mp-sequencer-address/std", + "mp-felt/std", # Other third party dependencies "dep:reqwest", "dep:cairo-lang-casm-contract-class",