Skip to content

feat: make store fetch messages by hash #2351

Open
@weboko

Description

@weboko

Description

The Waku Store protocol specification supports querying messages by their hash, but our current implementation makes this impossible due to validation logic conflicts. When attempting to use messageHashes as a query parameter, users encounter a catch-22:

  1. Using queryGenerator requires passing decoders, which automatically sets pubsubTopic and contentTopics
  2. The validation logic then rejects the query with an error:
if (
  params.messageHashes &&
  params.messageHashes.length > 0 &&
  (params.pubsubTopic ||
    (params.contentTopics && params.contentTopics.length > 0) ||
    params.timeStart ||
    params.timeEnd)
) {
  throw new Error(
    "Message hash lookup queries cannot include content filter criteria"
  );
}

This makes it currently impossible to use the message hash lookup feature that's specified in the protocol, despite it being exposed in our API interfaces.

User Story

As a developer, I want to query specific messages by their hash directly, so that I can efficiently retrieve exactly the messages I need without having to filter through time-based or content-based results.

Proposed Solution / Feature Design

Fix the validation logic to properly handle message hash queries:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Code Review / QA

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions