This repository was archived by the owner on May 21, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,17 +226,19 @@ public fun attestation<T: key + store>(
226226 receiver: address ,
227227 attestation_id: ID ,
228228): &Attestation <T > {
229- if (
230- registry.attested.borrow (receiver).contains (attestation_id)
231- ) {
232- registry.attested.borrow (receiver).borrow (attestation_id)
233- } else if (
234- registry.revoked.borrow (receiver).contains (attestation_id)
235- ) {
236- registry.revoked.borrow (receiver).borrow (attestation_id)
237- } else {
238- registry.pinned.borrow (receiver).borrow (attestation_id)
239- }
229+ // Ensure receiver is known
230+ assert ! (registry.attested.contains (receiver), EUnknownReceiver );
231+
232+ // Find attestation in one of the bags
233+ let attested = ®istry.attested[receiver];
234+ if (attested.contains (attestation_id)) return &attested[attestation_id];
235+ let revoked = ®istry.revoked[receiver];
236+ if (revoked.contains (attestation_id)) return &revoked[attestation_id];
237+ let pinned = ®istry.pinned[receiver];
238+ if (pinned.contains (attestation_id)) return &pinned[attestation_id];
239+
240+ // Abort if attestation is not found in any of the bags
241+ abort EUnknownAttestationId
240242}
241243
242244/// Return attestation.revoked_by field
You can’t perform that action at this time.
0 commit comments