diff --git a/crates/starknet-devnet-core/src/starknet/add_invoke_transaction.rs b/crates/starknet-devnet-core/src/starknet/add_invoke_transaction.rs index f1ccf76cf..5a637dea6 100644 --- a/crates/starknet-devnet-core/src/starknet/add_invoke_transaction.rs +++ b/crates/starknet-devnet-core/src/starknet/add_invoke_transaction.rs @@ -549,8 +549,8 @@ mod tests { starknet.next_block_gas = GasModification { gas_price_wei: nonzero!(1u128), data_gas_price_wei: nonzero!(1u128), - gas_price_strk: nonzero!(1u128), - data_gas_price_strk: nonzero!(1u128), + gas_price_fri: nonzero!(1u128), + data_gas_price_fri: nonzero!(1u128), }; starknet.restart_pending_block().unwrap(); diff --git a/crates/starknet-devnet-core/src/starknet/mod.rs b/crates/starknet-devnet-core/src/starknet/mod.rs index fdf3421c8..469d4a31e 100644 --- a/crates/starknet-devnet-core/src/starknet/mod.rs +++ b/crates/starknet-devnet-core/src/starknet/mod.rs @@ -139,8 +139,8 @@ impl Default for Starknet { next_block_gas: GasModification { gas_price_wei: DEVNET_DEFAULT_GAS_PRICE, data_gas_price_wei: DEVNET_DEFAULT_DATA_GAS_PRICE, - gas_price_strk: DEVNET_DEFAULT_GAS_PRICE, - data_gas_price_strk: DEVNET_DEFAULT_DATA_GAS_PRICE, + gas_price_fri: DEVNET_DEFAULT_GAS_PRICE, + data_gas_price_fri: DEVNET_DEFAULT_DATA_GAS_PRICE, }, messaging: Default::default(), dump_events: Default::default(), @@ -228,9 +228,9 @@ impl Starknet { predeployed_accounts, block_context: Self::init_block_context( config.gas_price_wei, - config.gas_price_strk, + config.gas_price_fri, config.data_gas_price_wei, - config.data_gas_price_strk, + config.data_gas_price_fri, ETH_ERC20_CONTRACT_ADDRESS, STRK_ERC20_CONTRACT_ADDRESS, config.chain_id, @@ -244,8 +244,8 @@ impl Starknet { next_block_gas: GasModification { gas_price_wei: config.gas_price_wei, data_gas_price_wei: config.data_gas_price_wei, - gas_price_strk: config.gas_price_strk, - data_gas_price_strk: config.data_gas_price_strk, + gas_price_fri: config.gas_price_fri, + data_gas_price_fri: config.data_gas_price_fri, }, messaging: Default::default(), dump_events: Default::default(), @@ -303,9 +303,9 @@ impl Starknet { self.blocks.pending_block.header.l1_data_gas_price.price_in_wei = GasPrice(u128::from(self.next_block_gas.data_gas_price_wei)); self.blocks.pending_block.header.l1_gas_price.price_in_fri = - GasPrice(u128::from(self.next_block_gas.gas_price_strk)); + GasPrice(u128::from(self.next_block_gas.gas_price_fri)); self.blocks.pending_block.header.l1_data_gas_price.price_in_fri = - GasPrice(u128::from(self.next_block_gas.data_gas_price_strk)); + GasPrice(u128::from(self.next_block_gas.data_gas_price_fri)); self.restart_pending_block()?; @@ -482,9 +482,9 @@ impl Starknet { #[allow(clippy::too_many_arguments)] fn init_block_context( gas_price_wei: NonZeroU128, - gas_price_strk: NonZeroU128, + gas_price_fri: NonZeroU128, data_gas_price_wei: NonZeroU128, - data_gas_price_strk: NonZeroU128, + data_gas_price_fri: NonZeroU128, eth_fee_token_address: &str, strk_fee_token_address: &str, chain_id: ChainId, @@ -501,9 +501,9 @@ impl Starknet { sequencer_address: contract_address!("0x1000"), gas_prices: GasPrices { eth_l1_gas_price: gas_price_wei, - strk_l1_gas_price: gas_price_strk, + strk_l1_gas_price: gas_price_fri, eth_l1_data_gas_price: data_gas_price_wei, - strk_l1_data_gas_price: data_gas_price_strk, + strk_l1_data_gas_price: data_gas_price_fri, }, use_kzg_da: USE_KZG_DA, }; @@ -545,8 +545,8 @@ impl Starknet { // Block info gas needs to be set here block_info.gas_prices.eth_l1_gas_price = gas_modification.gas_price_wei; block_info.gas_prices.eth_l1_data_gas_price = gas_modification.data_gas_price_wei; - block_info.gas_prices.strk_l1_gas_price = gas_modification.gas_price_strk; - block_info.gas_prices.strk_l1_data_gas_price = gas_modification.data_gas_price_strk; + block_info.gas_prices.strk_l1_gas_price = gas_modification.gas_price_fri; + block_info.gas_prices.strk_l1_data_gas_price = gas_modification.data_gas_price_fri; // TODO: update block_context via preferred method in the documentation *block_context = BlockContext::new( @@ -1452,9 +1452,9 @@ mod tests { ) -> (Starknet, Account) { let mut starknet = Starknet::new(&StarknetConfig { gas_price_wei: nonzero!(1u128), - gas_price_strk: nonzero!(1u128), + gas_price_fri: nonzero!(1u128), data_gas_price_wei: nonzero!(1u128), - data_gas_price_strk: nonzero!(1u128), + data_gas_price_fri: nonzero!(1u128), state_archive, ..Default::default() }) diff --git a/crates/starknet-devnet-core/src/starknet/starknet_config.rs b/crates/starknet-devnet-core/src/starknet/starknet_config.rs index bc45a2b8d..2b3fb67b1 100644 --- a/crates/starknet-devnet-core/src/starknet/starknet_config.rs +++ b/crates/starknet-devnet-core/src/starknet/starknet_config.rs @@ -104,9 +104,9 @@ pub struct StarknetConfig { pub predeployed_accounts_initial_balance: Balance, pub start_time: Option, pub gas_price_wei: NonZeroU128, - pub gas_price_strk: NonZeroU128, + pub gas_price_fri: NonZeroU128, pub data_gas_price_wei: NonZeroU128, - pub data_gas_price_strk: NonZeroU128, + pub data_gas_price_fri: NonZeroU128, #[serde(serialize_with = "serialize_chain_id")] pub chain_id: ChainId, pub dump_on: Option, @@ -135,9 +135,9 @@ impl Default for StarknetConfig { predeployed_accounts_initial_balance: DEVNET_DEFAULT_INITIAL_BALANCE.into(), start_time: None, gas_price_wei: DEVNET_DEFAULT_GAS_PRICE, - gas_price_strk: DEVNET_DEFAULT_GAS_PRICE, + gas_price_fri: DEVNET_DEFAULT_GAS_PRICE, data_gas_price_wei: DEVNET_DEFAULT_DATA_GAS_PRICE, - data_gas_price_strk: DEVNET_DEFAULT_DATA_GAS_PRICE, + data_gas_price_fri: DEVNET_DEFAULT_DATA_GAS_PRICE, chain_id: DEVNET_DEFAULT_CHAIN_ID, dump_on: None, dump_path: None, diff --git a/crates/starknet-devnet-types/src/rpc/gas_modification.rs b/crates/starknet-devnet-types/src/rpc/gas_modification.rs index 88c94210c..e692aebd9 100644 --- a/crates/starknet-devnet-types/src/rpc/gas_modification.rs +++ b/crates/starknet-devnet-types/src/rpc/gas_modification.rs @@ -7,8 +7,8 @@ use serde::{Deserialize, Serialize}; pub struct GasModificationRequest { pub gas_price_wei: Option, pub data_gas_price_wei: Option, - pub gas_price_strk: Option, - pub data_gas_price_strk: Option, + pub gas_price_fri: Option, + pub data_gas_price_fri: Option, pub generate_block: Option, } @@ -17,8 +17,8 @@ pub struct GasModificationRequest { pub struct GasModification { pub gas_price_wei: NonZeroU128, pub data_gas_price_wei: NonZeroU128, - pub gas_price_strk: NonZeroU128, - pub data_gas_price_strk: NonZeroU128, + pub gas_price_fri: NonZeroU128, + pub data_gas_price_fri: NonZeroU128, } impl GasModification { @@ -29,11 +29,11 @@ impl GasModification { if let Some(data_gas_price_wei) = request.data_gas_price_wei { self.data_gas_price_wei = data_gas_price_wei; } - if let Some(gas_price_strk) = request.gas_price_strk { - self.gas_price_strk = gas_price_strk; + if let Some(gas_price_fri) = request.gas_price_fri { + self.gas_price_fri = gas_price_fri; } - if let Some(data_gas_price_strk) = request.data_gas_price_strk { - self.data_gas_price_strk = data_gas_price_strk; + if let Some(data_gas_price_fri) = request.data_gas_price_fri { + self.data_gas_price_fri = data_gas_price_fri; } } } diff --git a/crates/starknet-devnet/src/cli.rs b/crates/starknet-devnet/src/cli.rs index eb47c20b9..a7fd74174 100644 --- a/crates/starknet-devnet/src/cli.rs +++ b/crates/starknet-devnet/src/cli.rs @@ -107,13 +107,13 @@ pub(crate) struct Args { #[arg(help = "Specify the gas price in wei per gas unit;")] gas_price_wei: NonZeroU128, - // Gas price in strk - #[arg(long = "gas-price-strk")] - #[arg(env = "GAS_PRICE_STRK")] - #[arg(value_name = "STRK_PER_GAS_UNIT")] + // Gas price in fri + #[arg(long = "gas-price-fri")] + #[arg(env = "GAS_PRICE_FRI")] + #[arg(value_name = "FRI_PER_GAS_UNIT")] #[arg(default_value_t = DEVNET_DEFAULT_GAS_PRICE)] - #[arg(help = "Specify the gas price in strk per gas unit;")] - gas_price_strk: NonZeroU128, + #[arg(help = "Specify the gas price in fri per gas unit;")] + gas_price_fri: NonZeroU128, // Gas price in wei #[arg(long = "data-gas-price")] @@ -123,13 +123,13 @@ pub(crate) struct Args { #[arg(help = "Specify the gas price in wei per data gas unit;")] data_gas_price_wei: NonZeroU128, - // Gas price in strk - #[arg(long = "data-gas-price-strk")] - #[arg(env = "DATA_GAS_PRICE_STRK")] - #[arg(value_name = "STRK_PER_GAS_UNIT")] + // Gas price in fri + #[arg(long = "data-gas-price-fri")] + #[arg(env = "DATA_GAS_PRICE_FRI")] + #[arg(value_name = "FRI_PER_GAS_UNIT")] #[arg(default_value_t = DEVNET_DEFAULT_DATA_GAS_PRICE)] - #[arg(help = "Specify the gas price in strk per data gas unit;")] - data_gas_price_strk: NonZeroU128, + #[arg(help = "Specify the gas price in fri per data gas unit;")] + data_gas_price_fri: NonZeroU128, #[arg(long = "chain-id")] #[arg(env = "CHAIN_ID")] @@ -223,9 +223,9 @@ impl Args { predeployed_accounts_initial_balance: self.initial_balance.0.clone(), start_time: self.start_time, gas_price_wei: self.gas_price_wei, - gas_price_strk: self.gas_price_strk, + gas_price_fri: self.gas_price_fri, data_gas_price_wei: self.data_gas_price_wei, - data_gas_price_strk: self.data_gas_price_strk, + data_gas_price_fri: self.data_gas_price_fri, chain_id: self.chain_id, dump_on: self.dump_on, dump_path: self.dump_path.clone(), @@ -529,9 +529,9 @@ mod tests { ("--start-time", "START_TIME", "123"), ("--timeout", "TIMEOUT", "12"), ("--gas-price", "GAS_PRICE", "1"), - ("--gas-price-strk", "GAS_PRICE_STRK", "2"), + ("--gas-price-fri", "GAS_PRICE_FRI", "2"), ("--data-gas-price", "DATA_GAS_PRICE", "3"), - ("--data-gas-price-strk", "DATA_GAS_PRICE_STRK", "4"), + ("--data-gas-price-fri", "DATA_GAS_PRICE_FRI", "4"), ("--dump-on", "DUMP_ON", "exit"), ("--dump-path", "DUMP_PATH", "dummy-path"), ("--state-archive-capacity", "STATE_ARCHIVE_CAPACITY", "full"), diff --git a/crates/starknet-devnet/tests/general_integration_tests.rs b/crates/starknet-devnet/tests/general_integration_tests.rs index 3e667184d..4e5baa100 100644 --- a/crates/starknet-devnet/tests/general_integration_tests.rs +++ b/crates/starknet-devnet/tests/general_integration_tests.rs @@ -72,9 +72,9 @@ mod general_integration_tests { "predeployed_accounts_initial_balance": "3", "start_time": 4, "gas_price_wei": 5, - "gas_price_strk": 7, + "gas_price_fri": 7, "data_gas_price_wei": 6, - "data_gas_price_strk": 8, + "data_gas_price_fri": 8, "chain_id": "SN_MAIN", "dump_on": "exit", "dump_path": dump_file.path, @@ -105,12 +105,12 @@ mod general_integration_tests { &serde_json::to_string(&expected_config["start_time"]).unwrap(), "--gas-price", &serde_json::to_string(&expected_config["gas_price_wei"]).unwrap(), - "--gas-price-strk", - &serde_json::to_string(&expected_config["gas_price_strk"]).unwrap(), + "--gas-price-fri", + &serde_json::to_string(&expected_config["gas_price_fri"]).unwrap(), "--data-gas-price", &serde_json::to_string(&expected_config["data_gas_price_wei"]).unwrap(), - "--data-gas-price-strk", - &serde_json::to_string(&expected_config["data_gas_price_strk"]).unwrap(), + "--data-gas-price-fri", + &serde_json::to_string(&expected_config["data_gas_price_fri"]).unwrap(), "--chain-id", "MAINNET", "--dump-on", diff --git a/crates/starknet-devnet/tests/test_gas_modification.rs b/crates/starknet-devnet/tests/test_gas_modification.rs index 5afd465a1..ddc2cb79d 100644 --- a/crates/starknet-devnet/tests/test_gas_modification.rs +++ b/crates/starknet-devnet/tests/test_gas_modification.rs @@ -119,8 +119,8 @@ mod gas_modification_tests { let gas_request = json!({ "gas_price_wei": wei_price, "data_gas_price_wei": wei_price_data, - "gas_price_strk": 7e18 as u128, - "data_gas_price_strk": 6e18 as u128, + "gas_price_fri": 7e18 as u128, + "data_gas_price_fri": 6e18 as u128, "generate_block": true, }); let gas_response = @@ -128,8 +128,8 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": wei_price, "data_gas_price_wei": wei_price_data, - "gas_price_strk": 7e18 as u128, - "data_gas_price_strk": 6e18 as u128, + "gas_price_fri": 7e18 as u128, + "data_gas_price_fri": 6e18 as u128, }); assert_eq!(gas_response, &expected_gas_response); @@ -202,12 +202,12 @@ mod gas_modification_tests { ); let wei_price_first_update = 9e18 as u128; - let strk_price_first_update = 7e18 as u128; + let fri_price_first_update = 7e18 as u128; let gas_request = json!({ "gas_price_wei": wei_price_first_update, "data_gas_price_wei": 8e18 as u128, - "gas_price_strk": strk_price_first_update, - "data_gas_price_strk": 6e18 as u128, + "gas_price_fri": fri_price_first_update, + "data_gas_price_fri": 6e18 as u128, "generate_block": false, }); let gas_response = @@ -215,8 +215,8 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": wei_price_first_update, "data_gas_price_wei": 8e18 as u128, - "gas_price_strk": strk_price_first_update, - "data_gas_price_strk": 6e18 as u128, + "gas_price_fri": fri_price_first_update, + "data_gas_price_fri": 6e18 as u128, }); assert_eq!(gas_response, &expected_gas_response); @@ -239,7 +239,7 @@ mod gas_modification_tests { pending_block.l1_gas_price, ResourcePrice { price_in_wei: Felt::from(wei_price_first_update), - price_in_fri: Felt::from(strk_price_first_update), + price_in_fri: Felt::from(fri_price_first_update), } ); @@ -254,12 +254,12 @@ mod gas_modification_tests { ); let wei_price_second_update = 8e18 as u128; - let strk_price_second_update = 6e18 as u128; + let fri_price_second_update = 6e18 as u128; let gas_request = json!({ "gas_price_wei": wei_price_second_update, "data_gas_price_wei": 7e18 as u128, - "gas_price_strk": strk_price_second_update, - "data_gas_price_strk": 5e18 as u128, + "gas_price_fri": fri_price_second_update, + "data_gas_price_fri": 5e18 as u128, "generate_block": true, }); let gas_response = @@ -267,8 +267,8 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": wei_price_second_update, "data_gas_price_wei": 7e18 as u128, - "gas_price_strk": strk_price_second_update, - "data_gas_price_strk": 5e18 as u128, + "gas_price_fri": fri_price_second_update, + "data_gas_price_fri": 5e18 as u128, }); assert_eq!(gas_response, &expected_gas_response); @@ -278,7 +278,7 @@ mod gas_modification_tests { latest_block.l1_gas_price, ResourcePrice { price_in_wei: Felt::from(wei_price_first_update), - price_in_fri: Felt::from(strk_price_first_update), + price_in_fri: Felt::from(fri_price_first_update), } ); @@ -287,7 +287,7 @@ mod gas_modification_tests { pending_block.l1_gas_price, ResourcePrice { price_in_wei: Felt::from(wei_price_second_update), - price_in_fri: Felt::from(strk_price_second_update), + price_in_fri: Felt::from(fri_price_second_update), } ); } @@ -322,12 +322,12 @@ mod gas_modification_tests { }; let wei_price = 9e8 as u128; - let strk_price = 7e8 as u128; + let fri_price = 7e8 as u128; let gas_request = json!({ "gas_price_wei": 9e8 as u128, "data_gas_price_wei": 8e8 as u128, - "gas_price_strk": 7e8 as u128, - "data_gas_price_strk": 6e8 as u128, + "gas_price_fri": 7e8 as u128, + "data_gas_price_fri": 6e8 as u128, "generate_block": true, }); let gas_response = @@ -335,8 +335,8 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": 9e8 as u128, "data_gas_price_wei": 8e8 as u128, - "gas_price_strk": 7e8 as u128, - "data_gas_price_strk": 6e8 as u128, + "gas_price_fri": 7e8 as u128, + "data_gas_price_fri": 6e8 as u128, }); assert_eq!(gas_response, &expected_gas_response); @@ -348,7 +348,7 @@ mod gas_modification_tests { pending_block.l1_gas_price, ResourcePrice { price_in_wei: Felt::from(wei_price), - price_in_fri: Felt::from(strk_price), + price_in_fri: Felt::from(fri_price), } ); @@ -384,16 +384,16 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": DEVNET_DEFAULT_GAS_PRICE, "data_gas_price_wei": DEVNET_DEFAULT_GAS_PRICE, - "gas_price_strk": DEVNET_DEFAULT_GAS_PRICE, - "data_gas_price_strk": DEVNET_DEFAULT_GAS_PRICE, + "gas_price_fri": DEVNET_DEFAULT_GAS_PRICE, + "data_gas_price_fri": DEVNET_DEFAULT_GAS_PRICE, }); assert_eq!(gas_response, &expected_gas_response); let gas_test_data = [ ("gas_price_wei", 9e18 as u128), ("data_gas_price_wei", 8e18 as u128), - ("gas_price_strk", 7e18 as u128), - ("data_gas_price_strk", 6e18 as u128), + ("gas_price_fri", 7e18 as u128), + ("data_gas_price_fri", 6e18 as u128), ]; for gas_parameter in gas_test_data.iter() { // Construct the JSON request dynamically based on the parameter @@ -421,8 +421,8 @@ mod gas_modification_tests { let expected_gas_response = json!({ "gas_price_wei": 9e18 as u128, "data_gas_price_wei": 8e18 as u128, - "gas_price_strk": 7e18 as u128, - "data_gas_price_strk": 6e18 as u128, + "gas_price_fri": 7e18 as u128, + "data_gas_price_fri": 6e18 as u128, }); assert_eq!(gas_response, &expected_gas_response); diff --git a/website/docs/api.md b/website/docs/api.md index be8d48e74..6d2fdc694 100644 --- a/website/docs/api.md +++ b/website/docs/api.md @@ -30,9 +30,9 @@ To retrieve the current configuration of Devnet, send a `GET` request to `/confi "predeployed_accounts_initial_balance": "1000000000000000000000", "start_time": null, "gas_price_wei": 100000000000, - "gas_price_strk": 100000000000, + "gas_price_fri": 100000000000, "data_gas_price_wei": 100000000000, - "data_gas_price_strk": 100000000000, + "data_gas_price_fri": 100000000000, "chain_id": "SN_SEPOLIA", "dump_on": "exit", "dump_path": "dump_path.json", diff --git a/website/docs/gas.md b/website/docs/gas.md index cef61472e..d7f6f3f92 100644 --- a/website/docs/gas.md +++ b/website/docs/gas.md @@ -24,8 +24,8 @@ JSON-RPC "params": { "gas_price_wei": 1000000, "data_gas_price_wei": 10000, - "gas_price_strk": 10000, - "data_gas_price_strk": 10000, + "gas_price_fri": 10000, + "data_gas_price_fri": 10000, "generate_block": false, } } @@ -39,7 +39,7 @@ The expected response from the server will mirror the request gas parameters, co { "gas_price_wei": 1000000, "data_gas_price_wei": 10000, - "gas_price_strk": 10000, - "data_gas_price_strk": 10000, + "gas_price_fri": 10000, + "data_gas_price_fri": 10000, } ```