Skip to content

Commit 05a961b

Browse files
committed
fix(isolation): seal confirmed boundary state
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent deefa2a commit 05a961b

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

‎crates/openshell-isolation-interface/src/contract.rs‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,26 @@ impl SandboxConfirmEvidence {
487487

488488
/// Ready boundary paired with the evidence measured by `confirm`.
489489
pub struct ConfirmedBoundary {
490-
pub boundary: Box<dyn ReadyBoundary>,
491-
pub evidence: SandboxConfirmEvidence,
490+
boundary: Box<dyn ReadyBoundary>,
491+
evidence: SandboxConfirmEvidence,
492+
}
493+
494+
impl ConfirmedBoundary {
495+
/// Construct a confirmed state after backend-specific evidence validation.
496+
#[allow(dead_code)] // Implemented by the remote backend in the next stack layer.
497+
pub(crate) fn new(boundary: Box<dyn ReadyBoundary>, evidence: SandboxConfirmEvidence) -> Self {
498+
Self { boundary, evidence }
499+
}
500+
501+
/// Return the measured evidence carried by this confirmed state.
502+
pub fn evidence(&self) -> &SandboxConfirmEvidence {
503+
&self.evidence
504+
}
505+
506+
/// Consume confirmation and advance to the sole launch-capable state.
507+
pub fn into_boundary(self) -> Box<dyn ReadyBoundary> {
508+
self.boundary
509+
}
492510
}
493511

494512
/// Ready: standing enforcement is confirmed, and the backend is prepared to

‎crates/openshell-isolation-interface/src/contract/tests.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ impl<K: MockKind> BoundBoundary for MockBound<K> {
211211
self.source.clone()
212212
}
213213
async fn confirm(self: Box<Self>) -> Result<ConfirmedBoundary, BackendError> {
214-
Ok(ConfirmedBoundary {
215-
boundary: Box::new(MockReady::<K> { _k: PhantomData }),
216-
evidence: confirmation_evidence(),
217-
})
214+
Ok(ConfirmedBoundary::new(
215+
Box::new(MockReady::<K> { _k: PhantomData }),
216+
confirmation_evidence(),
217+
))
218218
}
219219
}
220220

0 commit comments

Comments
 (0)