Skip to content

More flexible block identifiers for requests#154

Merged
scarmuega merged 2 commits intoutxorpc:mainfrom
SebastienGllmt:block-identifier
Apr 23, 2025
Merged

More flexible block identifiers for requests#154
scarmuega merged 2 commits intoutxorpc:mainfrom
SebastienGllmt:block-identifier

Conversation

@SebastienGllmt
Copy link
Copy Markdown
Contributor

Close #148

@scarmuega
Copy link
Copy Markdown
Member

I think there's no need for a oneof structure to achieve the goal of having a flexible query mechanism for blocks.

In proto3, all message fields are considered optional. This means that the BlockRef struct already provides a way for the user to select which combination of fields to send. You can, for example, already send something like BlockRef { index: 2000 } (without any other value) and it will be accepted by the interface.

If we move to a oneof approach, we're in constraining rather than relaxing the options of the user (because it wouldn't have a way of specifying both values).

I would modify the PR to:

  • discard the AnyBlockIdentifier since we don't need it
  • add a new height field to the BlockRef struct to support it as a query criteria
  • rename index -> slot to improve readability
  • explain via docs how to interpret the BlockRef structure as a query input that supports any combination of field

Once merged, the more concrete problem is to make sure that backend providers (like Dingo, Dolos, etc) follow the correct semantics when processing these requests.

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.

Consider making ChainPoint use optional fields

2 participants