@@ -16,24 +16,13 @@ import (
1616// guarantee! This method silently overrides existing data, which is safe only if for the same
1717// key, we always write the same value.
1818//
19- // Expected errors during normal operations:
20- // - generic error in case of unexpected failure from the database layer or encoding failure.
19+ // No errors expected during normal operations.
2120func InsertGuarantee (w storage.Writer , guaranteeID flow.Identifier , guarantee * flow.CollectionGuarantee ) error {
2221 return UpsertByKey (w , MakePrefix (codeGuarantee , guaranteeID ), guarantee )
2322}
2423
2524// IndexGuarantee inserts a [flow.CollectionGuarantee] into the database, keyed by the collection ID.
2625//
27- // CAUTION:
28- // - The caller must acquire the [storage.LockInsertBlock] and hold it until the database write has been committed.
29- // - OVERWRITES existing data (potential for data corruption):
30- // This method silently overrides existing data without any sanity checks whether data for the same key already exists.
31- // Note that the Flow protocol mandates that for a previously persisted key, the data is never changed to a different
32- // value. Changing data could cause the node to publish inconsistent data and to be slashed, or the protocol to be
33- // compromised as a whole. This method does not contain any safeguards to prevent such data corruption. The lock proof
34- // serves as a reminder that the CALLER is responsible to ensure that the DEDUPLICATION CHECK is done elsewhere
35- // ATOMICALLY with this write operation.
36- //
3726// Expected errors during normal operations:
3827// - [storage.ErrDataMismatch] if a different [flow.CollectionGuarantee] has already been indexed for the given collection ID.
3928// - All other errors have to be treated as unexpected failures from the database layer.
@@ -91,9 +80,7 @@ func LookupGuarantee(r storage.Reader, collectionID flow.Identifier, guaranteeID
9180// serves as a reminder that the CALLER is responsible to ensure that the DEDUPLICATION CHECK is done elsewhere
9281// ATOMICALLY with this write operation.
9382//
94- // Error returns:
95- // - [storage.ErrAlreadyExists] if the key already exists in the database.
96- // - All other errors have to be treated as unexpected failures from the database layer.
83+ // No errors expected during normal operations.
9784func IndexPayloadGuarantees (lctx lockctx.Proof , w storage.Writer , blockID flow.Identifier , guarIDs []flow.Identifier ) error {
9885 if ! lctx .HoldsLock (storage .LockInsertBlock ) {
9986 return fmt .Errorf ("cannot index guarantee for blockID %v without holding lock %s" ,
0 commit comments