Skip to content

findpaths: simplify simplepath/order_book.go and fix order_book_test.go - #503

Merged
nikhilsaraf merged 1 commit into
stellar:masterfrom
nikhilsaraf:findpaths
Jun 11, 2018
Merged

findpaths: simplify simplepath/order_book.go and fix order_book_test.go#503
nikhilsaraf merged 1 commit into
stellar:masterfrom
nikhilsaraf:findpaths

Conversation

@nikhilsaraf

Copy link
Copy Markdown
Contributor

order_book.go was very confusing as it was not very clear as to what it did.

That orderbook struct is essentially a one-way orderbook that is selling an asset to you. I've updated the struct and functions to represent that --it's also the only way we use it in production.
The test was not testing that codepath, now it does.

The name for the function has changed from Cost to CostToConsumeLiquidity along with clear explanations of what it does. The tests have also been updated to use the case based approach with subtests.

@tomerweller tomerweller 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.

LGTM

@nikhilsaraf
nikhilsaraf merged commit 2289b70 into stellar:master Jun 11, 2018
sisuresh added a commit to sisuresh/go that referenced this pull request May 27, 2026
Bump XDR to stellar-xdr@5187e69 (CAP-0071 address-bound/delegated Soroban
credentials + CAP-0083 STELLAR_VALUE_EMPTY_TX_SET). goxdr and Ruby xdrgen
cannot parse #ifdef, so CAP_0071/CAP_0083 gates are resolved with
`stellar-xdr xfile preprocess` (rs-stellar-xdr stellar#503) before codegen,
driven by XDR_FEATURES. Regenerated xdr/ + gxdr/.
sisuresh added a commit to sisuresh/go that referenced this pull request May 28, 2026
Bump XDR to stellar-xdr@5187e69 (CAP-0071 address-bound/delegated Soroban
credentials + CAP-0083 STELLAR_VALUE_EMPTY_TX_SET). goxdr and Ruby xdrgen
cannot parse #ifdef, so CAP_0071/CAP_0083 gates are resolved with
'stellar-xdr xfile preprocess' (rs-stellar-xdr stellar#503) before codegen, driven
by XDR_FEATURES. Regenerated xdr/, gxdr/, and xdr/xdr_views_generated.go.
Shaptic pushed a commit that referenced this pull request Jun 5, 2026
* xdr: regenerate for Protocol 27 CAP-0071 + CAP-0083

Bump XDR to stellar-xdr@5187e69 (CAP-0071 address-bound/delegated Soroban
credentials + CAP-0083 STELLAR_VALUE_EMPTY_TX_SET). goxdr and Ruby xdrgen
cannot parse #ifdef, so CAP_0071/CAP_0083 gates are resolved with
'stellar-xdr xfile preprocess' (rs-stellar-xdr #503) before codegen, driven
by XDR_FEATURES. Regenerated xdr/, gxdr/, and xdr/xdr_views_generated.go.

* xdr: drop CAP-0083 from regen; only CAP-0071 ships in p27

- Bump XDR_COMMIT to stellar-xdr@68fa1ac (post-#303 which ungated CAP-0071).
- Clear XDR_FEATURES default so CAP-0083 #ifdef blocks are stripped during
  preprocess. CAP-0071 is ungated and needs no feature flag.
- Regenerate gxdr/, xdr/xdr_generated.go, xdr/xdr_views_generated.go.
- randxdr: add IsDeepNestedDelegates preset to cap recursion through CAP-71
  SorobanDelegateSignature.nestedDelegates, mirroring the existing
  IsDeepAuthorizedInvocationTree handling for subInvocations. Without it
  TestView_RandXDR_RawRoundTrip stack-overflows on unbounded random trees.

* go.mod: bump go-xdr to 0bf8f49 (raise DecodeDefaultMaxDepth to 1500)

Pulls in stellar/go-xdr#32 which lifts the default XDR decode depth from
250 → 1500 and adds the DecodeUnlimitedDepth sentinel. Necessary so the
CAP-71 SorobanDelegateSignature delegate chain (which the protocol allows
to nest arbitrarily, with only Soroban's runtime trap policing depth) can
be decoded by stellar-core LCM consumers without stalling.

* go.sum: drop stale go-xdr@a87d4d0 entry (go mod tidy)

The previous commit bumped go-xdr to 0bf8f49 in go.mod, but go.sum still
carried the old a87d4d0789c3 lines. CI's gomod.sh runs `go mod tidy` and
fails the build on the residual diff.

* ci: bump go-test timeout to 20m

The default per-test-binary timeout is 10m, which is borderline for
this repo's race-cover suite (xdr/ alone takes ~230s with -race
locally, longer on slower CI runners). CAP-71's added generated
XDR pushed the run past 10m, killing the test job with SIGTERM
before xdr/ and txnbuild/ finished.

20m gives generous headroom and matches the conservative timeout
other Stellar Go repos use for race+cover runs.

* txnbuild: cap CAP-71 nestedDelegates recursion in TestOperationCoverage

TestOperationCoverage generates 10,000 random gxdr.Operation values
which now include InvokeHostFunctionOp.auth[].credentials carrying
the new SorobanAddressCredentialsWithDelegates with the recursive
nestedDelegates field. Without bounding, the random generator
recurses unboundedly through SorobanDelegateSignature.nestedDelegates
and the test hangs past go test's default 10-minute per-binary
timeout, killing the CI test matrix.

Add IsDeepNestedDelegates preset (already defined in
randxdr/presets.go for LedgerCloseMetaPresets) — caps the tree height
at 2. With the preset, the test runs in ~8s under -race instead of
timing out.

Pairs with the -timeout=20m bump on the test workflow (which is now
just headroom — the real fix is this preset).
@Shaptic Shaptic mentioned this pull request Jun 8, 2026
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.

2 participants