From 2e5a1d29ad39348218063e9b84bd3fbd696300ff Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Mon, 2 Mar 2026 09:30:13 +0200 Subject: [PATCH 1/2] fix: branched retry on inscriptions --- bedrock_client/src/lib.rs | 24 ++++++++++++++----- sequencer_core/src/block_settlement_client.rs | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bedrock_client/src/lib.rs b/bedrock_client/src/lib.rs index 534a0cf6..69cde861 100644 --- a/bedrock_client/src/lib.rs +++ b/bedrock_client/src/lib.rs @@ -31,9 +31,9 @@ impl Default for BackoffConfig { } } -// Simple wrapper -// maybe extend in the future for our purposes -// `Clone` is cheap because `CommonHttpClient` is internally reference counted (`Arc`). +/// Simple wrapper +/// maybe extend in the future for our purposes +/// `Clone` is cheap because `CommonHttpClient` is internally reference counted (`Arc`). #[derive(Clone)] pub struct BedrockClient { http_client: CommonHttpClient, @@ -62,10 +62,22 @@ impl BedrockClient { }) } - pub async fn post_transaction(&self, tx: SignedMantleTx) -> Result<(), Error> { - Retry::spawn(self.backoff_strategy(), || { - self.http_client + pub async fn post_transaction(&self, tx: SignedMantleTx) -> Result, Error> { + Retry::spawn(self.backoff_strategy(), || async { + match self + .http_client .post_transaction(self.node_url.clone(), tx.clone()) + .await + { + Ok(_) => Ok(Ok(())), + Err(err) => match err { + // Retry arm. + // Retrying only reqwest errors: mainly connected to http. + Error::Request(_) => Err(err), + // Returning non-retryable error + _ => Ok(Err(err)), + }, + } }) .await } diff --git a/sequencer_core/src/block_settlement_client.rs b/sequencer_core/src/block_settlement_client.rs index 15612835..3e9b4c57 100644 --- a/sequencer_core/src/block_settlement_client.rs +++ b/sequencer_core/src/block_settlement_client.rs @@ -102,7 +102,8 @@ impl BlockSettlementClientTrait for BlockSettlementClient { self.bedrock_client .post_transaction(tx) .await - .context("Failed to post transaction to Bedrock")?; + .context("Failed to post transaction to Bedrock after retries")? + .context("Failed to post transaction to Bedrock with non-retryable error")?; log::debug!("Posted block to Bedrock with parent id {parent_id:?} and msg id: {msg_id:?}"); From d71805abb6cec1f0789c8013022e7894bbad5dcc Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Wed, 18 Mar 2026 08:24:39 +0200 Subject: [PATCH 2/2] fix: merge updates --- Cargo.lock | 1 - bedrock_client/src/lib.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83ce4b5b..fab7b447 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5531,7 +5531,6 @@ dependencies = [ name = "nssa" version = "0.1.0" dependencies = [ - "amm_core", "anyhow", "borsh", "env_logger", diff --git a/bedrock_client/src/lib.rs b/bedrock_client/src/lib.rs index 6214226c..fdd14f72 100644 --- a/bedrock_client/src/lib.rs +++ b/bedrock_client/src/lib.rs @@ -69,13 +69,13 @@ impl BedrockClient { .post_transaction(self.node_url.clone(), tx.clone()) .await { - Ok(_) => Ok(Ok(())), + Ok(()) => Ok(Ok(())), Err(err) => match err { // Retry arm. // Retrying only reqwest errors: mainly connected to http. Error::Request(_) => Err(err), // Returning non-retryable error - _ => Ok(Err(err)), + Error::Server(_) | Error::Client(_) | Error::Url(_) => Ok(Err(err)), }, } })