Skip to content

Commit

Permalink
fix(en): better defaults, i.e. the same as used by main node (#3521)
Browse files Browse the repository at this point in the history
Current defaults for EN for gas estimation are different from values
used everywhere, this PR addresses that problem
  • Loading branch information
tomg10 authored Jan 23, 2025
1 parent 3e931be commit 2b5fe98
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,15 +772,15 @@ impl OptionalENConfig {
}

const fn default_estimate_gas_scale_factor() -> f64 {
1.2
1.3
}

const fn default_estimate_gas_acceptable_overestimation() -> u32 {
1_000
5_000
}

const fn default_gas_price_scale_factor() -> f64 {
1.2
1.5
}

const fn default_max_nonce_ahead() -> u32 {
Expand Down
4 changes: 3 additions & 1 deletion core/bin/external_node/src/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ fn parsing_optional_config_from_empty_env() {
Duration::from_millis(100)
);
assert_eq!(config.max_nonce_ahead, 50);
assert_eq!(config.estimate_gas_scale_factor, 1.2);
assert_eq!(config.estimate_gas_scale_factor, 1.3);
assert_eq!(config.gas_price_scale_factor, 1.5);
assert_eq!(config.estimate_gas_acceptable_overestimation, 5000);
assert_eq!(config.vm_concurrency_limit, 2_048);
assert_eq!(config.factory_deps_cache_size(), 128 * BYTES_IN_MEGABYTE);
assert_eq!(config.latest_values_cache_size(), 128 * BYTES_IN_MEGABYTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ EN_PUBSUB_POLLING_INTERVAL=200
EN_MAX_NONCE_AHEAD=50
# The multiplier to use when suggesting gas price. Should be higher than one,
# otherwise if the L1 prices soar, the suggested gas price won't be sufficient to be included in block.
EN_GAS_PRICE_SCALE_FACTOR=1.2
EN_GAS_PRICE_SCALE_FACTOR=1.5
# The factor by which to scale the gasLimit
EN_ESTIMATE_GAS_SCALE_FACTOR=1.2
EN_ESTIMATE_GAS_SCALE_FACTOR=1.3
# The max possible number of gas that `eth_estimateGas` is allowed to overestimate.
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=1000
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=5000
# Max possible size of an ABI encoded tx (in bytes).
# This shouldn't be larger than the value on the main node.
EN_MAX_TX_SIZE=1000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ EN_PUBSUB_POLLING_INTERVAL=200
EN_MAX_NONCE_AHEAD=50
# The multiplier to use when suggesting gas price. Should be higher than one,
# otherwise if the L1 prices soar, the suggested gas price won't be sufficient to be included in block.
EN_GAS_PRICE_SCALE_FACTOR=1.2
EN_GAS_PRICE_SCALE_FACTOR=1.5
# The factor by which to scale the gasLimit
EN_ESTIMATE_GAS_SCALE_FACTOR=1.2
EN_ESTIMATE_GAS_SCALE_FACTOR=1.3
# The max possible number of gas that `eth_estimateGas` is allowed to overestimate.
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=1000
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=5000
# Max possible size of an ABI encoded tx (in bytes).
# This shouldn't be larger than the value on the main node.
EN_MAX_TX_SIZE=1000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ EN_PUBSUB_POLLING_INTERVAL=200
EN_MAX_NONCE_AHEAD=50
# The multiplier to use when suggesting gas price. Should be higher than one,
# otherwise if the L1 prices soar, the suggested gas price won't be sufficient to be included in block.
EN_GAS_PRICE_SCALE_FACTOR=1.2
EN_GAS_PRICE_SCALE_FACTOR=1.5
# The factor by which to scale the gasLimit
EN_ESTIMATE_GAS_SCALE_FACTOR=1.2
EN_ESTIMATE_GAS_SCALE_FACTOR=1.3
# The max possible number of gas that `eth_estimateGas` is allowed to overestimate.
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=1000
EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=5000
# Max possible size of an ABI encoded tx (in bytes).
# This shouldn't be larger than the value on the main node.
EN_MAX_TX_SIZE=1000000
Expand Down

0 comments on commit 2b5fe98

Please sign in to comment.