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    /// Original reservation denial, retaining the canonical typed accounting cause.
21    #[error("original mutation reservation rejected: {0}")]
22    Reservation(#[from] crate::model::attempt_journal::MutationReservationError),
23    /// The receiver or effective routing target is not an admitted application principal.
24    #[error("invalid application ingress principal")]
25    InvalidPrincipal,
26    /// Management ingress must use the closed management request owners.
27    #[error("application ingress cannot target the management canister")]
28    ManagementPrincipal,
29    /// Method must have 1..=128 exact visible ASCII bytes.
30    #[error("invalid application ingress method")]
31    InvalidMethod,
32    /// Opaque arguments exceed the finite owner bound.
33    #[error("application ingress arguments too large")]
34    ArgumentsTooLarge,
35    /// Caller-selected reply ceiling must be 1..=1 MiB and is bound into the original digest.
36    #[error("invalid application ingress reply limit")]
37    InvalidReplyLimit,
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    /// Exact separately reserved recovery identity failed admission.
45    #[error(transparent)]
46    Observation(#[from] IcObservationRequestError),
47    /// Original operation cannot be derived.
48    #[error(transparent)]
49    Plan(#[from] OperationPlanError),
50}
51
52#[cfg(test)]
53mod tests;