@@ -48,11 +48,9 @@ pub const DEFAULT_MNEMONIC: &str = "test test test test test test test test test
4848pub const DEFAULT_IPC_ENDPOINT : & str =
4949 if cfg ! ( unix) { "/tmp/anvil.ipc" } else { r"\\.\pipe\anvil.ipc" } ;
5050
51- /// Initial base fee for EIP-1559 blocks.
52- pub const INITIAL_BASE_FEE : u64 = 1_000_000_000 ;
53-
54- /// Initial default gas price for the first block
55- pub const INITIAL_GAS_PRICE : u128 = 1_875_000_000 ;
51+ /// In anvil this is `1_000_000_000`, in 1e18 denomination. However,
52+ /// asset-hub-westend runtime sets it to `1_000_000`.
53+ pub const INITIAL_BASE_FEE : u128 = 1_000_000 ;
5654
5755const BANNER : & str = r"
5856 _ _
@@ -272,10 +270,8 @@ pub struct AnvilNodeConfig {
272270 pub gas_limit : Option < u128 > ,
273271 /// If set to `true`, disables the block gas limit
274272 pub disable_block_gas_limit : bool ,
275- /// Default gas price for all txs
276- pub gas_price : Option < u128 > ,
277273 /// Default base fee
278- pub base_fee : Option < u64 > ,
274+ pub base_fee : Option < u128 > ,
279275 /// If set to `true`, disables the enforcement of a minimum suggested priority fee
280276 pub disable_min_priority_fee : bool ,
281277 /// Signer accounts that will be initialised with `genesis_balance` in the genesis block
@@ -482,7 +478,6 @@ Genesis Number
482478 "private_keys" : private_keys,
483479 "wallet" : wallet_description,
484480 "base_fee" : format!( "{}" , self . get_base_fee( ) ) ,
485- "gas_price" : format!( "{}" , self . get_gas_price( ) ) ,
486481 "gas_limit" : gas_limit,
487482 "genesis_timestamp" : format!( "{}" , self . get_genesis_timestamp( ) ) ,
488483 } )
@@ -521,7 +516,6 @@ impl Default for AnvilNodeConfig {
521516 chain_id : None ,
522517 gas_limit : None ,
523518 disable_block_gas_limit : false ,
524- gas_price : None ,
525519 signer_accounts : genesis_accounts. clone ( ) ,
526520 genesis_timestamp : None ,
527521 genesis_block_number : None ,
@@ -562,18 +556,19 @@ impl AnvilNodeConfig {
562556 self . memory_limit = mems_value;
563557 self
564558 }
559+
565560 /// Returns the base fee to use
566- pub fn get_base_fee ( & self ) -> u64 {
561+ pub fn get_base_fee ( & self ) -> u128 {
567562 self . base_fee
568- . or_else ( || self . genesis . as_ref ( ) . and_then ( |g| g. base_fee_per_gas . map ( |g| g as u64 ) ) )
563+ . or_else ( || {
564+ self . genesis . as_ref ( ) . and_then ( |g| {
565+ // The base fee received via CLI will be transformed to 1e-12.
566+ g. base_fee_per_gas
567+ } )
568+ } )
569569 . unwrap_or ( INITIAL_BASE_FEE )
570570 }
571571
572- /// Returns the base fee to use
573- pub fn get_gas_price ( & self ) -> u128 {
574- self . gas_price . unwrap_or ( INITIAL_GAS_PRICE )
575- }
576-
577572 /// Sets a custom code size limit
578573 #[ must_use]
579574 pub fn with_code_size_limit ( mut self , code_size_limit : Option < usize > ) -> Self {
@@ -624,17 +619,10 @@ impl AnvilNodeConfig {
624619 self
625620 }
626621
627- /// Sets the gas price
628- #[ must_use]
629- pub fn with_gas_price ( mut self , gas_price : Option < u128 > ) -> Self {
630- self . gas_price = gas_price;
631- self
632- }
633-
634622 /// Sets the base fee
635623 #[ must_use]
636624 pub fn with_base_fee ( mut self , base_fee : Option < u64 > ) -> Self {
637- self . base_fee = base_fee;
625+ self . base_fee = base_fee. map ( |bf| bf . into ( ) ) ;
638626 self
639627 }
640628
0 commit comments