From 386997a0847b87e3db74ec1af0e03816a226c840 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Thu, 31 Oct 2024 18:04:36 +0100 Subject: [PATCH] fix: bundle fees --- crates/bundler/src/bundler.rs | 13 +++++++++---- crates/grpc/src/proto.rs | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/bundler/src/bundler.rs b/crates/bundler/src/bundler.rs index 110d911c..a5296b23 100644 --- a/crates/bundler/src/bundler.rs +++ b/crates/bundler/src/bundler.rs @@ -122,16 +122,21 @@ where }; let estimated_gas = self.eth_client.estimate_gas(&tx, None).await?; - let (max_fee_per_gas, max_priority_fee) = - self.eth_client.estimate_eip1559_fees(None).await?; + let mut max_fee_per_gas: U256 = U256::zero(); + let mut max_priority_fee_per_gas: U256 = U256::zero(); + + for uo in uos { + max_fee_per_gas += uo.max_fee_per_gas; + max_priority_fee_per_gas += uo.max_priority_fee_per_gas; + } tx = TypedTransaction::Eip1559(Eip1559TransactionRequest { to: tx.to().cloned(), from: Some(self.wallet.signer.address()), data: tx.data().cloned(), chain_id: Some(U64::from(self.chain.id())), - max_priority_fee_per_gas: Some(max_priority_fee), - max_fee_per_gas: Some(max_fee_per_gas), + max_priority_fee_per_gas: Some(max_priority_fee_per_gas / uos.len()), + max_fee_per_gas: Some(max_fee_per_gas / uos.len()), gas: Some(estimated_gas), nonce: Some(nonce), value: None, diff --git a/crates/grpc/src/proto.rs b/crates/grpc/src/proto.rs index c9b4edb5..acc9734f 100644 --- a/crates/grpc/src/proto.rs +++ b/crates/grpc/src/proto.rs @@ -413,11 +413,11 @@ pub mod types { Self { root_hashes: root_hashes .into_iter() - .map(|(k, v)| (format!("{:?}", k), format!("{:?}", v))) + .map(|(k, v)| (format!("{k:?}"), format!("{v:?}"))) .collect(), slots: slots .into_iter() - .map(|(k, v)| (format!("{:?}", k), StorageSlots { slots: v })) + .map(|(k, v)| (format!("{k:?}"), StorageSlots { slots: v })) .collect(), } }