Skip to main content

rings_core/message/
service_receipt.rs

1//! Canonical provisional service receipts and the Probe transcript.
2//!
3//! These receipt types are deliberately distinct from future ledger receipts.
4//! Their signing domains and versioned canonical encodings cannot be reused by
5//! a finalized-epoch protocol.
6
7use std::borrow::Borrow;
8use std::num::NonZeroU64;
9
10use serde::Deserialize;
11use serde::Serialize;
12use thiserror::Error;
13
14use super::Message;
15use super::MessagePayload;
16use super::MessageSigner;
17use super::MessageVerification;
18use super::MessageVerificationExt;
19use super::SigningDomain;
20use super::Transaction;
21use crate::dht::Did;
22use crate::domain_tag;
23use crate::ecc::keccak256;
24use crate::error::Result;
25
26const CLAIM_WIRE_PREFIX: &[u8] = b"RINGS-PROVISIONAL-SERVICE-CLAIM\0";
27const RECEIPT_WIRE_PREFIX: &[u8] = b"RINGS-PROVISIONAL-SERVICE-RECEIPT\0";
28const PROVIDER_DOMAIN: super::DomainTag =
29    domain_tag!("rings-core:service-receipt:provisional:provider");
30const BENEFICIARY_DOMAIN: super::DomainTag =
31    domain_tag!("rings-core:service-receipt:provisional:beneficiary");
32
33/// Width of one provisional wall-clock epoch.
34pub const PROVISIONAL_RECEIPT_EPOCH_SECS: u64 = 300;
35
36/// Service kinds accepted by the provisional receipt wire.
37#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
38pub enum ServiceKind {
39    /// One authenticated request/response probe.
40    Probe,
41}
42
43/// Coarse wall-clock slot used only for live provisional collection.
44#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
45pub struct ProvisionalEpoch {
46    /// Unix-time slice number.
47    pub slot: u64,
48}
49
50impl ProvisionalEpoch {
51    /// Derive the provisional slot from whole Unix seconds.
52    pub const fn from_unix_seconds(seconds: u64) -> Self {
53        Self {
54            slot: seconds / PROVISIONAL_RECEIPT_EPOCH_SECS,
55        }
56    }
57
58    /// Return whether this is the receiver's current or adjacent slot.
59    pub const fn is_accepted_at(self, unix_seconds: u64) -> bool {
60        let current = Self::from_unix_seconds(unix_seconds).slot;
61        self.slot.abs_diff(current) <= 1
62    }
63}
64
65/// Canonical provisional service claim.
66#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
67pub struct ProvisionalServiceClaim {
68    /// Overlay in which the receipt signatures are valid.
69    pub network_id: u32,
70    /// Service evidence profile.
71    pub service: ServiceKind,
72    /// Account that supplied the service.
73    pub provider_account: Did,
74    /// Account that requested and acknowledged the service.
75    pub beneficiary_account: Did,
76    /// Provisional live-collection epoch.
77    pub epoch: ProvisionalEpoch,
78    /// Beneficiary-selected fresh nonce.
79    pub nonce: [u8; 32],
80    /// Service units; Probe requires exactly one.
81    pub units: NonZeroU64,
82    /// Digest of the exact signed request transaction.
83    pub request_digest: [u8; 32],
84    /// Digest of the exact signed completion transaction.
85    pub completion_digest: [u8; 32],
86}
87
88impl ProvisionalServiceClaim {
89    /// Construct the only service profile, a one-unit probe.
90    pub const fn probe(
91        network_id: u32,
92        provider_account: Did,
93        beneficiary_account: Did,
94        epoch: ProvisionalEpoch,
95        nonce: [u8; 32],
96        request_digest: [u8; 32],
97        completion_digest: [u8; 32],
98    ) -> Self {
99        Self {
100            network_id,
101            service: ServiceKind::Probe,
102            provider_account,
103            beneficiary_account,
104            epoch,
105            nonce,
106            units: NonZeroU64::MIN,
107            request_digest,
108            completion_digest,
109        }
110    }
111
112    /// Validate the service rule and account-role relation.
113    pub fn validate(&self) -> std::result::Result<(), ServiceReceiptError> {
114        if self.provider_account == self.beneficiary_account {
115            return Err(ServiceReceiptError::SameAccountRoles);
116        }
117        match self.service {
118            ServiceKind::Probe if self.units == NonZeroU64::MIN => Ok(()),
119            ServiceKind::Probe => Err(ServiceReceiptError::InvalidProbeUnits {
120                units: self.units.get(),
121            }),
122        }
123    }
124
125    /// Serialize the claim under its explicit marker.
126    pub fn canonical_bytes(&self) -> std::result::Result<Vec<u8>, ServiceReceiptError> {
127        self.validate()?;
128        encode_prefixed(CLAIM_WIRE_PREFIX, self)
129    }
130
131    /// Parse only the canonical claim representation.
132    pub fn from_canonical_bytes(bytes: &[u8]) -> std::result::Result<Self, ServiceReceiptError> {
133        let claim: Self = decode_prefixed(CLAIM_WIRE_PREFIX, bytes)?;
134        claim.validate()?;
135        Ok(claim)
136    }
137
138    /// Digest binding every field in the canonical claim.
139    pub fn digest(&self) -> std::result::Result<ServiceReceiptDigest, ServiceReceiptError> {
140        Ok(ServiceReceiptDigest(keccak256(&self.canonical_bytes()?)))
141    }
142
143    /// Sign the provider role domain with the delegated provider session.
144    pub fn sign_provider(
145        &self,
146        signer: MessageSigner<impl Borrow<crate::delegation::DelegateeKey>>,
147    ) -> Result<MessageVerification> {
148        self.require_signer(signer.by_ref(), self.provider_account)?;
149        signer.sign(PROVIDER_DOMAIN, &self.canonical_bytes()?)
150    }
151
152    /// Sign the beneficiary role domain with the delegated beneficiary session.
153    pub fn sign_beneficiary(
154        &self,
155        signer: MessageSigner<impl Borrow<crate::delegation::DelegateeKey>>,
156    ) -> Result<MessageVerification> {
157        self.require_signer(signer.by_ref(), self.beneficiary_account)?;
158        signer.sign(BENEFICIARY_DOMAIN, &self.canonical_bytes()?)
159    }
160
161    fn require_signer(
162        &self,
163        signer: MessageSigner<&crate::delegation::DelegateeKey>,
164        expected: Did,
165    ) -> std::result::Result<(), ServiceReceiptError> {
166        if signer.network_id() != self.network_id {
167            return Err(ServiceReceiptError::NetworkMismatch {
168                expected: self.network_id,
169                actual: signer.network_id(),
170            });
171        }
172        let actual = signer.delegator_did();
173        if actual != expected {
174            return Err(ServiceReceiptError::SignerRoleMismatch { expected, actual });
175        }
176        Ok(())
177    }
178
179    fn verify_role_attestation(
180        &self,
181        attestation: &MessageVerification,
182        expected_account: Did,
183        domain: super::DomainTag,
184        invalid: ServiceReceiptError,
185    ) -> std::result::Result<(), ServiceReceiptError> {
186        if attestation.delegation.delegator_did() != expected_account {
187            return Err(ServiceReceiptError::SignerRoleMismatch {
188                expected: expected_account,
189                actual: attestation.delegation.delegator_did(),
190            });
191        }
192        let claim = self.canonical_bytes()?;
193        if !attestation.verify_at(
194            SigningDomain::new(domain, self.network_id),
195            &claim,
196            attestation.ts_ms,
197        ) {
198            return Err(invalid);
199        }
200        Ok(())
201    }
202
203    fn verify_live_role_attestation_at(
204        &self,
205        attestation: &MessageVerification,
206        expected_account: Did,
207        domain: super::DomainTag,
208        observed_at_ms: u128,
209        not_live: ServiceReceiptError,
210    ) -> std::result::Result<(), ServiceReceiptError> {
211        if attestation.delegation.delegator_did() != expected_account {
212            return Err(ServiceReceiptError::SignerRoleMismatch {
213                expected: expected_account,
214                actual: attestation.delegation.delegator_did(),
215            });
216        }
217        let claim = self.canonical_bytes()?;
218        if !attestation.verify_live_at(
219            SigningDomain::new(domain, self.network_id),
220            &claim,
221            observed_at_ms,
222        ) {
223            return Err(not_live);
224        }
225        Ok(())
226    }
227}
228
229/// Digest of one canonical provisional receipt or claim.
230#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
231pub struct ServiceReceiptDigest([u8; 32]);
232
233impl ServiceReceiptDigest {
234    /// Return the digest bytes.
235    pub const fn into_bytes(self) -> [u8; 32] {
236        self.0
237    }
238}
239
240/// Complete two-role provisional receipt.
241#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
242pub struct ProvisionalServiceReceipt {
243    /// Canonical service claim.
244    pub claim: ProvisionalServiceClaim,
245    /// Provider-delegatee signature under the provider role domain.
246    pub provider_attestation: MessageVerification,
247    /// Beneficiary-delegatee signature under the beneficiary role domain.
248    pub beneficiary_attestation: MessageVerification,
249}
250
251impl ProvisionalServiceReceipt {
252    /// Assemble an acknowledged receipt without weakening either signature.
253    pub fn new(
254        claim: ProvisionalServiceClaim,
255        provider_attestation: MessageVerification,
256        beneficiary_attestation: MessageVerification,
257    ) -> std::result::Result<Self, ServiceReceiptError> {
258        let receipt = Self {
259            claim,
260            provider_attestation,
261            beneficiary_attestation,
262        };
263        receipt.claim.validate()?;
264        Ok(receipt)
265    }
266
267    /// Serialize the receipt under its explicit provisional marker.
268    pub fn canonical_bytes(&self) -> std::result::Result<Vec<u8>, ServiceReceiptError> {
269        self.claim.validate()?;
270        encode_prefixed(RECEIPT_WIRE_PREFIX, self)
271    }
272
273    /// Parse only the canonical provisional representation.
274    pub fn from_canonical_bytes(bytes: &[u8]) -> std::result::Result<Self, ServiceReceiptError> {
275        let receipt: Self = decode_prefixed(RECEIPT_WIRE_PREFIX, bytes)?;
276        receipt.claim.validate()?;
277        Ok(receipt)
278    }
279
280    /// Digest used for deterministic ordering and duplicate detection.
281    pub fn digest(&self) -> std::result::Result<ServiceReceiptDigest, ServiceReceiptError> {
282        Ok(ServiceReceiptDigest(keccak256(&self.canonical_bytes()?)))
283    }
284
285    /// Verify portable cryptographic facts without claiming live observation.
286    pub fn verify_crypto(
287        &self,
288        receiver_network_id: u32,
289    ) -> std::result::Result<(), ServiceReceiptError> {
290        self.claim.validate()?;
291        if self.claim.network_id != receiver_network_id {
292            return Err(ServiceReceiptError::NetworkMismatch {
293                expected: receiver_network_id,
294                actual: self.claim.network_id,
295            });
296        }
297        self.claim.verify_role_attestation(
298            &self.provider_attestation,
299            self.claim.provider_account,
300            PROVIDER_DOMAIN,
301            ServiceReceiptError::InvalidProviderAttestation,
302        )?;
303        self.claim.verify_role_attestation(
304            &self.beneficiary_attestation,
305            self.claim.beneficiary_account,
306            BENEFICIARY_DOMAIN,
307            ServiceReceiptError::InvalidBeneficiaryAttestation,
308        )
309    }
310
311    /// Verify cryptography, proof liveness, and current/adjacent epoch admission.
312    pub fn verify_live_at(
313        &self,
314        receiver_network_id: u32,
315        observed_at_ms: u128,
316    ) -> std::result::Result<(), ServiceReceiptError> {
317        self.verify_crypto(receiver_network_id)?;
318        let seconds = u64::try_from(observed_at_ms / 1_000)
319            .map_err(|_| ServiceReceiptError::ObservationTimeOverflow)?;
320        self.claim.verify_live_role_attestation_at(
321            &self.provider_attestation,
322            self.claim.provider_account,
323            PROVIDER_DOMAIN,
324            observed_at_ms,
325            ServiceReceiptError::ProviderAttestationNotLive,
326        )?;
327        self.claim.verify_live_role_attestation_at(
328            &self.beneficiary_attestation,
329            self.claim.beneficiary_account,
330            BENEFICIARY_DOMAIN,
331            observed_at_ms,
332            ServiceReceiptError::BeneficiaryAttestationNotLive,
333        )?;
334        if !self.claim.epoch.is_accepted_at(seconds) {
335            return Err(ServiceReceiptError::EpochOutsideTolerance {
336                claim_slot: self.claim.epoch.slot,
337                observed_slot: ProvisionalEpoch::from_unix_seconds(seconds).slot,
338            });
339        }
340        Ok(())
341    }
342}
343
344/// Beneficiary request initiating Probe.
345#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
346pub struct ProbeRequest {
347    /// Provisional collection slot proposed by the beneficiary.
348    pub epoch: ProvisionalEpoch,
349    /// Fresh random request nonce.
350    pub nonce: [u8; 32],
351}
352
353impl ProbeRequest {
354    /// Draw a fresh challenge nonce for `epoch` from `rng`.
355    pub(crate) fn from_rng(epoch: ProvisionalEpoch, rng: &mut impl rand::RngCore) -> Self {
356        let mut nonce = [0_u8; 32];
357        rng.fill_bytes(&mut nonce);
358        Self { epoch, nonce }
359    }
360
361    #[cfg(test)]
362    pub(crate) fn random_for_epoch(epoch: ProvisionalEpoch) -> Self {
363        Self::from_rng(epoch, &mut crate::utils::SystemEntropy)
364    }
365}
366
367#[cfg(test)]
368pub(crate) fn test_probe_request(nonce: u8) -> ProbeRequest {
369    let seconds = u64::try_from(crate::utils::get_epoch_ms() / 1_000).unwrap_or(0);
370    ProbeRequest {
371        epoch: ProvisionalEpoch::from_unix_seconds(seconds),
372        nonce: [nonce; 32],
373    }
374}
375
376/// Provider-signed completion transaction embedded in the offer.
377#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
378pub struct ProbeCompletion {
379    /// Digest of the exact request transaction this completes.
380    pub request_digest: [u8; 32],
381    /// Request nonce copied into the completion.
382    pub nonce: [u8; 32],
383}
384
385/// Provider response carrying the two exact signed transcript transactions.
386#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
387pub struct ProbeOffer {
388    /// Beneficiary-signed request transaction.
389    pub request: Transaction,
390    /// Provider-signed completion transaction.
391    pub completion: Transaction,
392    /// Claim binding the transaction digests and account roles.
393    pub claim: ProvisionalServiceClaim,
394    /// Provider signature over the claim under its role domain.
395    pub provider_attestation: MessageVerification,
396}
397
398impl ProbeOffer {
399    /// Verify one self-consistent transcript with currently live embedded transactions.
400    ///
401    /// The caller must already have admitted the outer payload through the shared transport
402    /// verification and replay boundary.
403    pub fn verify_transcript(
404        &self,
405        outer: &MessagePayload,
406        receiver_network_id: u32,
407        beneficiary: Did,
408    ) -> std::result::Result<ProbeRequest, ServiceReceiptError> {
409        self.verify_transcript_at(
410            outer,
411            receiver_network_id,
412            beneficiary,
413            crate::utils::get_epoch_ms(),
414        )
415    }
416
417    /// [`Self::verify_transcript`] evaluated at an explicit `observed_at_ms` timestamp.
418    pub fn verify_transcript_at(
419        &self,
420        outer: &MessagePayload,
421        receiver_network_id: u32,
422        beneficiary: Did,
423        observed_at_ms: u128,
424    ) -> std::result::Result<ProbeRequest, ServiceReceiptError> {
425        self.claim.validate()?;
426        if self.claim.network_id != receiver_network_id {
427            return Err(ServiceReceiptError::NetworkMismatch {
428                expected: receiver_network_id,
429                actual: self.claim.network_id,
430            });
431        }
432        let provider = outer.transaction.origin();
433        if outer.transaction.destination != beneficiary
434            || self.claim.provider_account != provider
435            || self.claim.beneficiary_account != beneficiary
436        {
437            return Err(ServiceReceiptError::TranscriptRoleMismatch);
438        }
439        if self.request.origin() != beneficiary
440            || self.request.destination != provider
441            || self.request.tx_id != outer.transaction.tx_id
442            || !self.request.verify_at(receiver_network_id, observed_at_ms)
443        {
444            return Err(ServiceReceiptError::InvalidRequestTransaction);
445        }
446        let request_message: Message = self
447            .request
448            .data()
449            .map_err(|_| ServiceReceiptError::InvalidRequestTransaction)?;
450        let Message::ProbeRequest(request) = request_message else {
451            return Err(ServiceReceiptError::InvalidRequestTransaction);
452        };
453        if request.epoch != self.claim.epoch || request.nonce != self.claim.nonce {
454            return Err(ServiceReceiptError::TranscriptDigestMismatch);
455        }
456        let request_digest = self
457            .request
458            .digest()
459            .map_err(|_| ServiceReceiptError::CanonicalEncoding)?
460            .into_bytes();
461        if request_digest != self.claim.request_digest {
462            return Err(ServiceReceiptError::TranscriptDigestMismatch);
463        }
464        if self.completion.origin() != provider
465            || self.completion.destination != beneficiary
466            || self.completion.tx_id != outer.transaction.tx_id
467            || !self
468                .completion
469                .verify_at(receiver_network_id, observed_at_ms)
470        {
471            return Err(ServiceReceiptError::InvalidCompletionTransaction);
472        }
473        let completion: ProbeCompletion = self
474            .completion
475            .data()
476            .map_err(|_| ServiceReceiptError::InvalidCompletionTransaction)?;
477        if completion.request_digest != request_digest || completion.nonce != request.nonce {
478            return Err(ServiceReceiptError::TranscriptDigestMismatch);
479        }
480        let completion_digest = self
481            .completion
482            .digest()
483            .map_err(|_| ServiceReceiptError::CanonicalEncoding)?
484            .into_bytes();
485        if completion_digest != self.claim.completion_digest {
486            return Err(ServiceReceiptError::TranscriptDigestMismatch);
487        }
488        self.claim.verify_role_attestation(
489            &self.provider_attestation,
490            provider,
491            PROVIDER_DOMAIN,
492            ServiceReceiptError::InvalidProviderAttestation,
493        )?;
494        Ok(request)
495    }
496
497    /// Verify an offered transcript before the beneficiary signs it during live collection.
498    pub fn verify_live_transcript_at(
499        &self,
500        outer: &MessagePayload,
501        receiver_network_id: u32,
502        beneficiary: Did,
503        observed_at_ms: u128,
504    ) -> std::result::Result<ProbeRequest, ServiceReceiptError> {
505        let request =
506            self.verify_transcript_at(outer, receiver_network_id, beneficiary, observed_at_ms)?;
507        let seconds = u64::try_from(observed_at_ms / 1_000)
508            .map_err(|_| ServiceReceiptError::ObservationTimeOverflow)?;
509        self.claim.verify_live_role_attestation_at(
510            &self.provider_attestation,
511            self.claim.provider_account,
512            PROVIDER_DOMAIN,
513            observed_at_ms,
514            ServiceReceiptError::ProviderAttestationNotLive,
515        )?;
516        if !self.claim.epoch.is_accepted_at(seconds) {
517            return Err(ServiceReceiptError::EpochOutsideTolerance {
518                claim_slot: self.claim.epoch.slot,
519                observed_slot: ProvisionalEpoch::from_unix_seconds(seconds).slot,
520            });
521        }
522        Ok(request)
523    }
524}
525
526/// Beneficiary acknowledgement carrying the now-complete receipt.
527#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
528pub struct ProbeAcknowledgement {
529    /// Complete receipt admitted by the provider after verification.
530    pub receipt: ProvisionalServiceReceipt,
531}
532
533/// Typed rejection reason for provisional receipt construction or verification.
534#[derive(Clone, Copy, Debug, Eq, PartialEq, Error)]
535pub enum ServiceReceiptError {
536    /// Canonical encoding or decoding failed.
537    #[error("provisional receipt canonical encoding failed")]
538    CanonicalEncoding,
539    /// Input decoded but was not byte-for-byte canonical.
540    #[error("provisional receipt encoding is not canonical")]
541    NonCanonicalEncoding,
542    /// The claim's overlay differs from the receiver or signing authority.
543    #[error("provisional receipt network mismatch: expected {expected}, actual {actual}")]
544    NetworkMismatch {
545        /// Receiver or claim network.
546        expected: u32,
547        /// Presented network.
548        actual: u32,
549    },
550    /// Provider and beneficiary cannot be the same account.
551    #[error("provisional receipt provider and beneficiary are the same account")]
552    SameAccountRoles,
553    /// Probe has a unit count other than one.
554    #[error("Probe requires one unit, got {units}")]
555    InvalidProbeUnits {
556        /// Rejected non-zero unit count.
557        units: u64,
558    },
559    /// A delegation belongs to a different delegator role.
560    #[error("receipt signer account {actual} does not match role account {expected}")]
561    SignerRoleMismatch {
562        /// Account fixed by the claim role.
563        expected: Did,
564        /// Account recovered from the delegated delegation proof.
565        actual: Did,
566    },
567    /// Provider signature failed under the provider domain.
568    #[error("invalid provider receipt attestation")]
569    InvalidProviderAttestation,
570    /// Beneficiary signature failed under the beneficiary domain.
571    #[error("invalid beneficiary receipt attestation")]
572    InvalidBeneficiaryAttestation,
573    /// Provider proof was not live at collection.
574    #[error("provider receipt attestation was not live at collection")]
575    ProviderAttestationNotLive,
576    /// Beneficiary proof was not live at collection.
577    #[error("beneficiary receipt attestation was not live at collection")]
578    BeneficiaryAttestationNotLive,
579    /// Millisecond observation time cannot be represented in whole seconds.
580    #[error("receipt observation time exceeds the supported Unix-second range")]
581    ObservationTimeOverflow,
582    /// Claim slot is not the current or adjacent live-collection slot.
583    #[error("receipt epoch {claim_slot} is outside tolerance around {observed_slot}")]
584    EpochOutsideTolerance {
585        /// Slot carried by the claim.
586        claim_slot: u64,
587        /// Receiver's current slot.
588        observed_slot: u64,
589    },
590    /// Outer response and claim disagree about the account roles.
591    #[error("probe transcript account roles are inconsistent")]
592    TranscriptRoleMismatch,
593    /// Embedded request transaction is invalid.
594    #[error("probe request transaction is invalid")]
595    InvalidRequestTransaction,
596    /// Embedded completion transaction is invalid.
597    #[error("probe completion transaction is invalid")]
598    InvalidCompletionTransaction,
599    /// A claim digest does not match its exact signed transaction.
600    #[error("probe transcript digest mismatch")]
601    TranscriptDigestMismatch,
602}
603
604fn encode_prefixed<T: Serialize>(
605    prefix: &[u8],
606    value: &T,
607) -> std::result::Result<Vec<u8>, ServiceReceiptError> {
608    let body = rings_codec::serialize(value).map_err(|_| ServiceReceiptError::CanonicalEncoding)?;
609    let capacity = prefix
610        .len()
611        .checked_add(body.len())
612        .ok_or(ServiceReceiptError::CanonicalEncoding)?;
613    let mut bytes = Vec::with_capacity(capacity);
614    bytes.extend_from_slice(prefix);
615    bytes.extend_from_slice(&body);
616    Ok(bytes)
617}
618
619fn decode_prefixed<T>(prefix: &[u8], bytes: &[u8]) -> std::result::Result<T, ServiceReceiptError>
620where T: serde::de::DeserializeOwned + Serialize {
621    let body = bytes
622        .strip_prefix(prefix)
623        .ok_or(ServiceReceiptError::CanonicalEncoding)?;
624    let value =
625        rings_codec::deserialize(body).map_err(|_| ServiceReceiptError::CanonicalEncoding)?;
626    if encode_prefixed(prefix, &value)? != bytes {
627        return Err(ServiceReceiptError::NonCanonicalEncoding);
628    }
629    Ok(value)
630}
631
632#[cfg(test)]
633mod tests;
634
635// The native-only executable model explores time, loss, duplication,
636// reordering, replay, restart, and eviction. Wasm keeps the shared refinement
637// tests in `tests` without pulling in the native Stateright dependency.
638#[cfg(all(test, not(target_family = "wasm")))]
639mod model;