Skip to content

Commit

Permalink
Merge pull request #95 from weaveVM/improve-gasenomic
Browse files Browse the repository at this point in the history
feat: improve gasenomic
  • Loading branch information
allnil authored Oct 23, 2024
2 parents 9b1d68c + 49fd1fa commit d96bd65
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion book/run/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ max_blocks = 500000
# The maximum number of state changes to keep in memory before the execution stage commits.
max_changes = 5000000
# The maximum cumulative amount of gas to process before the execution stage commits.
max_cumulative_gas = 15000000000000 # WVM: 300_000_000 * 50_000_000
max_cumulative_gas = 25000000000000 # WVM: 500_000_000 * 50_000_000
# The maximum time spent on blocks processing before the execution stage commits.
max_duration = '10m'
```
Expand Down
4 changes: 2 additions & 2 deletions crates/chainspec/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::spec::DepositContract;
use alloy_primitives::{address, b256};

/// Gas per transaction not creating a contract.
/// WVM: Raised from 21k to 500_000k
pub const MIN_TRANSACTION_GAS: u64 = 500_000u64;
/// WVM: Raised from 21k to 500_000_000
pub const MIN_TRANSACTION_GAS: u64 = 500_000_000u64;
/// Deposit contract address: `0x00000000219ab540356cbb839cbe05303d7705fa`
pub(crate) const MAINNET_DEPOSIT_CONTRACT: DepositContract = DepositContract::new(
address!("00000000219ab540356cbb839cbe05303d7705fa"),
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl ConfigureEvmEnv for EthEvmConfig {
transact_to: TxKind::Call(contract),
// Explicitly set nonce to None so revm does not do any nonce checks
nonce: None,
// WVM: 300_000_000 gas limit
// WVM: 500_000_000 gas limit
gas_limit: *ETHEREUM_BLOCK_GAS_LIMIT,
value: U256::ZERO,
data,
Expand Down
18 changes: 9 additions & 9 deletions crates/primitives-traits/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ pub const BEACON_NONCE: u64 = 0u64;
/// See <https://github.com/paradigmxyz/reth/issues/3233>.
/// WVM: we set 300kk gas limit
pub const ETHEREUM_BLOCK_GAS_LIMIT: LazyCell<u64> = LazyCell::new(|| {
let env_gas_limit = std::env::var("ETHEREUM_BLOCK_GAS_LIMIT");
if let Ok(gas_limit) = env_gas_limit {
gas_limit.as_str().parse::<u64>().unwrap()
} else {
300_000_000
}
}); // WVM: 300_000_000 gas limit
500_000_000
}); // WVM: 500_000_000 gas limit

/// The minimum tx fee below which the txpool will reject the transaction.
///
Expand All @@ -66,14 +61,19 @@ pub const ETHEREUM_BLOCK_GAS_LIMIT: LazyCell<u64> = LazyCell::new(|| {
/// significant harm in leaving this setting as is.
// pub const MIN_PROTOCOL_BASE_FEE: u64 = 7;

pub static MIN_PROTOCOL_BASE_FEE: LazyLock<AtomicU64> = LazyLock::new(|| AtomicU64::new(7));
// WVM: min base fee 7 => 500k
pub static MIN_PROTOCOL_BASE_FEE: LazyLock<AtomicU64> = LazyLock::new(|| AtomicU64::new(500_000u64));

pub(crate) static WVM_FEE_MANAGER: LazyLock<Arc<WvmFeeManager>> = LazyLock::new(|| {
let fee = WvmFee::new(Some(Box::new(move |price| {
let original_price = price as f64 / 1_000_000_000f64;
let lowest_possible_gas_price_in_gwei =
raw_calculate_lowest_possible_gas_price(original_price, *ETHEREUM_BLOCK_GAS_LIMIT);
let to_wei = lowest_possible_gas_price_in_gwei * 1e9;
let mut to_wei = lowest_possible_gas_price_in_gwei * 1e9;
// WVM: minimum fee check
if to_wei < 500_000f64 {
to_wei = 500_000f64;
}
MIN_PROTOCOL_BASE_FEE.store(to_wei as u64, SeqCst);
Ok(())
})));
Expand Down

0 comments on commit d96bd65

Please sign in to comment.