pull/3852/head
Daniel Savu 6 months ago
parent f3e015b167
commit 630ad40a92
No known key found for this signature in database
GPG Key ID: 795E587829AF7E08
  1. 23
      rust/chains/hyperlane-ethereum/src/rpc_clients/trait_builder.rs
  2. 3
      rust/chains/hyperlane-ethereum/src/tx.rs
  3. 13
      rust/ethers-prometheus/src/middleware/mod.rs

@ -218,12 +218,14 @@ pub trait BuildableWithProvider {
// gas pricing issues. So we first wrap the provider in a gas escalator middleware.
// - When txs reach the gas escalator, they will already have been signed by the signer middleware,
// so they are ready to be retried
let signing_provider = wrap_with_signer(provider, signer.clone()).await;
let gas_escalator_provider =
wrap_with_gas_escalator(provider, &conn.transaction_overrides);
let signing_provider = wrap_with_signer(gas_escalator_provider, signer)
wrap_with_gas_escalator(signing_provider, &conn.transaction_overrides);
let nonce_manager_provider = wrap_with_nonce_manager(gas_escalator_provider, signer)
.await
.map_err(ChainCommunicationError::from_other)?;
self.build_with_provider(signing_provider, conn, locator)
self.build_with_provider(nonce_manager_provider, conn, locator)
} else {
self.build_with_provider(provider, conn, locator)
}
@ -244,15 +246,20 @@ pub trait BuildableWithProvider {
async fn wrap_with_signer<M: Middleware>(
provider: M,
signer: Signers,
) -> Result<SignerMiddleware<NonceManagerMiddleware<M>, Signers>, M::Error> {
) -> SignerMiddleware<M, Signers> {
SignerMiddleware::new(provider, signer)
}
async fn wrap_with_nonce_manager<M: Middleware>(
provider: M,
signer: Signers,
) -> Result<NonceManagerMiddleware<M>, M::Error> {
let provider_chain_id = provider.get_chainid().await?;
let signer = ethers::signers::Signer::with_chain_id(signer, provider_chain_id.as_u64());
let address = ethers::prelude::Signer::address(&signer);
let provider = NonceManagerMiddleware::new(provider, address);
let signing_provider = SignerMiddleware::new(provider, signer);
Ok(signing_provider)
let nonce_manager_provider = NonceManagerMiddleware::new(provider, address);
Ok(nonce_manager_provider)
}
fn build_polygon_gas_oracle(chain: ethers_core::types::Chain) -> ChainResult<Box<dyn GasOracle>> {

@ -44,8 +44,7 @@ where
.cloned()
.unwrap_or_else(|| NameOrAddress::Address(Default::default()));
info!(?to, %data, "Dispatching transaction");
// We can set the gas higher here!
info!(?to, %data, tx=?tx.tx, "Dispatching transaction");
let dispatch_fut = tx.send();
let dispatched = dispatch_fut
.await?

@ -227,7 +227,18 @@ impl<M: Middleware> Middleware for PrometheusMiddleware<M> {
) -> Result<PendingTransaction<'_, Self::Provider>, Self::Error> {
let start = Instant::now();
let tx: TypedTransaction = tx.into();
// print tx type based on enum variants
match tx {
TypedTransaction::Legacy(_) => {
println!("~~~ sending Legacy transaction");
}
TypedTransaction::Eip2930(_) => {
println!("~~~ sending EIP-2930 transaction");
}
TypedTransaction::Eip1559(_) => {
println!("~~~ sending EIP-1559 transaction");
}
}
let chain = {
let data = self.conf.read().await;
chain_name(&data.chain).to_owned()

Loading…
Cancel
Save