Skip to content

Commit

Permalink
add max fee for first tx
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-magnet committed Oct 1, 2024
1 parent 9d555cc commit d28da50
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions committer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub struct Eth {
/// This is a workaround to get pending transactions unstuck until the tx manager task is
/// complete.
pub max_fee_per_gas_for_first_tx: Option<u64>,
pub max_priority_fee_per_gas_for_first_tx: Option<u64>,
}

fn parse_url<'de, D>(deserializer: D) -> Result<Url, D::Error>
Expand Down
4 changes: 4 additions & 0 deletions committer/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ pub async fn l1_adapter(
internal_config.eth_errors_before_unhealthy,
aws_client,
config.eth.max_fee_per_gas_for_first_tx.map(Into::into),
config
.eth
.max_priority_fee_per_gas_for_first_tx
.map(Into::into),
)
.await?;

Expand Down
2 changes: 1 addition & 1 deletion e2e/src/eth_node/state_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl DeployedContract {
let aws_client = AwsClient::new(AwsConfig::for_testing(key.url).await).await;

let chain_state_contract =
WebsocketClient::connect(url, address, key.id, blob_wallet, 5, aws_client, None)
WebsocketClient::connect(url, address, key.id, blob_wallet, 5, aws_client, None, None)
.await?;

Ok(Self {
Expand Down
2 changes: 2 additions & 0 deletions packages/eth/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ impl WebsocketClient {
unhealthy_after_n_errors: usize,
aws_client: AwsClient,
max_fee_per_gas_for_first_tx: Option<u128>,
max_priority_fee_per_gas_for_first_tx: Option<u128>,
) -> ports::l1::Result<Self> {
let blob_signer = if let Some(key_arn) = blob_pool_key_arn {
Some(aws_client.make_signer(key_arn).await?)
Expand All @@ -48,6 +49,7 @@ impl WebsocketClient {
main_signer,
blob_signer,
max_fee_per_gas_for_first_tx,
max_priority_fee_per_gas_for_first_tx,
)
.await?;

Expand Down
9 changes: 7 additions & 2 deletions packages/eth/src/websocket/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sol!(
pub struct WsConnection {
provider: WsProvider,
max_fee_per_blob_gas_for_first_tx: Option<u128>,
max_priority_fee_per_blob_gas_for_first_tx: Option<u128>,
first_blob_tx_sent: Arc<AtomicBool>,
blob_provider: Option<WsProvider>,
address: Address,
Expand Down Expand Up @@ -198,12 +199,14 @@ impl EthApi for WsConnection {
let blob_tx = match (
self.first_blob_tx_sent.load(Ordering::Relaxed),
self.max_fee_per_blob_gas_for_first_tx,
self.max_priority_fee_per_blob_gas_for_first_tx,
) {
(true, _) | (false, None) => TransactionRequest::default()
(true, _, _) | (false, None, _) | (false, _, None) => TransactionRequest::default()
.with_blob_sidecar(sidecar)
.with_to(*blob_signer_address),
(false, Some(max_fee)) => TransactionRequest::default()
(false, Some(max_fee), Some(max_priority_fee)) => TransactionRequest::default()
.with_max_fee_per_blob_gas(max_fee)
.with_max_priority_fee_per_gas(max_priority_fee)
.with_blob_sidecar(sidecar)
.with_to(*blob_signer_address),
};
Expand Down Expand Up @@ -252,6 +255,7 @@ impl WsConnection {
main_signer: AwsSigner,
blob_signer: Option<AwsSigner>,
max_fee_per_blob_gas_for_first_tx: Option<u128>,
max_priority_fee_per_blob_gas_for_first_tx: Option<u128>,
) -> Result<Self> {
let address = main_signer.address();

Expand Down Expand Up @@ -289,6 +293,7 @@ impl WsConnection {
metrics: Default::default(),
first_blob_tx_sent: Arc::new(AtomicBool::new(false)),
max_fee_per_blob_gas_for_first_tx,
max_priority_fee_per_blob_gas_for_first_tx,
})
}

Expand Down

0 comments on commit d28da50

Please sign in to comment.