Skip to content

Commit

Permalink
Renamed STRK to FRI (#570)
Browse files Browse the repository at this point in the history
* renamings

* renamings in integration test

* update docs
  • Loading branch information
marioiordanov committed Aug 2, 2024
1 parent d7436bc commit 6d55097
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
32 changes: 16 additions & 16 deletions crates/starknet-devnet-core/src/starknet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand All @@ -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(),
Expand Down Expand Up @@ -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()?;

Expand Down Expand Up @@ -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,
Expand All @@ -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,
};
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
})
Expand Down
8 changes: 4 additions & 4 deletions crates/starknet-devnet-core/src/starknet/starknet_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ pub struct StarknetConfig {
pub predeployed_accounts_initial_balance: Balance,
pub start_time: Option<u64>,
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<DumpOn>,
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions crates/starknet-devnet-types/src/rpc/gas_modification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use serde::{Deserialize, Serialize};
pub struct GasModificationRequest {
pub gas_price_wei: Option<NonZeroU128>,
pub data_gas_price_wei: Option<NonZeroU128>,
pub gas_price_strk: Option<NonZeroU128>,
pub data_gas_price_strk: Option<NonZeroU128>,
pub gas_price_fri: Option<NonZeroU128>,
pub data_gas_price_fri: Option<NonZeroU128>,
pub generate_block: Option<bool>,
}

Expand All @@ -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 {
Expand All @@ -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;
}
}
}
32 changes: 16 additions & 16 deletions crates/starknet-devnet/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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"),
Expand Down
12 changes: 6 additions & 6 deletions crates/starknet-devnet/tests/general_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 6d55097

Please sign in to comment.