Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,12 @@ func (i *Test) waitForRPC() {
if i.daemon != nil {
exited = i.daemon.exited()
}
// Core builds its Soroban transaction queue only when a ledger closes
// through consensus, not during catch-up. The limits upgrade is a Soroban
// transaction, so wait for one consensus ledger before setup sends it.
// The load test has no Core; the delayed-daemon mode is behind on purpose.
var caughtUp uint32
needOneMore := i.coreClient != nil && i.delayDaemonForLedgerN == 0
for {
select {
case err := <-exited:
Expand All @@ -603,8 +609,18 @@ func (i *Test) waitForRPC() {
}
result, err := i.GetRPCLient().GetHealth(i.t.Context())
i.t.Logf("getHealth: %+v; err: %v", result, err)
if err == nil && result.Status == "healthy" && i.caughtUpWithCore(result.LatestLedger) {
return
if err == nil && result.Status == "healthy" {
switch {
case caughtUp != 0:
if result.LatestLedger > caughtUp {
return
}
case i.caughtUpWithCore(result.LatestLedger):
if !needOneMore {
return
}
caughtUp = result.LatestLedger
}
}
require.False(i.t, time.Now().After(deadline), "RPC never got healthy: %+v", err)
time.Sleep(time.Second)
Expand Down Expand Up @@ -973,6 +989,15 @@ func (i *Test) CreateHelloWorldContract() (protocol.GetTransactionResponse, [32]
return i.PreflightAndSendMasterOperation(op), contractID, contractHash
}

func (i *Test) CreateEventsContract() (protocol.GetTransactionResponse, [32]byte, xdr.Hash) {
_, contractHash := i.uploadContract(GetEventsContract())
salt := xdr.Uint256(testSalt)
account := i.MasterAccount().GetAccountID()
op := createCreateContractV2Operation(account, salt, contractHash)
contractID := GetContractID(i.t, account, salt, StandaloneNetworkPassphrase)
return i.PreflightAndSendMasterOperation(op), contractID, contractHash
}

func (i *Test) CreateAutorestoreContract(items int) (protocol.GetTransactionResponse, [32]byte, xdr.Hash) {
contractBinary := GetAutorestoreContract()
_, contractHash := i.uploadContract(contractBinary)
Expand Down Expand Up @@ -1058,6 +1083,7 @@ func (i *Test) upgradeLimitsWithFile(limitFile, expectInSorobanInfo string) {
txnCount := len(lines) / 2 // each upgrade command outputs txnB64 \n hash
assert.Len(i.t, lines, 9)

var lastLedger uint32
for j := 0; j+1 < len(lines); j += 2 {
b64 := lines[j]
i.t.Logf("Upgrade transaction: %s (hash: %s)", b64, lines[j+1])
Expand All @@ -1068,9 +1094,14 @@ func (i *Test) upgradeLimitsWithFile(limitFile, expectInSorobanInfo string) {
txn, t := gtxn.Transaction()
require.True(i.t, t)

SendSuccessfulTransaction(i.t, i.rpcClient, nil /* signed @ L791 */, txn)
lastLedger = SendSuccessfulTransaction(i.t, i.rpcClient, nil /* signed @ L791 */, txn).Ledger
}

// The daemon reported the ledger from its captive core. The upgrade key
// below is resolved by the Core container against its own last closed
// ledger, which can still be behind under load.
i.waitForCoreAtLedger(int(lastLedger))

upgradeKey := strings.TrimSpace(lines[len(lines)-1])
i.t.Logf("Upgrading Core config with key: %s", upgradeKey)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestEventFilterFields(t *testing.T) {
func TestEventFilterJSONFormat(t *testing.T) {
_, transfer := symbolScVal(t, "transfer")

t.Run("with a topic is rejected until #940", func(t *testing.T) {
t.Run("with a topic is rejected", func(t *testing.T) {
in := protocol.EventFilterV2{Topic0: requestTopic(t, transfer)}
_, err := eventFilter(&in, protocol.FormatJSON)
require.ErrorIs(t, err, errJSONInputFormatUnsupported)
Expand Down
6 changes: 3 additions & 3 deletions cmd/stellar-rpc/internal/rpcv2/eventsapi/get_events_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ func jrpcError(message string, data any) error {
return &jrpc2.Error{Code: jrpc2.InvalidParams, Message: message, Data: encoded}
}

// errJSONInputFormatUnsupported: xdrInputFormat "json" needs a JSON-to-XDR
// converter, because the term index matches on a topic's canonical bytes.
// Deferred to #940.
// errJSONInputFormatUnsupported: xdrInputFormat "json" is a spec option this
// server does not serve. The term index matches on a topic's canonical XDR
// bytes; xdr2json can produce them, but the handler is not wired to it.
var errJSONInputFormatUnsupported = errors.New(
"xdrInputFormat \"json\" is not supported yet")

Expand Down
Loading
Loading