Add the lock-owned transactional Domain Store
This commit is contained in:
parent
96b494a8bb
commit
e4d9cc2dc9
6 changed files with 1197 additions and 292 deletions
|
|
@ -8,12 +8,11 @@ use lazaret_core::identity::{
|
|||
BootId, BundleDigest, CapabilityId, CertificateDigest, ClientId, ConfigurationFingerprint,
|
||||
ContainerId, CoordinatorId, DerivedPolicyDigest, DeviceId, DomainId, FileDescriptor,
|
||||
GenerationId, GuestProcessGroupId, GuestProcessId, GuestProcessStartTimeTicks, HostPath,
|
||||
HostPidLocator, IdMapDigest, InodeId, LegacyUnverifiedProcessIdentityV1, MountId,
|
||||
MountIdentity, NamespaceIdentity, NetworkSidecarId, PidfsDeviceId, PidfsInodeId,
|
||||
PidfsProcessAuthorityV1, PidfsProcessIdentityV1, PolicyId, PrepareOperationId,
|
||||
PreparedArtifactId, ProcessStartTimeTicks, ProtocolCredentialId, ReadinessFingerprint,
|
||||
RequestDigest, RequestId, SandboxId, SelectedManifestDigest, SessionAnchorId, SessionId,
|
||||
SourceIdentity, StreamDigest, TrustManifestDigest,
|
||||
HostPidLocator, IdMapDigest, InodeId, MountId, MountIdentity, NamespaceIdentity,
|
||||
NetworkSidecarId, PidfsDeviceId, PidfsInodeId, PidfsProcessAuthorityV1, PidfsProcessIdentityV1,
|
||||
PolicyId, PrepareOperationId, PreparedArtifactId, ProcessStartTimeTicks, ProtocolCredentialId,
|
||||
ReadinessFingerprint, RequestDigest, RequestId, SandboxId, SelectedManifestDigest,
|
||||
SessionAnchorId, SessionId, SourceIdentity, StreamDigest, TrustManifestDigest,
|
||||
};
|
||||
use lazaret_core::records::*;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
|
|
|||
|
|
@ -40,22 +40,8 @@ fn store_identity_and_versions_dispatch_before_rows() {
|
|||
decode::<DomainStoreMetadata>(&encode(&StoreMetadata::storage_catalog_v1()).unwrap()),
|
||||
Err(CodecError::MalformedPayload(_))
|
||||
));
|
||||
for domain_metadata in [
|
||||
StoreMetadata::domain_store_v2(),
|
||||
StoreMetadata::legacy_domain_store_v1(),
|
||||
] {
|
||||
assert!(matches!(
|
||||
decode::<StorageCatalogMetadata>(&encode(&domain_metadata).unwrap()),
|
||||
Err(CodecError::MalformedPayload(_))
|
||||
));
|
||||
}
|
||||
let legacy = StoreMetadata::legacy_domain_store_v1();
|
||||
assert_eq!(
|
||||
decode::<LegacyDomainStoreMetadata>(&encode(&legacy).unwrap()).unwrap(),
|
||||
LegacyDomainStoreMetadata::v1()
|
||||
);
|
||||
assert!(matches!(
|
||||
decode::<DomainStoreMetadata>(&encode(&legacy).unwrap()),
|
||||
decode::<StorageCatalogMetadata>(&encode(&StoreMetadata::domain_store_v1()).unwrap()),
|
||||
Err(CodecError::MalformedPayload(_))
|
||||
));
|
||||
|
||||
|
|
@ -79,7 +65,7 @@ fn store_identity_and_versions_dispatch_before_rows() {
|
|||
));
|
||||
|
||||
let wrong_catalog = postcard::to_stdvec(&RawStorageCatalog {
|
||||
metadata: StoreMetadata::domain_store_v2(),
|
||||
metadata: StoreMetadata::domain_store_v1(),
|
||||
prepared_artifacts: vec![],
|
||||
artifact_leases: vec![],
|
||||
prepare_operations: vec![],
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ fn every_schema_shape_round_trips_and_rejects_malformed_or_unknown_versions() {
|
|||
outbox_path: HostPath::new(b"outbox".to_vec()),
|
||||
state: ParticipantState::Committed,
|
||||
};
|
||||
let metadata = StoreMetadata::domain_store_v2();
|
||||
let metadata = StoreMetadata::domain_store_v1();
|
||||
let tls_credential = TlsCredential::session_coordinator(
|
||||
generation_identity(),
|
||||
coordinator_id(),
|
||||
|
|
@ -110,13 +110,6 @@ fn every_schema_shape_round_trips_and_rejects_malformed_or_unknown_versions() {
|
|||
);
|
||||
verify_shape(pidfs_identity.authority(), &mut seen);
|
||||
verify_shape(pidfs_identity, &mut seen);
|
||||
verify_shape(
|
||||
LegacyUnverifiedProcessIdentityV1::new(
|
||||
HostPidLocator::new(48),
|
||||
ProcessStartTimeTicks::new(480),
|
||||
),
|
||||
&mut seen,
|
||||
);
|
||||
verify_shape(HostProcessIdentity::pidfs_v1(pidfs_identity), &mut seen);
|
||||
verify_shape(
|
||||
PersistedHostProcessOwnership::staged(pidfs_identity),
|
||||
|
|
@ -442,7 +435,7 @@ fn every_schema_shape_round_trips_and_rejects_malformed_or_unknown_versions() {
|
|||
);
|
||||
verify_shape(
|
||||
DomainStore {
|
||||
metadata: DomainStoreMetadata::v2(),
|
||||
metadata: DomainStoreMetadata::v1(),
|
||||
domain,
|
||||
generations: vec![generation],
|
||||
participants: vec![participant],
|
||||
|
|
@ -729,7 +722,7 @@ fn trailing_and_nonminimal_postcard_encodings_are_rejected() {
|
|||
Err(CodecError::NonMinimalPayload)
|
||||
));
|
||||
|
||||
let mut overlong_store_id = encode(&StoreMetadata::domain_store_v2()).unwrap();
|
||||
let mut overlong_store_id = encode(&StoreMetadata::domain_store_v1()).unwrap();
|
||||
overlong_store_id[0] |= 0x80;
|
||||
overlong_store_id.insert(1, 0);
|
||||
assert!(matches!(
|
||||
|
|
|
|||
|
|
@ -136,21 +136,6 @@ fn newly_recorded_existing_processes_do_not_bypass_child_staging() {
|
|||
Ok(()),
|
||||
"{edge:?}"
|
||||
);
|
||||
|
||||
let legacy = participant_edge_snapshot(
|
||||
edge,
|
||||
PersistedHostProcessOwnership::legacy_unverified(
|
||||
LegacyUnverifiedProcessIdentityV1::new(
|
||||
current.host_pid(),
|
||||
current.start_time_ticks(),
|
||||
),
|
||||
),
|
||||
);
|
||||
assert_eq!(
|
||||
unassigned.validate_transition_to(&legacy),
|
||||
Err(RecordTransitionError::ProcessStageSkipped),
|
||||
"{edge:?}"
|
||||
);
|
||||
}
|
||||
|
||||
let acquired_edges = [
|
||||
|
|
@ -212,21 +197,6 @@ fn newly_recorded_existing_processes_do_not_bypass_child_staging() {
|
|||
terminal_unassigned.validate_transition_to(&terminal_existing_hc),
|
||||
Ok(())
|
||||
);
|
||||
let terminal_legacy_hc = terminal_snapshot(
|
||||
SessionTerminalState::Intent,
|
||||
PersistedHostProcessOwnership::legacy_unverified(LegacyUnverifiedProcessIdentityV1::new(
|
||||
HostPidLocator::new(101),
|
||||
ProcessStartTimeTicks::new(1_010),
|
||||
)),
|
||||
PersistedHostProcessOwnership::unassigned(),
|
||||
false,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
terminal_unassigned.validate_transition_to(&terminal_legacy_hc),
|
||||
Err(RecordTransitionError::ProcessStageSkipped)
|
||||
);
|
||||
|
||||
let terminal_exec_staged = terminal_snapshot(
|
||||
SessionTerminalState::Intent,
|
||||
owned_process(101),
|
||||
|
|
|
|||
|
|
@ -77,22 +77,7 @@ fn process_slot_separates_cleanup_authority_from_serviceability() {
|
|||
Err(ProcessAuthorityRefusal::Unassigned)
|
||||
);
|
||||
|
||||
let legacy = LegacyUnverifiedProcessIdentityV1::new(
|
||||
HostPidLocator::new(91),
|
||||
ProcessStartTimeTicks::new(910),
|
||||
);
|
||||
assert_eq!(
|
||||
HostProcessIdentity::legacy_unverified_v1(legacy).verified_pidfs(),
|
||||
Err(LegacyProcessIdentityRefusal)
|
||||
);
|
||||
assert_eq!(
|
||||
PersistedHostProcessOwnership::legacy_unverified(legacy).serviceable_pidfs(),
|
||||
Err(ProcessOwnershipRefusal::LegacyUnverified)
|
||||
);
|
||||
assert_eq!(
|
||||
PersistedHostProcessOwnership::legacy_unverified(legacy).authoritative_pidfs(),
|
||||
Err(ProcessAuthorityRefusal::LegacyUnverified)
|
||||
);
|
||||
assert_eq!(HostProcessIdentity::pidfs_v1(current).pidfs(), ¤t);
|
||||
|
||||
let staged_anchor = ParticipantOwnership::StateAnchor(state_anchor_ownership(
|
||||
PersistedHostProcessOwnership::staged(current),
|
||||
|
|
@ -267,14 +252,9 @@ fn participant_snapshot_matrix_is_phase_complete_and_strictly_decoded() {
|
|||
#[test]
|
||||
fn active_process_owners_require_complete_current_pidfs_evidence() {
|
||||
let current = process(94);
|
||||
let legacy = LegacyUnverifiedProcessIdentityV1::new(
|
||||
HostPidLocator::new(94),
|
||||
ProcessStartTimeTicks::new(940),
|
||||
);
|
||||
let invalid_slots = [
|
||||
PersistedHostProcessOwnership::unassigned(),
|
||||
PersistedHostProcessOwnership::staged(current),
|
||||
PersistedHostProcessOwnership::legacy_unverified(legacy),
|
||||
];
|
||||
for daemon in invalid_slots {
|
||||
assert_eq!(
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ use super::*;
|
|||
fn session_terminal_snapshot_and_transition_matrix_is_fail_closed() {
|
||||
let current_hc = process(101);
|
||||
let current_exec = process(102);
|
||||
let legacy = LegacyUnverifiedProcessIdentityV1::new(
|
||||
HostPidLocator::new(102),
|
||||
ProcessStartTimeTicks::new(1_020),
|
||||
);
|
||||
let bare = terminal_snapshot(
|
||||
SessionTerminalState::Intent,
|
||||
PersistedHostProcessOwnership::unassigned(),
|
||||
|
|
@ -19,7 +15,6 @@ fn session_terminal_snapshot_and_transition_matrix_is_fail_closed() {
|
|||
for invalid in [
|
||||
PersistedHostProcessOwnership::unassigned(),
|
||||
PersistedHostProcessOwnership::staged(current_exec),
|
||||
PersistedHostProcessOwnership::legacy_unverified(legacy),
|
||||
] {
|
||||
assert_eq!(
|
||||
terminal_snapshot(
|
||||
|
|
|
|||
Loading…
Reference in a new issue