Skip to content

Commit 1b4c5f8

Browse files
committed
docs(node): move confirmation rationale off the pure helper
Per review: attestation_expiry_changed is a plain comparison, so drop the system-behavior doc from it and state the assumption once at the decision site (submitted_attestation_landed), linking DEFAULT_EXPIRATION_DURATION_SECONDS so the cross-crate reference is checked. Trim remaining where-used / paraphrasing comments.
1 parent 6a1e1b5 commit 1b4c5f8

4 files changed

Lines changed: 14 additions & 15 deletions

File tree

crates/node/src/indexer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,8 @@ impl ReadSupportedForeignChain for RealForeignChainPolicyReader {
405405
}
406406

407407
pub(crate) trait ReadAttestationExpiry: Send + Sync {
408-
/// Reads the Dstack attestation expiry currently stored for `tls_public_key`, or `None` if
409-
/// none is stored. Used as the pre-submit baseline for the submit_participant_info
410-
/// confirmation.
408+
/// The Dstack attestation expiry currently stored for `tls_public_key`, or `None` if none is
409+
/// stored.
411410
fn read_stored_dstack_expiry<'a>(
412411
&'a self,
413412
tls_public_key: &'a dtos::Ed25519PublicKey,

crates/node/src/indexer/tx_sender.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,21 @@ async fn submit_tx(
181181
})
182182
}
183183

184-
/// Whether our `submit_participant_info` landed: a successful submit re-stamps the stored expiry to
185-
/// a new value, a failed one leaves it unchanged, so a change from the baseline (or no prior entry)
186-
/// means it landed. Inequality rather than `>` because a lowered expiry constant can make a landed
187-
/// submit stamp an *earlier* expiry.
188-
// TODO(#1639): match a certificate-derived identity instead of this expiry heuristic.
189184
fn attestation_expiry_changed(pre_submit_expiry: Option<u64>, stored_expiry: u64) -> bool {
190185
match pre_submit_expiry {
191186
Some(expiry_before_submit) => stored_expiry != expiry_before_submit,
192187
None => true,
193188
}
194189
}
195190

196-
/// Whether the attestation we submitted is the one now stored. Mock carries a full identity and is
197-
/// matched directly; a Dstack entry has none to match (it's a different stored type), so it's
198-
/// confirmed indirectly via [`attestation_expiry_changed`].
191+
/// Whether the attestation we submitted is now the one stored on chain.
192+
///
193+
/// Mock is matched by identity. A Dstack entry keeps no stored per-submission identity, so it is
194+
/// confirmed via [`attestation_expiry_changed`]: an accepted submit re-stamps the entry's expiry
195+
/// (to the submit block time plus
196+
/// [`DEFAULT_EXPIRATION_DURATION_SECONDS`](mpc_attestation::attestation::DEFAULT_EXPIRATION_DURATION_SECONDS)),
197+
/// and only the owning account may rewrite it, so a changed expiry means our submit landed.
198+
// TODO(#1639): match a certificate-derived identity instead of this expiry heuristic.
199199
fn submitted_attestation_landed(
200200
pre_submit_expiry: Option<u64>,
201201
stored: &VerifiedAttestation,

crates/node/src/indexer/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pub enum ChainSendTransactionRequest {
6868
SubmitParticipantInfo {
6969
#[serde(flatten)]
7070
args: Box<contract_args::SubmitParticipantInfoArgs>,
71-
/// Attestation expiry stored on chain before this submission, captured once by the caller
72-
/// for the landing check in observe_tx_result. Node-internal; NOT part of the on-chain call.
71+
/// Pre-submit expiry baseline for the landing check. Skipped from serialization so it never
72+
/// reaches the on-chain call args.
7373
#[serde(skip)]
7474
pre_submit_expiry: Option<u64>,
7575
},

crates/node/src/tee/remote_attestation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub async fn periodic_attestation_submission<T: TransactionSender + Clone, I: Ti
192192
.read_stored_dstack_expiry(&tls_public_key)
193193
.await
194194
{
195-
Ok(baseline) => baseline, // Some = prior expiry; None = nothing stored yet (first submit) -- both proceed
195+
Ok(baseline) => baseline, // None just means nothing stored yet (e.g. first submit)
196196
Err(error) => {
197197
tracing::warn!(%error, "could not read pre-submit attestation baseline; skipping this round");
198198
continue; // next tick. Do NOT submit with an unknown baseline.
@@ -310,7 +310,7 @@ pub async fn monitor_attestation_removal<T: TransactionSender + Clone>(
310310
.read_stored_dstack_expiry(&tls_public_key)
311311
.await
312312
{
313-
Ok(baseline) => baseline, // Some = prior expiry; None = nothing stored yet (first submit) -- both proceed
313+
Ok(baseline) => baseline, // None just means nothing stored yet (e.g. first submit)
314314
Err(error) => {
315315
tracing::warn!(%error, "could not read pre-submit attestation baseline; skipping this round");
316316
was_available = is_available;

0 commit comments

Comments
 (0)