@@ -1499,12 +1499,6 @@ impl<T: Config> Pallet<T> {
1499
1499
/// Raises `SignatureAlreadySubmitted` if the signature exists in the registry.
1500
1500
/// Raises `SignatureRegistryLimitExceeded` if the oldest signature of the list has not yet expired.
1501
1501
///
1502
- /// Example list:
1503
- /// - `1,2 (oldest)`
1504
- /// - `2,3`
1505
- /// - `3,4`
1506
- /// - 4 (newest in pointer storage)`
1507
- ///
1508
1502
/// # Errors
1509
1503
/// * [`Error::ProofNotYetValid`]
1510
1504
/// * [`Error::ProofHasExpired`]
@@ -1551,6 +1545,27 @@ impl<T: Config> Pallet<T> {
1551
1545
}
1552
1546
1553
1547
/// Do the actual enqueuing into the list storage and update the pointer
1548
+ ///
1549
+ /// The signature registry consist of two storage items:
1550
+ /// - `PayloadSignatureRegistryList` - a linked list of signatures, in which each entry
1551
+ /// points to the next newest signature. The list is stored as a mapping of
1552
+ /// `MultiSignature` to a tuple of `(BlockNumberFor<T>, MultiSignature)`.
1553
+ /// The tuple contains the expiration block number and the next signature in the list.
1554
+ /// - `PayloadSignatureRegistryPointer` - a struct containing the newest signature,
1555
+ /// the oldest signature, the count of signatures, and the expiration block number of the newest signature.
1556
+ ///
1557
+ /// NOTE: 'newest' and 'oldest' refer to the order in which the signatures were added to the list,
1558
+ /// which is not necessarily the order in which they expire.
1559
+ ///
1560
+ /// Example: (key [signature], value [next newest signature])
1561
+ /// - `1,2 (oldest)`
1562
+ /// - `2,3`
1563
+ /// - `3,4`
1564
+ /// - 4 (newest in pointer storage)`
1565
+ ///
1566
+ // DEVELOPER NOTE: As currently implemented, the signature registry list will continue to grow until it reaches
1567
+ // the maximum number of signatures, at which point it will remain at that size, only ever replacing the oldest
1568
+ // signature with the newest one. This is a trade-off between storage space and performance.
1554
1569
fn enqueue_signature (
1555
1570
signature : & MultiSignature ,
1556
1571
signature_expires_at : BlockNumberFor < T > ,
@@ -1595,7 +1610,7 @@ impl<T: Config> Pallet<T> {
1595
1610
}
1596
1611
1597
1612
// Add the newest signature if we are not the first
1598
- if pointer. count != 0 && current_block . le ( & pointer . newest_expires_at ) {
1613
+ if pointer. count != 0 {
1599
1614
<PayloadSignatureRegistryList < T > >:: insert (
1600
1615
pointer. newest ,
1601
1616
( pointer. newest_expires_at , signature. clone ( ) ) ,
0 commit comments