From 4cda702a308903dc2bb0428c5f78657e4b893594 Mon Sep 17 00:00:00 2001 From: Nam Chu Hoai Date: Sat, 18 Mar 2023 12:01:37 -0400 Subject: [PATCH] Require >30 gwei for Polygon (#1952) ### Description Fixes #1933. It's not pretty but I would like to sleep tonight --- rust/chains/hyperlane-ethereum/src/mailbox.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rust/chains/hyperlane-ethereum/src/mailbox.rs b/rust/chains/hyperlane-ethereum/src/mailbox.rs index 89760fc8d..e977fcf8a 100644 --- a/rust/chains/hyperlane-ethereum/src/mailbox.rs +++ b/rust/chains/hyperlane-ethereum/src/mailbox.rs @@ -10,7 +10,7 @@ use ethers::abi::AbiEncode; use ethers::prelude::Middleware; use ethers::types::Eip1559TransactionRequest; use ethers_contract::builders::ContractCall; -use hyperlane_core::H160; +use hyperlane_core::{KnownHyperlaneDomain, H160}; use tracing::instrument; use hyperlane_core::{ @@ -229,6 +229,16 @@ where // Is not EIP 1559 chain return Ok(tx.gas(gas_limit)) }; + let max_priority_fee = if matches!( + KnownHyperlaneDomain::try_from(message.destination), + Ok(KnownHyperlaneDomain::Polygon) + ) { + // Polygon needs a max priority fee >= 30 gwei + let min_polygon_fee = U256::from(30_000_000_000u64); + max_priority_fee.max(min_polygon_fee) + } else { + max_priority_fee + }; // Is EIP 1559 chain let mut request = Eip1559TransactionRequest::new(); if let Some(from) = tx.tx.from() {