Skip to content

Conversation

@tlovell-sxt
Copy link
Contributor

Rationale for this change

There is no mechanism as we speak to expire batches that were never able to find quorum. This will eventually lead to storage becoming unmanageably large, and bad actors (if they had permission to) could attack this unbounded storage with submissions that will intentionally never reach quorum. A basic protection against this would be to prune batches that are still finding quorum after a certain limit has been reached. This change accomplishes this, keeping track of batch submission order with a new BatchQueue and attempting to prune submissions from the back of the queue once a configurable capacity is reached.

What changes are included in this PR?

The commits provide a decent summary:

  • feat: impose bound on number of batches finding quorum
  • feat: migrate storage to populate batch queue from submissions

Are these changes tested?

Yes.

There is no mechanism as we speak to expire batches that were never able
to find quorum. This will eventually lead to storage becoming
unmanageably large, and bad actors (if they had permission to) could
attack this unbounded storage with submissions that will intentionally
never reach quorum. A basic protection against this would be to prune
batches that are still finding quorum after a certain limit has been
reached. This change accomplishes this, keeping track of batch
submission order with a new BatchQueue and attempting to prune
submissions from the back of the queue once a configurable capacity is
reached.
Recently, the indexing pallet imposed a bound on batches finding quorum
with the help of a new BatchQueue in storage. This adds a storage
migration to populate the initial contents of this BatchQueue, by
analyzing the submissions storage.

This implementation is simple but dumb. There's no way for us to know
what order the batches were initially submitted in from current storage,
so this just inserts them to the batch queue in their iteration order
(lexicographic ordering of the hash of the batch ids). Furthermore, this
does not do any pruning, so ideally this the batch queue capacity should
exceed the number of batches finding quorum in all live networks so that
they are pruned more gradually.
@tlovell-sxt tlovell-sxt force-pushed the feat/bound-submissions branch from f428573 to cb30828 Compare June 12, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants