Skip to content

Commit

Permalink
fix: add a limit of max 10 content topics per query (#3117)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos authored Oct 16, 2024
1 parent bdb31cc commit c35dc54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions waku/waku_archive/archive.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ logScope:
const
DefaultPageSize*: uint = 20
MaxPageSize*: uint = 100
MaxContentTopicsPerQuery*: int = 10

# Retention policy
WakuArchiveDefaultRetentionPolicyInterval* = chronos.minutes(30)
Expand Down Expand Up @@ -125,6 +126,9 @@ proc findMessages*(
if cursor == EmptyWakuMessageHash:
return err(ArchiveError.invalidQuery("all zeroes cursor hash"))

if query.contentTopics.len > MaxContentTopicsPerQuery:
return err(ArchiveError.invalidQuery("too many content topics"))

let maxPageSize =
if query.pageSize <= 0:
DefaultPageSize
Expand Down

0 comments on commit c35dc54

Please sign in to comment.