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::{
15    attempt_journal::ObservationReservationError, operation_plan::OperationPlanError,
16};
17use thiserror::Error;
18
19/// Exact opaque update or original reservation admission failed; no spending changes.
20#[derive(Debug, Error)]
21pub enum ApplicationIngressError {
22    /// Original reservation denial, retaining the canonical typed accounting cause.
23    #[error("original mutation reservation rejected: {0}")]
24    Reservation(#[from] crate::model::attempt_journal::MutationReservationError),
25    /// The receiver or effective routing target is not an admitted application principal.
26    #[error("invalid application ingress principal")]
27    InvalidPrincipal,
28    /// Management ingress must use the closed management request owners.
29    #[error("application ingress cannot target the management canister")]
30    ManagementPrincipal,
31    /// Method must have 1..=128 exact visible ASCII bytes.
32    #[error("invalid application ingress method")]
33    InvalidMethod,
34    /// Opaque arguments exceed the finite owner bound.
35    #[error("application ingress arguments too large")]
36    ArgumentsTooLarge,
37    /// Caller-selected reply ceiling must be 1..=1 MiB and is bound into the original digest.
38    #[error("invalid application ingress reply limit")]
39    InvalidReplyLimit,
40    /// Effective target differs from the original operation.
41    #[error("application ingress target mismatch")]
42    TargetMismatch,
43    /// Receiver, target, fixed update mode, method, bytes or reply ceiling changed.
44    #[error("application ingress payload mismatch")]
45    PayloadMismatch,
46    /// Exact separately reserved recovery identity failed admission.
47    #[error(transparent)]
48    Observation(#[from] ObservationReservationError),
49    /// Original operation cannot be derived.
50    #[error(transparent)]
51    Plan(#[from] OperationPlanError),
52}
53
54#[cfg(test)]
55mod tests;