Skip to content

Commit

Permalink
update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jack committed Jun 22, 2024
1 parent 1c2148c commit cd2ab26
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/containers/consignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,25 +376,31 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
)));
}
}
index.bundle_ids().for_each(|bundle_id| {
let transition_bundle = index
.bundle(bundle_id)
.expect("index transition bundle failed");
transition_bundle
.known_transitions
.values()
.for_each(|transition| {
transition.assignments.values().for_each(|assign| {
assign.as_attachment().iter().for_each(|item| {
let state = item
.as_revealed_state()
.expect("get revealed attached state failed");
if !self.attachments.keys().any(|&id| id == state.id) {
status.add_warning(Warning::Custom(format!(
"attach id from data containers {:?} is not present in the \
consignment",
state.id
)));
}
})
})
})
});

Check warning on line 403 in src/containers/consignment.rs

View check run for this annotation

Codecov / codecov/patch

src/containers/consignment.rs#L379-L403

Added lines #L379 - L403 were not covered by tests
for bundle in self.bundles.iter() {
for transition_bundle in bundle.bundles() {
for transition in transition_bundle.known_transitions.values() {
for assign in transition.assignments.values() {
assign.as_attachment()
.iter()
.for_each(|item| {
let state = item.as_revealed_state().unwrap();
if !self.attachments.keys().any(|&id| id == state.id ) {
status.add_warning(Warning::Custom(format!(
"attach id {:?} is not present in the consignment"
, state.id)));
}
})
}
}
}
}
// TODO: check attach ids from data containers are present in operations
// TODO: validate sigs and remove untrusted

Expand Down

0 comments on commit cd2ab26

Please sign in to comment.