Skip to content

Add getTransactions differential test suite - #976

Merged
cjonas9 merged 12 commits into
feature/full-historyfrom
add-differential-test-suite
Sep 14, 2026
Merged

cjonas9 merged 12 commits into
feature/full-historyfrom
add-differential-test-suite

Conversation

@cjonas9

@cjonas9 cjonas9 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What

This PR adds the getTransactions differential suite out of #962 into its own PR, stacked on the branch getTxByHash-views. It's split off from #962 for organization purposes, and all work relating to actually using views in the transaction read path is left over there.

get_transactions_differential_test.go reconstructs the pre-view decode path test-locally and asserts that it and the view-walk page loop produce byte-identical GetTransactionsResponse JSON over a corpus that sweeps LCM V0/V1/V2, TransactionMeta V1/V2/V3/V4, classic/Soroban/fee-bump envelopes, event shapes, empty ledgers, page boundaries and cursor round-trips (~400 subtests).

differential_test.go holds the method-agnostic machinery factored out of the suite: a generic two-sided comparator and cursor-chain driver, the corpus builders, and sqlite seeding. The upcoming getEvents differential suite (in PR #982) reuses it unchanged.

The suite is @tamirms's work from tamirms/gettransactions-view-walk, but the shared-helper refactor is new.

Retarget to feature/full-history once #962 merges.

Why

The suite validates #962's migration exhaustively, and ensures no regression of the arity fixes in stellar/go-stellar-sdk#5997. At ~900 lines, this suite obscured the few hundred load-bearing lines within that PR. Reviewing it separately keeps #962 focused on the read-path change, testing those changes more narrowly, and lets the corpus be evaluated on its own.

Known Limitations

N/A

@cjonas9 cjonas9 changed the title add getTransactions view-walk differential suite Add getTransactions differential test suite Sep 4, 2026
@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from b37ba5b to 3db4efa Compare September 4, 2026 19:08
@cjonas9
cjonas9 marked this pull request as ready for review September 4, 2026 19:36
Copilot AI balanced review requested due to automatic review settings September 4, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a differential test suite validating view-based getTransactions extraction against the legacy decoded path.

Changes:

  • Adds extensive transaction-shape, pagination, cursor, and rendering coverage.
  • Documents the shared transaction renderer’s differential-test role.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
get_transactions.go Updates renderer documentation.
get_transactions_differential_test.go Adds the differential corpus and tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go Outdated
Comment thread cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go Outdated
Copilot AI review requested due to automatic review settings September 8, 2026 17:50
@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from 812b325 to 7a25651 Compare September 8, 2026 17:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings September 8, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from 6255be5 to c61526d Compare September 8, 2026 19:57
Copilot AI review requested due to automatic review settings September 8, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread cmd/stellar-rpc/internal/methods/differential_test.go Outdated
@cjonas9 cjonas9 self-assigned this Sep 8, 2026
@cjonas9 cjonas9 linked an issue Sep 8, 2026 that may be closed by this pull request
5 of 6 tasks
Copilot AI review requested due to automatic review settings September 8, 2026 22:18
@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from c61526d to 3d1b739 Compare September 8, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go Outdated
Copilot AI review requested due to automatic review settings September 9, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go:386

  • The parallel phase keeps its TxSet envelope order [a,b,c,d] identical to the TxProcessing order supplied to diffLCM, so this part of the corpus never exercises hash pairing for parallel-phase transactions. A view implementation that accidentally pairs parallel envelopes positionally could still pass; build a valid shuffled agreed-set layout for this phase while retaining the apply-order specs.
		{V: 1, ParallelTxsComponent: &xdr.ParallelTxsComponent{
			ExecutionStages: []xdr.ParallelTxExecutionStage{
				{xdr.DependentTxCluster{a.envelope}},
				{xdr.DependentTxCluster{b.envelope}, xdr.DependentTxCluster{c.envelope, d.envelope}},

cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go:580

  • For the format=json cases, these Empty assertions accept both nil and non-nil empty slices. A regression from [] to null (or an omitted field, depending on the JSON tags) would therefore pass even though the response shape is wire-visible; keep the length checks but also assert the three JSON slices are non-nil or compare them with exact empty values.
			require.Empty(t, v0.DiagnosticEventsJSON)
			require.Empty(t, v0.Events.ContractEventsXDR)
			require.Empty(t, v0.Events.ContractEventsJSON)
			require.Empty(t, v0.Events.TransactionEventsXDR)
			require.Empty(t, v0.Events.TransactionEventsJSON)

Note

Copilot is running an experiment and ran this review at Lite.

@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from 308f805 to ca903c7 Compare September 11, 2026 21:07
Copilot AI review requested due to automatic review settings September 11, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go:385

  • This is not an independent pairing test for the parallel phase: diffLCM records TxProcessing in the classic,a,b,c,d order, and the phase override below traverses those same envelopes in that order. A regression that associates parallel-phase metadata positionally instead of by transaction hash would therefore still pass this corpus. Build the phase's TxSet order independently from the processing order (while keeping hashes valid), or add a case with a deliberately different valid order so this new parallel-phase path actually exercises the pairing invariant.
	lcm.V2.TxSet.V1TxSet.Phases = []xdr.TransactionPhase{
		diffClassicPhase(diffTxSetEnvelopes(classic)),
		{V: 1, ParallelTxsComponent: &xdr.ParallelTxsComponent{
			ExecutionStages: []xdr.ParallelTxExecutionStage{
				{xdr.DependentTxCluster{a.envelope}},

Note

Copilot is running an experiment and ran this review at Lite.

Comment thread cmd/stellar-rpc/internal/methods/get_transactions.go

@tamirms tamirms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like there are some lint failures? but apart from that everything looks good!

cjonas9 and others added 10 commits September 14, 2026 11:49
Byte-compares the view-walk getTransactions page loop against a test-local
copy of the pre-view decode path over a corpus sweeping LCM/meta versions,
envelope and event shapes, page boundaries and cursor round-trips.

Split out of #962; the suite is @tamirms's work from
tamirms/gettransactions-view-walk.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 14, 2026 15:49
@cjonas9
cjonas9 force-pushed the add-differential-test-suite branch from 302516d to 66feea2 Compare September 14, 2026 15:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

cmd/stellar-rpc/internal/methods/get_transactions_differential_test.go:254

  • transactionsCorpus spans about 110 lines, exceeding the repository's funlen limit of 100 lines (.golangci.yml:77-79). Test files are not exempt, and the neighboring long test uses an explicit targeted suppression, so this new function will fail lint; either split the corpus inventory or add a narrowly justified //nolint:funlen.
func transactionsCorpus(t *testing.T) []xdr.LedgerCloseMeta {

Note

Copilot is running an experiment and ran this review at Lite.

Copilot AI review requested due to automatic review settings September 14, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

cmd/stellar-rpc/internal/methods/get_transactions.go:137

  • This new zero-limit path is not covered by the differential and its frozen reference is not equivalent for a valid v1 configuration: rpcv1/config/options.go:358-370 permits default-transactions-limit=0, while initializePagination leaves that default at zero when no positive request limit is supplied. The production branch returns an empty page here, but legacyProcessTransactionsInLedger appends the first transaction before checking len(*txns) >= limitInt; add a zero-default case with a matching reference guard, or reject zero in config, so this behavior is pinned instead of producing a false divergence.
	remaining := limitInt - len(*txns)
	if remaining <= 0 {
		cursor.TransactionOrder = int32(startTxIdx - 1)

Note

Copilot is running an experiment and ran this review at Lite.

@cjonas9
cjonas9 merged commit e545edd into feature/full-history Sep 14, 2026
18 of 22 checks passed
@cjonas9
cjonas9 deleted the add-differential-test-suite branch September 14, 2026 17:46
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.

Adopt XDR views: add differential test suites for ensuring byte-equal JSON responses

3 participants