Skip to main content

ic_backup/model/application_ingress/
mod.rs

1//! Opaque application update declarations under original mutation or observation reservations.
2//!
3//! Applications own codecs, fresh authority, whole-unit safety, original byte/command
4//! custody and qualified outcomes. These passive types grant no dispatch or resend.
5
6mod payload;
7mod request;
8pub use payload::{
9    ApplicationIngressPayload, MAX_APPLICATION_INGRESS_ARGUMENT_BYTES,
10    MAX_APPLICATION_INGRESS_METHOD_BYTES, MAX_APPLICATION_INGRESS_REPLY_BYTES,
11};
12pub use request::{ApplicationMutationRequest, ApplicationObservationRequest};
13
14use crate::model::{ic_observation::IcObservationRequestError, operation_plan::OperationPlanError};
15use thiserror::Error;
16
17/// Exact opaque update or original reservation admission failed; no spending changes.
18#[derive(Debug, Error)]
19pub enum ApplicationIngressError {
20    /// The receiver or effective routing target is not an admitted application principal.
21    #[error("invalid application ingress principal")]
22    InvalidPrincipal,
23    /// Management ingress must use the closed management request owners.
24    #[error("application ingress cannot target the management canister")]
25    ManagementPrincipal,
26    /// Method must have 1..=128 exact visible ASCII bytes.
27    #[error("invalid application ingress method")]
28    InvalidMethod,
29    /// Opaque arguments exceed the finite owner bound.
30    #[error("application ingress arguments too large")]
31    ArgumentsTooLarge,
32    /// Caller-selected reply ceiling must be 1..=1 MiB and is bound into the original digest.
33    #[error("invalid application ingress reply limit")]
34    InvalidReplyLimit,
35    /// Original journal differs from the complete plan-derived authority.
36    #[error("application ingress authority mismatch")]
37    AuthorityMismatch,
38    /// Effective target differs from the original operation.
39    #[error("application ingress target mismatch")]
40    TargetMismatch,
41    /// Receiver, target, fixed update mode, method, bytes or reply ceiling changed.
42    #[error("application ingress payload mismatch")]
43    PayloadMismatch,
44    /// No original mutation reservation is pending.
45    #[error("application ingress requires a pending mutation")]
46    NoPendingMutation,
47    /// The original mutation was replaced or settled.
48    #[error("application ingress mutation mismatch")]
49    MutationMismatch,
50    /// Recovery is pending; the original mutation cannot be submitted through this lane.
51    #[error("application ingress observation is pending")]
52    ObservationPending,
53    /// Exact separately reserved recovery identity failed admission.
54    #[error(transparent)]
55    Observation(#[from] IcObservationRequestError),
56    /// Original operation cannot be derived.
57    #[error(transparent)]
58    Plan(#[from] OperationPlanError),
59}
60
61#[cfg(test)]
62mod tests;