diff --git a/.golangci.yml b/.golangci.yml index d5155295d..1b2b2f03d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -39,6 +39,11 @@ linters: funlen: lines: 100 statements: 50 + gomoddirectives: + # Temporary pin of the CAP-71 (protocol 27) Go XDR build; remove once + # go-stellar-sdk#5945 is released and the replace directive is dropped. + replace-allow-list: + - github.com/stellar/go-stellar-sdk misspell: locale: US testifylint: diff --git a/cmd/stellar-rpc/internal/rpcdatastore/ledger_reader_test.go b/cmd/stellar-rpc/internal/rpcdatastore/ledger_reader_test.go index 3cf965de7..aaf86c6ee 100644 --- a/cmd/stellar-rpc/internal/rpcdatastore/ledger_reader_test.go +++ b/cmd/stellar-rpc/internal/rpcdatastore/ledger_reader_test.go @@ -28,6 +28,14 @@ func (m *mockLedgerBackend) GetLedger(ctx context.Context, seq uint32) (xdr.Ledg return args.Get(0).(xdr.LedgerCloseMeta), args.Error(1) //nolint:forcetypeassert } +func (m *mockLedgerBackend) GetLedgerRaw(ctx context.Context, seq uint32) ([]byte, error) { + args := m.Called(ctx, seq) + if v := args.Get(0); v != nil { + return v.([]byte), args.Error(1) //nolint:forcetypeassert + } + return nil, args.Error(1) +} + func (m *mockLedgerBackend) PrepareRange(ctx context.Context, r ledgerbackend.Range) error { args := m.Called(ctx, r) return args.Error(0) diff --git a/go.mod b/go.mod index 95a03caba..cf09be49e 100644 --- a/go.mod +++ b/go.mod @@ -117,7 +117,7 @@ require ( github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/viper v1.17.0 // indirect - github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf // indirect + github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364 // indirect github.com/stretchr/objx v0.5.3 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.opencensus.io v0.24.0 // indirect @@ -148,3 +148,5 @@ require ( gopkg.in/tylerb/graceful.v1 v1.2.15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/stellar/go-stellar-sdk => github.com/sisuresh/go v0.0.0-20260603235145-a8d5b3066361 diff --git a/go.sum b/go.sum index 277c5e06d..1b5590a18 100644 --- a/go.sum +++ b/go.sum @@ -415,6 +415,8 @@ github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sisuresh/go v0.0.0-20260603235145-a8d5b3066361 h1:bxhnsDgD58Q8H/smlFqBN6dpYiDA/f1X3kWOTRBEM5c= +github.com/sisuresh/go v0.0.0-20260603235145-a8d5b3066361/go.mod h1:IkcqcrE9UQi7n/1y+MxKB+7qzdjG1T2kGOD7Ss8dqjw= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= @@ -429,10 +431,8 @@ github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= -github.com/stellar/go-stellar-sdk v0.4.0 h1:WBLeJk7EllU7WhwrTH1L5Mu2EhZor/xy5sVi/82JzNQ= -github.com/stellar/go-stellar-sdk v0.4.0/go.mod h1:tLKAQPxa2I5UvGMabBbUXcY3fmgYnfDudrMeK7CDX4w= -github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf h1:GY1RVbX3Hg7poPXEf6yojjP0hyypvgUgZmCqQU9D0xg= -github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= +github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364 h1:gOKrfuWdZ92LFlv0TAwgZ7OsWKeBsOMDlGLyFgduI1w= +github.com/stellar/go-xdr v0.0.0-20260529210834-0bf8f4956364/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/scripts/check-dependencies.bash b/scripts/check-dependencies.bash index 83c93180e..a7ef5521a 100755 --- a/scripts/check-dependencies.bash +++ b/scripts/check-dependencies.bash @@ -82,10 +82,12 @@ done # Now, lets compare the Rust and Go XDR revisions # TODO: The sed extraction below won't work for version tags -GO_XDR_REVISION=$(go list -m -f '{{.Version}}' github.com/stellar/go-stellar-sdk | $SED 's/.*-\(.*\)/\1/') +# Honor a `replace` directive for the Go SDK (e.g. a fork carrying unreleased XDR). +GO_SDK_REPO=$(go list -m -f '{{if .Replace}}{{.Replace.Path}}{{else}}{{.Path}}{{end}}' github.com/stellar/go-stellar-sdk) +GO_XDR_REVISION=$(go list -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' github.com/stellar/go-stellar-sdk | $SED 's/.*-\(.*\)/\1/') # revision of https://github.com/stellar/stellar-xdr/ used by the Go code -STELLAR_XDR_REVISION_FROM_GO=$($CURL https://raw.githubusercontent.com/stellar/go-stellar-sdk/${GO_XDR_REVISION}/xdr/xdr_commit_generated.txt) +STELLAR_XDR_REVISION_FROM_GO=$($CURL https://raw.githubusercontent.com/${GO_SDK_REPO#github.com/}/${GO_XDR_REVISION}/xdr/xdr_commit_generated.txt) if [ "$STELLAR_XDR_REVISION_FROM_GO" != "$STELLAR_XDR_REVISION_FROM_RUST" ]; then echo "Go and Rust dependencies are using different revisions of https://github.com/stellar/stellar-xdr"