diff --git a/Cargo.lock b/Cargo.lock index cf9ff84b..3bd665c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23711,7 +23711,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "tesseract" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "async-trait", diff --git a/parachain/runtimes/nexus/build.rs b/parachain/runtimes/nexus/build.rs index 581d44ae..34b52000 100644 --- a/parachain/runtimes/nexus/build.rs +++ b/parachain/runtimes/nexus/build.rs @@ -32,4 +32,4 @@ fn main() { .export_heap_base() .import_memory() .build() -} \ No newline at end of file +} diff --git a/tesseract/evm/src/gas_oracle.rs b/tesseract/evm/src/gas_oracle.rs index 8a291550..8a7d3bf7 100644 --- a/tesseract/evm/src/gas_oracle.rs +++ b/tesseract/evm/src/gas_oracle.rs @@ -102,7 +102,6 @@ pub async fn get_current_gas_cost_in_usd( chain: StateMachine, api_keys: &str, client: Arc>, - gas_price_buffer: Option, ) -> Result { let mut gas_price_cost = U256::zero(); let mut gas_price = U256::zero(); @@ -288,11 +287,6 @@ pub async fn get_current_gas_cost_in_usd( ethers::utils::format_units(gas_price, "gwei").unwrap() ); - let buffer = gas_price_buffer - .map(|buffer| (U256::from(buffer) * gas_price) / U256::from(100u32)) - .unwrap_or_default(); - gas_price = gas_price + buffer; - Ok(GasBreakdown { gas_price, gas_price_cost: gas_price_cost.into(), unit_wei_cost: unit_wei }) } @@ -423,7 +417,6 @@ mod test { StateMachine::Evm(SEPOLIA_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -446,7 +439,6 @@ mod test { StateMachine::Evm(SEPOLIA_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -469,7 +461,6 @@ mod test { StateMachine::Evm(POLYGON_TESTNET_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -486,14 +477,10 @@ mod test { let provider = Provider::::try_from(ethereum_rpc_uri).unwrap(); let client = Arc::new(provider.clone()); - let ethereum_gas_cost_in_usd = get_current_gas_cost_in_usd( - StateMachine::Evm(GNOSIS_CHAIN_ID), - "", - client.clone(), - None, - ) - .await - .unwrap(); + let ethereum_gas_cost_in_usd = + get_current_gas_cost_in_usd(StateMachine::Evm(GNOSIS_CHAIN_ID), "", client.clone()) + .await + .unwrap(); println!("Ethereum Gas Cost Gnosis Mainnet: {:?}", ethereum_gas_cost_in_usd); } @@ -513,7 +500,6 @@ mod test { StateMachine::Evm(POLYGON_TESTNET_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -536,7 +522,6 @@ mod test { StateMachine::Evm(BSC_TESTNET_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -558,7 +543,6 @@ mod test { StateMachine::Evm(ARBITRUM_SEPOLIA_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -580,7 +564,6 @@ mod test { StateMachine::Evm(OPTIMISM_SEPOLIA_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); @@ -601,7 +584,6 @@ mod test { StateMachine::Evm(OPTIMISM_SEPOLIA_CHAIN_ID), ðereum_etherscan_api_key, client.clone(), - None, ) .await .unwrap(); diff --git a/tesseract/evm/src/provider.rs b/tesseract/evm/src/provider.rs index d41d3093..fd8bc7d5 100644 --- a/tesseract/evm/src/provider.rs +++ b/tesseract/evm/src/provider.rs @@ -376,7 +376,6 @@ impl IsmpProvider for EvmClient { self.state_machine, &self.config.etherscan_api_key.clone(), self.client.clone(), - self.config.gas_price_buffer, ) .await?; let mut gas_estimates = vec![]; diff --git a/tesseract/evm/src/tx.rs b/tesseract/evm/src/tx.rs index 3afa7676..85446a52 100644 --- a/tesseract/evm/src/tx.rs +++ b/tesseract/evm/src/tx.rs @@ -132,7 +132,6 @@ where client.state_machine, &client.config.etherscan_api_key.clone(), client.client.clone(), - client.config.gas_price_buffer, ) .await? .gas_price * 2; // for good measure @@ -228,12 +227,11 @@ pub async fn generate_contract_calls( // Erigon does not support block overrides when tracing so we don't have the option of omiting // the gas price by overriding the base fee let set_gas_price = || !debug_trace || client.client_type.erigon(); - let gas_price = if set_gas_price() { + let mut gas_price = if set_gas_price() { get_current_gas_cost_in_usd( client.state_machine, &client.config.etherscan_api_key.clone(), client.client.clone(), - client.config.gas_price_buffer, ) .await? .gas_price @@ -241,6 +239,13 @@ pub async fn generate_contract_calls( Default::default() }; + // Only use gas price buffer when submitting transactions + if !debug_trace && client.config.gas_price_buffer.is_some() { + let buffer = (U256::from(client.config.gas_price_buffer.unwrap_or_default()) * gas_price) / + U256::from(100u32); + gas_price = gas_price + buffer + } + for message in messages { match message { Message::Consensus(msg) => { diff --git a/tesseract/relayer/Cargo.toml b/tesseract/relayer/Cargo.toml index 911b3273..26224708 100644 --- a/tesseract/relayer/Cargo.toml +++ b/tesseract/relayer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesseract" -version = "1.0.0" +version = "1.0.1" edition = "2021" description = "Chain agnostic relayer implementation for Hyperbridge" authors = ["Polytope Labs "]