diff --git a/apps/fortuna/Cargo.lock b/apps/fortuna/Cargo.lock index cd79da2e0..f68ab3d60 100644 --- a/apps/fortuna/Cargo.lock +++ b/apps/fortuna/Cargo.lock @@ -1488,7 +1488,7 @@ dependencies = [ [[package]] name = "fortuna" -version = "5.4.3" +version = "5.4.4" dependencies = [ "anyhow", "axum", diff --git a/apps/fortuna/Cargo.toml b/apps/fortuna/Cargo.toml index df4fe5c9e..bbeef890b 100644 --- a/apps/fortuna/Cargo.toml +++ b/apps/fortuna/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fortuna" -version = "5.4.3" +version = "5.4.4" edition = "2021" [dependencies] diff --git a/apps/fortuna/src/chain/ethereum.rs b/apps/fortuna/src/chain/ethereum.rs index 28b638735..eaddab61a 100644 --- a/apps/fortuna/src/chain/ethereum.rs +++ b/apps/fortuna/src/chain/ethereum.rs @@ -102,13 +102,10 @@ impl SignablePythContract { ) -> Result { let provider = Provider::::try_from(&chain_config.geth_rpc_addr)?; let chain_id = provider.get_chainid().await?; - let eip1559_supported = !provider - .get_block(ethers::prelude::BlockNumber::Latest) - .await? - .ok_or_else(|| anyhow!("Latest block not found"))? - .base_fee_per_gas - .unwrap_or(U256::zero()) - .is_zero(); // sei testnet returns 0 instead of None + let eip1559_supported = match provider.estimate_eip1559_fees(None).await { + Ok((max_fee, max_priority_fee)) => !max_fee.is_zero() && !max_priority_fee.is_zero(), + Err(_) => false, + }; let gas_oracle = EthProviderOracle::new(provider.clone()); let transformer = LegacyTxTransformer { use_legacy_tx: !eip1559_supported, diff --git a/contract_manager/scripts/latency_entropy_with_callback.ts b/contract_manager/scripts/latency_entropy_with_callback.ts index 3bca6a5fc..d6c6e64de 100644 --- a/contract_manager/scripts/latency_entropy_with_callback.ts +++ b/contract_manager/scripts/latency_entropy_with_callback.ts @@ -54,12 +54,13 @@ async function testLatency( const startTime = Date.now(); - let fromBlock = requestResponse.blockNumber; + const fromBlock = requestResponse.blockNumber; const web3 = new Web3(contract.chain.getRpcUrl()); const entropyContract = contract.getContract(); // eslint-disable-next-line no-constant-condition while (true) { + await new Promise((resolve) => setTimeout(resolve, 1000)); const currentBlock = await web3.eth.getBlockNumber(); if (fromBlock > currentBlock) { @@ -70,7 +71,6 @@ async function testLatency( fromBlock: fromBlock, toBlock: currentBlock, }); - fromBlock = currentBlock + 1; const event = events.find( (event) => event.returnValues.request[1] == sequenceNumber @@ -87,8 +87,10 @@ async function testLatency( ); break; } - - await new Promise((resolve) => setTimeout(resolve, 300)); + if (Date.now() - startTime > 60000) { + console.log("Timeout: 60s passed without the callback being called."); + break; + } } }