mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-12 17:01:06 +00:00
Add code to disable the fallback gas filler
This commit is contained in:
+14
-4
@@ -91,7 +91,8 @@ impl Platform for GethEvmSolcPlatform {
|
|||||||
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
let node = GethNode::new(context);
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
|
let node = GethNode::new(context, use_fallback_gas_filler);
|
||||||
let node = spawn_node::<GethNode>(node, genesis)?;
|
let node = spawn_node::<GethNode>(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
}))
|
}))
|
||||||
@@ -145,7 +146,8 @@ impl Platform for LighthouseGethEvmSolcPlatform {
|
|||||||
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
let node = LighthouseGethNode::new(context);
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
|
let node = LighthouseGethNode::new(context, use_fallback_gas_filler);
|
||||||
let node = spawn_node::<LighthouseGethNode>(node, genesis)?;
|
let node = spawn_node::<LighthouseGethNode>(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
}))
|
}))
|
||||||
@@ -206,12 +208,14 @@ impl Platform for ReviveDevNodePolkavmResolcPlatform {
|
|||||||
|
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
let node = SubstrateNode::new(
|
let node = SubstrateNode::new(
|
||||||
revive_dev_node_path,
|
revive_dev_node_path,
|
||||||
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
||||||
Some(revive_dev_node_consensus),
|
Some(revive_dev_node_consensus),
|
||||||
context,
|
context,
|
||||||
ð_rpc_connection_strings,
|
ð_rpc_connection_strings,
|
||||||
|
use_fallback_gas_filler,
|
||||||
);
|
);
|
||||||
let node = spawn_node(node, genesis)?;
|
let node = spawn_node(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
@@ -274,12 +278,14 @@ impl Platform for ReviveDevNodeRevmSolcPlatform {
|
|||||||
|
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
let node = SubstrateNode::new(
|
let node = SubstrateNode::new(
|
||||||
revive_dev_node_path,
|
revive_dev_node_path,
|
||||||
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
||||||
Some(revive_dev_node_consensus),
|
Some(revive_dev_node_consensus),
|
||||||
context,
|
context,
|
||||||
ð_rpc_connection_strings,
|
ð_rpc_connection_strings,
|
||||||
|
use_fallback_gas_filler,
|
||||||
);
|
);
|
||||||
let node = spawn_node(node, genesis)?;
|
let node = spawn_node(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
@@ -338,7 +344,9 @@ impl Platform for ZombienetPolkavmResolcPlatform {
|
|||||||
.clone();
|
.clone();
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
let node = ZombienetNode::new(polkadot_parachain_path, context);
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
|
let node =
|
||||||
|
ZombienetNode::new(polkadot_parachain_path, context, use_fallback_gas_filler);
|
||||||
let node = spawn_node(node, genesis)?;
|
let node = spawn_node(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
}))
|
}))
|
||||||
@@ -395,7 +403,9 @@ impl Platform for ZombienetRevmSolcPlatform {
|
|||||||
.clone();
|
.clone();
|
||||||
let genesis = genesis_configuration.genesis()?.clone();
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
Ok(thread::spawn(move || {
|
Ok(thread::spawn(move || {
|
||||||
let node = ZombienetNode::new(polkadot_parachain_path, context);
|
let use_fallback_gas_filler = matches!(context, Context::Test(..));
|
||||||
|
let node =
|
||||||
|
ZombienetNode::new(polkadot_parachain_path, context, use_fallback_gas_filler);
|
||||||
let node = spawn_node(node, genesis)?;
|
let node = spawn_node(node, genesis)?;
|
||||||
Ok(Box::new(node) as Box<_>)
|
Ok(Box::new(node) as Box<_>)
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ pub struct GethNode {
|
|||||||
wallet: Arc<EthereumWallet>,
|
wallet: Arc<EthereumWallet>,
|
||||||
nonce_manager: CachedNonceManager,
|
nonce_manager: CachedNonceManager,
|
||||||
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GethNode {
|
impl GethNode {
|
||||||
@@ -100,6 +101,7 @@ impl GethNode {
|
|||||||
+ AsRef<WalletConfiguration>
|
+ AsRef<WalletConfiguration>
|
||||||
+ AsRef<GethConfiguration>
|
+ AsRef<GethConfiguration>
|
||||||
+ Clone,
|
+ Clone,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let working_directory_configuration =
|
let working_directory_configuration =
|
||||||
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context);
|
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context);
|
||||||
@@ -126,6 +128,7 @@ impl GethNode {
|
|||||||
wallet: wallet.clone(),
|
wallet: wallet.clone(),
|
||||||
nonce_manager: Default::default(),
|
nonce_manager: Default::default(),
|
||||||
provider: Default::default(),
|
provider: Default::default(),
|
||||||
|
use_fallback_gas_filler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +249,8 @@ impl GethNode {
|
|||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
construct_concurrency_limited_provider::<Ethereum, _>(
|
construct_concurrency_limited_provider::<Ethereum, _>(
|
||||||
self.connection_string.as_str(),
|
self.connection_string.as_str(),
|
||||||
FallbackGasFiller::default(),
|
FallbackGasFiller::default()
|
||||||
|
.with_use_fallback_gas_filler(self.use_fallback_gas_filler),
|
||||||
ChainIdFiller::new(Some(CHAIN_ID)),
|
ChainIdFiller::new(Some(CHAIN_ID)),
|
||||||
NonceFiller::new(self.nonce_manager.clone()),
|
NonceFiller::new(self.nonce_manager.clone()),
|
||||||
self.wallet.clone(),
|
self.wallet.clone(),
|
||||||
@@ -742,7 +746,7 @@ mod tests {
|
|||||||
|
|
||||||
fn new_node() -> (TestExecutionContext, GethNode) {
|
fn new_node() -> (TestExecutionContext, GethNode) {
|
||||||
let context = test_config();
|
let context = test_config();
|
||||||
let mut node = GethNode::new(&context);
|
let mut node = GethNode::new(&context, true);
|
||||||
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
||||||
.expect("Failed to initialize the node")
|
.expect("Failed to initialize the node")
|
||||||
.spawn_process()
|
.spawn_process()
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ pub struct LighthouseGethNode {
|
|||||||
|
|
||||||
persistent_http_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
persistent_http_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
persistent_ws_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
persistent_ws_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
|
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LighthouseGethNode {
|
impl LighthouseGethNode {
|
||||||
@@ -127,6 +129,7 @@ impl LighthouseGethNode {
|
|||||||
+ AsRef<WalletConfiguration>
|
+ AsRef<WalletConfiguration>
|
||||||
+ AsRef<KurtosisConfiguration>
|
+ AsRef<KurtosisConfiguration>
|
||||||
+ Clone,
|
+ Clone,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let working_directory_configuration =
|
let working_directory_configuration =
|
||||||
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context);
|
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context);
|
||||||
@@ -176,6 +179,7 @@ impl LighthouseGethNode {
|
|||||||
nonce_manager: Default::default(),
|
nonce_manager: Default::default(),
|
||||||
persistent_http_provider: OnceCell::const_new(),
|
persistent_http_provider: OnceCell::const_new(),
|
||||||
persistent_ws_provider: OnceCell::const_new(),
|
persistent_ws_provider: OnceCell::const_new(),
|
||||||
|
use_fallback_gas_filler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +378,8 @@ impl LighthouseGethNode {
|
|||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
construct_concurrency_limited_provider::<Ethereum, _>(
|
construct_concurrency_limited_provider::<Ethereum, _>(
|
||||||
self.ws_connection_string.as_str(),
|
self.ws_connection_string.as_str(),
|
||||||
FallbackGasFiller::default(),
|
FallbackGasFiller::default()
|
||||||
|
.with_use_fallback_gas_filler(self.use_fallback_gas_filler),
|
||||||
ChainIdFiller::new(Some(CHAIN_ID)),
|
ChainIdFiller::new(Some(CHAIN_ID)),
|
||||||
NonceFiller::new(self.nonce_manager.clone()),
|
NonceFiller::new(self.nonce_manager.clone()),
|
||||||
self.wallet.clone(),
|
self.wallet.clone(),
|
||||||
@@ -1152,7 +1157,7 @@ mod tests {
|
|||||||
let _guard = NODE_START_MUTEX.lock().unwrap();
|
let _guard = NODE_START_MUTEX.lock().unwrap();
|
||||||
|
|
||||||
let context = test_config();
|
let context = test_config();
|
||||||
let mut node = LighthouseGethNode::new(&context);
|
let mut node = LighthouseGethNode::new(&context, true);
|
||||||
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
||||||
.expect("Failed to initialize the node")
|
.expect("Failed to initialize the node")
|
||||||
.spawn_process()
|
.spawn_process()
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ pub struct SubstrateNode {
|
|||||||
nonce_manager: CachedNonceManager,
|
nonce_manager: CachedNonceManager,
|
||||||
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
consensus: Option<String>,
|
consensus: Option<String>,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SubstrateNode {
|
impl SubstrateNode {
|
||||||
@@ -105,6 +106,7 @@ impl SubstrateNode {
|
|||||||
+ AsRef<EthRpcConfiguration>
|
+ AsRef<EthRpcConfiguration>
|
||||||
+ AsRef<WalletConfiguration>,
|
+ AsRef<WalletConfiguration>,
|
||||||
existing_connection_strings: &[String],
|
existing_connection_strings: &[String],
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let working_directory_path =
|
let working_directory_path =
|
||||||
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context).as_path();
|
AsRef::<WorkingDirectoryConfiguration>::as_ref(&context).as_path();
|
||||||
@@ -137,6 +139,7 @@ impl SubstrateNode {
|
|||||||
nonce_manager: Default::default(),
|
nonce_manager: Default::default(),
|
||||||
provider: Default::default(),
|
provider: Default::default(),
|
||||||
consensus,
|
consensus,
|
||||||
|
use_fallback_gas_filler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +327,12 @@ impl SubstrateNode {
|
|||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
construct_concurrency_limited_provider::<Ethereum, _>(
|
construct_concurrency_limited_provider::<Ethereum, _>(
|
||||||
self.rpc_url.as_str(),
|
self.rpc_url.as_str(),
|
||||||
FallbackGasFiller::new(u64::MAX, 50_000_000_000, 1_000_000_000),
|
FallbackGasFiller::new(
|
||||||
|
u64::MAX,
|
||||||
|
50_000_000_000,
|
||||||
|
1_000_000_000,
|
||||||
|
self.use_fallback_gas_filler,
|
||||||
|
),
|
||||||
ChainIdFiller::new(Some(CHAIN_ID)),
|
ChainIdFiller::new(Some(CHAIN_ID)),
|
||||||
NonceFiller::new(self.nonce_manager.clone()),
|
NonceFiller::new(self.nonce_manager.clone()),
|
||||||
self.wallet.clone(),
|
self.wallet.clone(),
|
||||||
@@ -825,6 +833,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
&context,
|
&context,
|
||||||
&[],
|
&[],
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
node.init(context.genesis_configuration.genesis().unwrap().clone())
|
||||||
.expect("Failed to initialize the node")
|
.expect("Failed to initialize the node")
|
||||||
@@ -896,6 +905,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
&context,
|
&context,
|
||||||
&[],
|
&[],
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Call `init()`
|
// Call `init()`
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ pub struct ZombienetNode {
|
|||||||
nonce_manager: CachedNonceManager,
|
nonce_manager: CachedNonceManager,
|
||||||
|
|
||||||
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
|
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZombienetNode {
|
impl ZombienetNode {
|
||||||
@@ -137,6 +139,7 @@ impl ZombienetNode {
|
|||||||
context: impl AsRef<WorkingDirectoryConfiguration>
|
context: impl AsRef<WorkingDirectoryConfiguration>
|
||||||
+ AsRef<EthRpcConfiguration>
|
+ AsRef<EthRpcConfiguration>
|
||||||
+ AsRef<WalletConfiguration>,
|
+ AsRef<WalletConfiguration>,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let eth_proxy_binary = AsRef::<EthRpcConfiguration>::as_ref(&context)
|
let eth_proxy_binary = AsRef::<EthRpcConfiguration>::as_ref(&context)
|
||||||
.path
|
.path
|
||||||
@@ -164,6 +167,7 @@ impl ZombienetNode {
|
|||||||
connection_string: String::new(),
|
connection_string: String::new(),
|
||||||
node_rpc_port: None,
|
node_rpc_port: None,
|
||||||
provider: Default::default(),
|
provider: Default::default(),
|
||||||
|
use_fallback_gas_filler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +334,12 @@ impl ZombienetNode {
|
|||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
construct_concurrency_limited_provider::<Ethereum, _>(
|
construct_concurrency_limited_provider::<Ethereum, _>(
|
||||||
self.connection_string.as_str(),
|
self.connection_string.as_str(),
|
||||||
FallbackGasFiller::new(u64::MAX, 5_000_000_000, 1_000_000_000),
|
FallbackGasFiller::new(
|
||||||
|
u64::MAX,
|
||||||
|
5_000_000_000,
|
||||||
|
1_000_000_000,
|
||||||
|
self.use_fallback_gas_filler,
|
||||||
|
),
|
||||||
ChainIdFiller::default(), // TODO: use CHAIN_ID constant
|
ChainIdFiller::default(), // TODO: use CHAIN_ID constant
|
||||||
NonceFiller::new(self.nonce_manager.clone()),
|
NonceFiller::new(self.nonce_manager.clone()),
|
||||||
self.wallet.clone(),
|
self.wallet.clone(),
|
||||||
@@ -823,6 +832,7 @@ mod tests {
|
|||||||
let mut node = ZombienetNode::new(
|
let mut node = ZombienetNode::new(
|
||||||
context.polkadot_parachain_configuration.path.clone(),
|
context.polkadot_parachain_configuration.path.clone(),
|
||||||
&context,
|
&context,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
let genesis = context.genesis_configuration.genesis().unwrap().clone();
|
let genesis = context.genesis_configuration.genesis().unwrap().clone();
|
||||||
node.init(genesis).unwrap();
|
node.init(genesis).unwrap();
|
||||||
@@ -936,6 +946,7 @@ mod tests {
|
|||||||
let node = ZombienetNode::new(
|
let node = ZombienetNode::new(
|
||||||
context.polkadot_parachain_configuration.path.clone(),
|
context.polkadot_parachain_configuration.path.clone(),
|
||||||
&context,
|
&context,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -956,6 +967,7 @@ mod tests {
|
|||||||
let node = ZombienetNode::new(
|
let node = ZombienetNode::new(
|
||||||
context.polkadot_parachain_configuration.path.clone(),
|
context.polkadot_parachain_configuration.path.clone(),
|
||||||
&context,
|
&context,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use alloy::{
|
|||||||
Provider, SendableTx,
|
Provider, SendableTx,
|
||||||
fillers::{GasFiller, TxFiller},
|
fillers::{GasFiller, TxFiller},
|
||||||
},
|
},
|
||||||
transports::TransportResult,
|
transports::{TransportError, TransportResult},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Percentage padding applied to estimated gas (e.g. 120 = 20% padding)
|
// Percentage padding applied to estimated gas (e.g. 120 = 20% padding)
|
||||||
@@ -17,6 +17,7 @@ pub struct FallbackGasFiller {
|
|||||||
default_gas_limit: u64,
|
default_gas_limit: u64,
|
||||||
default_max_fee_per_gas: u128,
|
default_max_fee_per_gas: u128,
|
||||||
default_priority_fee: u128,
|
default_priority_fee: u128,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FallbackGasFiller {
|
impl FallbackGasFiller {
|
||||||
@@ -24,19 +25,41 @@ impl FallbackGasFiller {
|
|||||||
default_gas_limit: u64,
|
default_gas_limit: u64,
|
||||||
default_max_fee_per_gas: u128,
|
default_max_fee_per_gas: u128,
|
||||||
default_priority_fee: u128,
|
default_priority_fee: u128,
|
||||||
|
use_fallback_gas_filler: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: GasFiller,
|
inner: GasFiller,
|
||||||
default_gas_limit,
|
default_gas_limit,
|
||||||
default_max_fee_per_gas,
|
default_max_fee_per_gas,
|
||||||
default_priority_fee,
|
default_priority_fee,
|
||||||
|
use_fallback_gas_filler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_default_gas_limit(mut self, default_gas_limit: u64) -> Self {
|
||||||
|
self.default_gas_limit = default_gas_limit;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_default_max_fee_per_gas(mut self, default_max_fee_per_gas: u128) -> Self {
|
||||||
|
self.default_max_fee_per_gas = default_max_fee_per_gas;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_default_priority_fee(mut self, default_priority_fee: u128) -> Self {
|
||||||
|
self.default_priority_fee = default_priority_fee;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_use_fallback_gas_filler(mut self, use_fallback_gas_filler: bool) -> Self {
|
||||||
|
self.use_fallback_gas_filler = use_fallback_gas_filler;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FallbackGasFiller {
|
impl Default for FallbackGasFiller {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
FallbackGasFiller::new(25_000_000, 1_000_000_000, 1_000_000_000)
|
FallbackGasFiller::new(25_000_000, 1_000_000_000, 1_000_000_000, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +87,12 @@ where
|
|||||||
Ok(fill) => Ok(Some(fill)),
|
Ok(fill) => Ok(Some(fill)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
tracing::debug!(error = ?err, "Gas Provider Estimation Failed, using fallback");
|
tracing::debug!(error = ?err, "Gas Provider Estimation Failed, using fallback");
|
||||||
Ok(None)
|
|
||||||
|
if !self.use_fallback_gas_filler {
|
||||||
|
Err(err)
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,13 +114,17 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(tx)
|
Ok(tx)
|
||||||
} else {
|
} else if self.use_fallback_gas_filler {
|
||||||
if let Some(builder) = tx.as_mut_builder() {
|
if let Some(builder) = tx.as_mut_builder() {
|
||||||
builder.set_gas_limit(self.default_gas_limit);
|
builder.set_gas_limit(self.default_gas_limit);
|
||||||
builder.set_max_fee_per_gas(self.default_max_fee_per_gas);
|
builder.set_max_fee_per_gas(self.default_max_fee_per_gas);
|
||||||
builder.set_max_priority_fee_per_gas(self.default_priority_fee);
|
builder.set_max_priority_fee_per_gas(self.default_priority_fee);
|
||||||
}
|
}
|
||||||
Ok(tx)
|
Ok(tx)
|
||||||
|
} else {
|
||||||
|
Err(TransportError::UnsupportedFeature(
|
||||||
|
"Fallback gas filler is disabled and we're attempting to do a gas estimate on a failing transaction",
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user