Merge getevents-v2 branch into main - #6001
Merged
Merged
Conversation
urvisavla
force-pushed
the
getevents-v2
branch
from
September 3, 2026 21:47
2cc2314 to
eb6f968
Compare
urvisavla
marked this pull request as ready for review
September 3, 2026 21:48
karthikiyer56
approved these changes
Sep 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds getEvents v2 protocol types and validation while aligning legacy event responses.
Changes:
- Adds v2 request, response, filtering, errors, and validation.
- Adds comprehensive protocol tests.
- Removes the deprecated v1 success field.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
protocols/rpc/get_events.go |
Removes the deprecated event field. |
protocols/rpc/get_events_v2.go |
Defines and validates the v2 wire protocol. |
protocols/rpc/get_events_v2_test.go |
Tests validation and JSON contracts. |
CHANGELOG.md |
Announces getEvents v2 support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
LGTM, and approved, copilot turned up valid comments btw |
) * protocols/rpc: Add getEvents v2 wire types and request validation Transcribe the getEvents v2 wire types from the accepted proposal (https://github.com/orgs/stellar/discussions/1872): request/response/event structs, scan statuses, error reasons and error.data payloads, and the spec's default caps. Valid checks every rule decidable from the request alone and returns the first violation as a typed *InvalidParamsError carrying the proposal's verbatim message plus the ready-to-serialize error.data payload. Rules needing server state stay with the server: the serving window, unknown-field rejection, json-format topic decoding, and the term budget (counting terms requires the server's XDR-JSON converter). The limit cap (1000) is spec-fixed and enforced as a constant; the filter cap (256) is a provider-configurable default passed to Valid; the term budget (15) ships as a documented constant with its error.data fields. Tests pin the wire contract with golden JSON for requests, responses, events, and error payloads, literal assertions for every wire constant and message, a reflection test keeping EventInfoV2 in lockstep with v1's EventInfo (minus the deprecated inSuccessfulContractCall), and boundary cases for custom and zero filter caps. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * protocols/rpc: address getEvents v2 review comments - Limit becomes *uint so wire presence is preserved: nil means omitted (server default applies), while an explicit limit outside [1, 1000] is rejected with the proposal's message, closing the documented limit-0 deviation. - The validation test helper asserts full error messages with EqualError instead of Contains, actually pinning the proposal's verbatim wording. - Document that "filters": null decodes like an omitted member (match all events), consistent with null topic handling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * protocols/rpc: address getEvents v2 review round 2 - Restructure Valid on the spec's union discriminator: shared checks (xdrFormat, limit) run first, then validCursorQuery or validRangeQuery. Removes the duplicated cursor guard, and cursor + invalid xdrInputFormat now reports mutual exclusion, the truer complaint. - Add TopicScVal(xdr.ScValView) so callers build topic values without hand-assembling quoted base64 JSON; it validates the view first. The test helper now goes through it. - Valid takes a defined MaxFilters type, so a v1-shaped call site (Valid(maxLimit)) cannot compile with the wrong cap. - Validate topics by unmarshalling into xdr.ScValView (base64-decodes and structurally validates without building an ScVal tree; the Raw length check keeps trailing-byte strictness). - LedgerOutOfRangeErrorData/CursorMalformedErrorData inject Reason in MarshalJSON so a wrong reason is unrepresentable; InvalidParamsErrorData documents why it is the exception. - Reject contract IDs whose checksum-valid payload is not 32 bytes (strkey.Decode does not enforce length). - Document that maxFilters must be >= 1; hasTopic via slices.ContainsFunc; mapKeys replaced by slices.Collect(maps.Keys). - Tests: pin "filters": null decoding from real JSON for both query shapes, cover the short-payload contract ID and malformed TopicScVal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Add getEvents v2 wire types to the pending changelog Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Deprecated since protocol 23 with 'remove in v24'. The full-history RPC's getEvents endpoint launches without it, so the removal lands ahead of the v24 window rather than shipping a new server that still serves it. Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
urvisavla
force-pushed
the
getevents-v2
branch
from
September 3, 2026 22:12
f90347e to
a164201
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge getevents-v2 branch into main