Skip to content

Commit

Permalink
Merge pull request #97 from weaveVM/improve-gasenomic
Browse files Browse the repository at this point in the history
Improve gasenomic
  • Loading branch information
allnil authored Oct 23, 2024
2 parents d96bd65 + 9d9b9d6 commit e7831e1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
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_000_000
pub const MIN_TRANSACTION_GAS: u64 = 500_000_000u64;
/// WVM: Raised from 21k to 500_000
pub const MIN_TRANSACTION_GAS: u64 = 500_000u64;
/// Deposit contract address: `0x00000000219ab540356cbb839cbe05303d7705fa`
pub(crate) const MAINNET_DEPOSIT_CONTRACT: DepositContract = DepositContract::new(
address!("00000000219ab540356cbb839cbe05303d7705fa"),
Expand Down
3 changes: 2 additions & 1 deletion crates/node/core/src/args/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ pub struct TxPoolArgs {
#[arg(long = "txpool.pricebump", default_value_t = DEFAULT_PRICE_BUMP)]
pub price_bump: u128,

// WVM: 500_000
/// Minimum base fee required by the protocol.
#[arg(long = "txpool.minimal-protocol-fee", default_value_t = MIN_PROTOCOL_BASE_FEE.load(SeqCst))]
#[arg(long = "txpool.minimal-protocol-fee", default_value_t = 500_000)]
pub minimal_protocol_basefee: u64,

/// The default enforced gas limit for transactions entering the pool
Expand Down
9 changes: 3 additions & 6 deletions crates/primitives-traits/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ pub const BEACON_NONCE: u64 = 0u64;
// TODO: This should be a chain spec parameter.
/// See <https://github.com/paradigmxyz/reth/issues/3233>.
/// WVM: we set 300kk gas limit
pub const ETHEREUM_BLOCK_GAS_LIMIT: LazyCell<u64> = LazyCell::new(|| {
500_000_000
}); // WVM: 500_000_000 gas limit
pub const ETHEREUM_BLOCK_GAS_LIMIT: LazyCell<u64> = LazyCell::new(|| 500_000_000); // WVM: 500_000_000 gas limit

/// The minimum tx fee below which the txpool will reject the transaction.
///
Expand All @@ -62,7 +60,8 @@ pub const ETHEREUM_BLOCK_GAS_LIMIT: LazyCell<u64> = LazyCell::new(|| {
// pub const MIN_PROTOCOL_BASE_FEE: u64 = 7;

// WVM: min base fee 7 => 500k
pub static MIN_PROTOCOL_BASE_FEE: LazyLock<AtomicU64> = LazyLock::new(|| AtomicU64::new(500_000u64));
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| {
Expand Down Expand Up @@ -214,7 +213,6 @@ mod tests {

#[tokio::test]
pub async fn test_wvm_fee_manager() {
std::env::set_var("ETHEREUM_BLOCK_GAS_LIMIT", "500000000");
let init = &*WVM_FEE_MANAGER;
tokio::time::sleep(Duration::from_secs(10)).await;
let latest_gas = get_latest_min_protocol_base_fee();
Expand All @@ -225,7 +223,6 @@ mod tests {

#[tokio::test]
async fn min_protocol_sanity() {
std::env::set_var("ETHEREUM_BLOCK_GAS_LIMIT", "500000000");
let init = &*WVM_FEE_MANAGER;
tokio::time::sleep(Duration::from_secs(10)).await;
assert_eq!(MIN_PROTOCOL_BASE_FEE_U256.to::<u64>(), get_latest_min_protocol_base_fee());
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-server-types/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ pub mod gas_oracle {
/// This is different from the default to regular 30M block gas limit
/// [`ETHEREUM_BLOCK_GAS_LIMIT`](reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT) to allow
/// for more complex calls.
pub const RPC_DEFAULT_GAS_CAP: u64 = 50_000_000;
// WVM: 500_000_000
pub const RPC_DEFAULT_GAS_CAP: u64 = 500_000_000;

/// Allowed error ratio for gas estimation
/// Taken from Geth's implementation in order to pass the hive tests
Expand Down

0 comments on commit e7831e1

Please sign in to comment.