workflows: retry tx submission

Also bump pinned NOMOS_NODE_REV.
This commit is contained in:
andrussal 2025-12-17 17:34:32 +01:00
parent b78add7792
commit 96fcea1f96
2 changed files with 24 additions and 14 deletions

View File

@ -1,4 +1,4 @@
use std::sync::Arc; use std::{sync::Arc, time::Duration};
use nomos_core::{ use nomos_core::{
block::Block, block::Block,
@ -11,6 +11,9 @@ use rand::{seq::SliceRandom as _, thread_rng};
use testing_framework_core::scenario::{DynError, RunContext}; use testing_framework_core::scenario::{DynError, RunContext};
use tracing::debug; use tracing::debug;
const SUBMIT_RETRIES: usize = 5;
const SUBMIT_RETRY_DELAY: Duration = Duration::from_millis(500);
/// Scans a block and invokes the matcher for every operation until it returns /// Scans a block and invokes the matcher for every operation until it returns
/// `Some(...)`. Returns `None` when no matching operation is found. /// `Some(...)`. Returns `None` when no matching operation is found.
pub fn find_channel_op<F>(block: &Block<SignedMantleTx>, matcher: &mut F) -> Option<MsgId> pub fn find_channel_op<F>(block: &Block<SignedMantleTx>, matcher: &mut F) -> Option<MsgId>
@ -51,22 +54,29 @@ pub async fn submit_transaction_via_cluster(
executor_clients.shuffle(&mut thread_rng()); executor_clients.shuffle(&mut thread_rng());
let clients = validator_clients.into_iter().chain(executor_clients); let clients = validator_clients.into_iter().chain(executor_clients);
let mut clients: Vec<_> = clients.collect();
let mut last_err = None; let mut last_err = None;
for client in clients { for attempt in 0..SUBMIT_RETRIES {
let url = client.base_url().clone(); clients.shuffle(&mut thread_rng());
debug!(?tx_hash, %url, "submitting transaction to client");
match client for client in &clients {
.submit_transaction(&tx) let url = client.base_url().clone();
.await debug!(?tx_hash, %url, attempt, "submitting transaction to client");
.map_err(|err| -> DynError { err.into() }) match client
{ .submit_transaction(&tx)
Ok(()) => return Ok(()), .await
Err(err) => { .map_err(|err| -> DynError { err.into() })
debug!(?tx_hash, %url, "transaction submission failed"); {
last_err = Some(err); Ok(()) => return Ok(()),
Err(err) => {
debug!(?tx_hash, %url, attempt, "transaction submission failed");
last_err = Some(err);
}
} }
} }
tokio::time::sleep(SUBMIT_RETRY_DELAY).await;
} }
Err(last_err.unwrap_or_else(|| "cluster client exhausted all nodes".into())) Err(last_err.unwrap_or_else(|| "cluster client exhausted all nodes".into()))

View File

@ -1,7 +1,7 @@
VERSION=v0.3.1 VERSION=v0.3.1
NOMOS_BUNDLE_VERSION=v4 NOMOS_BUNDLE_VERSION=v4
# Pinned nomos-node revision used for CI builds and binary bundles. # Pinned nomos-node revision used for CI builds and binary bundles.
NOMOS_NODE_REV=ad104981ca79da20183550b5aced9e49773fb6d5 NOMOS_NODE_REV=6bdb09567d21cd1e53527846a9cd48493ad49387
# Optional: local nomos-node checkout override (do not commit absolute paths). # Optional: local nomos-node checkout override (do not commit absolute paths).
# NOMOS_NODE_PATH= # NOMOS_NODE_PATH=