Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into test/estimate_fee
Browse files Browse the repository at this point in the history
  • Loading branch information
kasteph authored Oct 4, 2023
2 parents 3cc7d00 + 6207f1c commit b36f668
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
7 changes: 1 addition & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"eslint.workingDirectories": ["tests"],
"workbench.colorCustomizations": {
"activityBar.background": "#561529",
"titleBar.activeBackground": "#781E3A",
"titleBar.activeForeground": "#FEFBFC"
}
"eslint.workingDirectories": ["tests"]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 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
- fix: add `madara_path` flag for setup command
Expand Down
2 changes: 1 addition & 1 deletion configs/index.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 2 additions & 0 deletions crates/pallets/starknet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion crates/pallets/starknet/src/tests/deploy_account_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
]),
},
Expand Down
4 changes: 2 additions & 2 deletions crates/pallets/starknet/src/tests/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
]),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions crates/pallets/starknet/src/tests/invoke_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]),
Expand Down Expand Up @@ -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
]),
},
Expand Down
17 changes: 7 additions & 10 deletions crates/primitives/fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b36f668

Please sign in to comment.