Add getTransactions differential test suite - #976
Conversation
b37ba5b to
3db4efa
Compare
There was a problem hiding this comment.
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.
812b325 to
7a25651
Compare
6255be5 to
c61526d
Compare
c61526d to
3d1b739
Compare
There was a problem hiding this comment.
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 todiffLCM, 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=jsoncases, theseEmptyassertions accept both nil and non-nil empty slices. A regression from[]tonull(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.
308f805 to
ca903c7
Compare
There was a problem hiding this comment.
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:
diffLCMrecordsTxProcessingin theclassic,a,b,c,dorder, 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.
tamirms
left a comment
There was a problem hiding this comment.
looks like there are some lint failures? but apart from that everything looks good!
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>
302516d to
66feea2
Compare
There was a problem hiding this comment.
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
transactionsCorpusspans about 110 lines, exceeding the repository'sfunlenlimit 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.
There was a problem hiding this comment.
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-370permitsdefault-transactions-limit=0, whileinitializePaginationleaves that default at zero when no positive request limit is supplied. The production branch returns an empty page here, butlegacyProcessTransactionsInLedgerappends the first transaction before checkinglen(*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.
What
This PR adds the
getTransactionsdifferential suite out of #962 into its own PR, stacked on the branchgetTxByHash-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.goreconstructs the pre-view decode path test-locally and asserts that it and the view-walk page loop produce byte-identicalGetTransactionsResponseJSON over a corpus that sweeps LCM V0/V1/V2,TransactionMetaV1/V2/V3/V4,classic/Soroban/fee-bumpenvelopes, event shapes, empty ledgers, page boundaries and cursor round-trips (~400 subtests).differential_test.goholds 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 upcominggetEventsdifferential 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-historyonce #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