Skip to content

Commit

Permalink
reflect celestia app gRPC 'TxStatus' instead of celestia core RPC 'tx…
Browse files Browse the repository at this point in the history
…_status' in naming
  • Loading branch information
ethanoroshiba committed Feb 3, 2025
1 parent 9350f72 commit 45fb5b3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub(in crate::relayer) enum TrySubmitError {
namespace: String,
log: String,
},
/// The transaction was either evicted from the mempool or the call to `tx_status` failed.
/// The transaction was either evicted from the mempool or the call to `TxStatus` failed.
#[error("failed to confirm transaction submission")]
FailedToConfirmSubmission(#[source] ConfirmSubmissionError),
}
Expand Down Expand Up @@ -121,12 +121,12 @@ impl std::error::Error for GrpcResponseError {
#[error(transparent)]
pub(in crate::relayer) struct ProtobufDecodeError(#[from] DecodeError);

/// An error in getting the status of a transaction via RPC `tx_status`.
/// An error in getting the status of a transaction via RPC `TxStatus`.
#[derive(Debug, Clone, thiserror::Error)]
pub(in crate::relayer) enum TxStatusError {
#[error("received unfamilair response for tx `{hash}` from `tx_status`: {status}")]
#[error("received unfamilair response for tx `{hash}` from `TxStatus`: {status}")]
UnfamiliarStatus { status: String, hash: String },
#[error("request for `tx_status` failed: {error}")]
#[error("request for `TxStatus` failed: {error}")]
// Using `String` here because jsonrpsee::core::Error does not implement `Clone`.
FailedToGetTxStatus { error: String },
}
Expand All @@ -136,7 +136,7 @@ pub(in crate::relayer) enum TxStatusError {
pub(in crate::relayer) enum ConfirmSubmissionError {
#[error("tx `{hash}` evicted from mempool")]
Evicted { hash: String },
#[error("received `UNKNOWN` status from `tx_status` for tx: {hash}")]
#[error("received `UNKNOWN` status from `TxStatus` for tx: {hash}")]
StatusUnknown { hash: String },
#[error("failed to get tx status")]
TxStatus(#[from] TxStatusError),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl CelestiaClient {
let hex_encoded_tx_hash = self.broadcast_tx(blob_tx).await?;
if hex_encoded_tx_hash != blob_tx_hash.to_hex() {
// This is not a critical error. Worst case, we restart the process now and try for a
// short while to get `tx_status` for this tx using the wrong hash, resulting in a
// short while to get `TxStatus` for this tx using the wrong hash, resulting in a
// likely duplicate submission of this set of blobs.
warn!(
"tx hash `{hex_encoded_tx_hash}` returned from celestia app is not the same as \
Expand All @@ -247,7 +247,7 @@ impl CelestiaClient {
.map_err(TrySubmitError::FailedToConfirmSubmission)
}

/// Repeatedly sends `tx_status` until a successful response is received or `timeout` duration
/// Repeatedly sends `TxStatus` until a successful response is received or `timeout` duration
/// has elapsed.
///
/// Returns the height of the Celestia block in which the blobs were submitted, or `None` if
Expand Down Expand Up @@ -348,13 +348,13 @@ impl CelestiaClient {
lowercase_hex_encoded_tx_hash_from_response(response)
}

/// Returns the reponse of `tx_status` RPC call given a transaction's hash. If the transaction
/// Returns the reponse of `TxStatus` RPC call given a transaction's hash. If the transaction
/// is committed, the height of the block in which it was committed will be returned with
/// `TxStatusResponse::Committed`.
///
/// # Errors
/// Returns an error in the following cases:
/// - The call to `tx_status` failed.
/// - The call to `TxStatus` failed.
/// - The status of the transaction is not recognized.
#[instrument(skip_all, err(level = Level::WARN))]
async fn tx_status(&mut self, hex_encoded_tx_hash: String) -> Result<TxStatus, TxStatusError> {
Expand All @@ -379,7 +379,7 @@ impl CelestiaClient {
}
}

/// Repeatedly calls `tx_status` until the transaction is committed, returning the height of the
/// Repeatedly calls `TxStatus` until the transaction is committed, returning the height of the
/// block in which the transaction was included.
///
/// # Errors
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-sequencer-relayer/src/relayer/submission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use tracing::{
use super::BlobTxHash;

/// Represents a submission made to Celestia which has been confirmed as stored via a successful
/// `tx_status` call.
/// `TxStatus` call.
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub(super) struct CompletedSubmission {
/// The height of the Celestia block in which the submission was stored.
Expand Down Expand Up @@ -322,7 +322,7 @@ impl PreparedSubmission {
&self.blob_tx_hash
}

/// Returns the maximum duration for which the Celestia app should be polled with `tx_status`
/// Returns the maximum duration for which the Celestia app should be polled with `TxStatus`
/// requests to confirm successful storage of the associated `BlobTx`.
///
/// This is at least 15 seconds, but up to a maximum of a minute from when the submission was
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-sequencer-relayer/src/relayer/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl BlobSubmitter {
/// This should only be called where submission state on startup is `Prepared`, meaning we don't yet
/// know whether that final submission attempt succeeded or not.
///
/// Internally, this polls `tx_status` for up to one minute. The returned `SubmissionState` is
/// Internally, this polls `TxStatus` for up to one minute. The returned `SubmissionState` is
/// guaranteed to be in `Started` state, either holding the heights of the previously prepared
/// submission if confirmed by Celestia, or holding the heights of the last known confirmed
/// submission in the case of timing out.
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-sequencer-relayer/tests/blackbox/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn one_block_is_relayed_to_celestia() {
)
.await;
// The `MIN_POLL_INTERVAL_SECS` is 1, meaning the relayer waits for 1 second before attempting
// the first `tx_status`, so we wait for 2 seconds.
// the first `TxStatus`, so we wait for 2 seconds.
sequencer_relayer
.timeout_ms(
2_000,
Expand Down Expand Up @@ -418,7 +418,7 @@ async fn confirm_submission_loops_on_pending_status() {
Some(2),
)
.await;
// Allow 3 seconds for two `tx_status` calls. MIN_POLL_INTERVAL_SECS is 1, so with two calls
// Allow 3 seconds for two `TxStatus` calls. MIN_POLL_INTERVAL_SECS is 1, so with two calls
// we're allowing 1 extra second for this mount to be satisfied.
sequencer_relayer
.timeout_ms(
Expand Down Expand Up @@ -489,7 +489,7 @@ async fn confirm_submission_loops_on_unknown_status_up_to_time_limit() {
Some(2),
)
.await;
// Allow 3 seconds for two `tx_status` calls. MIN_POLL_INTERVAL_SECS is 1, so with two calls
// Allow 3 seconds for two `TxStatus` calls. MIN_POLL_INTERVAL_SECS is 1, so with two calls
// we're allowing 1 extra second for this mount to be satisfied.
sequencer_relayer
.timeout_ms(
Expand Down

0 comments on commit 45fb5b3

Please sign in to comment.