diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index af1734961..b1eb29546 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -90,7 +90,7 @@ jobs: env: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.7.1-1204.871accefc.focal~soroban + PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.8.1-1238.903afe5e1.focal~soroban runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 diff --git a/cmd/soroban-rpc/internal/methods/get_events_test.go b/cmd/soroban-rpc/internal/methods/get_events_test.go index 21bac97f9..00898c5ba 100644 --- a/cmd/soroban-rpc/internal/methods/get_events_test.go +++ b/cmd/soroban-rpc/internal/methods/get_events_test.go @@ -22,10 +22,10 @@ func TestTopicFilterMatches(t *testing.T) { Type: xdr.ScValTypeScvSymbol, Sym: &transferSym, } - sixtyfour := xdr.Int64(64) + sixtyfour := xdr.Uint64(64) number := xdr.ScVal{ - Type: xdr.ScValTypeScvU63, - U63: &sixtyfour, + Type: xdr.ScValTypeScvU64, + U64: &sixtyfour, } star := "*" for _, tc := range []struct { @@ -191,8 +191,8 @@ func TestTopicFilterJSON(t *testing.T) { assert.NoError(t, json.Unmarshal([]byte("[\"*\"]"), &got)) assert.Equal(t, TopicFilter{{wildcard: &star}}, got) - sixtyfour := xdr.Int64(64) - scval := xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &sixtyfour} + sixtyfour := xdr.Uint64(64) + scval := xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &sixtyfour} scvalstr, err := xdr.MarshalBase64(scval) assert.NoError(t, err) assert.NoError(t, json.Unmarshal([]byte(fmt.Sprintf("[%q]", scvalstr)), &got)) @@ -514,7 +514,7 @@ func TestGetEvents(t *testing.T) { var txMeta []xdr.TransactionMeta contractID := xdr.Hash([32]byte{}) for i := 0; i < 10; i++ { - number := xdr.Int64(i) + number := xdr.Uint64(i) txMeta = append(txMeta, transactionMetaWithEvents( []xdr.ContractEvent{ // Generate a unique topic like /counter/4 for each event so we can check @@ -522,16 +522,16 @@ func TestGetEvents(t *testing.T) { contractID, xdr.ScVec{ xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }, )) } assert.NoError(t, store.IngestEvents(ledgerCloseMetaWithEvents(1, now.Unix(), txMeta...))) - number := xdr.Int64(4) + number := xdr.Uint64(4) handler := eventsRPCHandler{ scanner: store, maxLimit: 10000, @@ -543,7 +543,7 @@ func TestGetEvents(t *testing.T) { {Topics: []TopicFilter{ []SegmentFilter{ {scval: &xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}}, - {scval: &xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}}, + {scval: &xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}}, }, }}, }, @@ -553,8 +553,8 @@ func TestGetEvents(t *testing.T) { id := events.Cursor{Ledger: 1, Tx: 5, Op: 0, Event: 0}.String() assert.NoError(t, err) value, err := xdr.MarshalBase64(xdr.ScVal{ - Type: xdr.ScValTypeScvU63, - U63: &number, + Type: xdr.ScValTypeScvU64, + U64: &number, }) assert.NoError(t, err) expected := []EventInfo{ @@ -576,7 +576,7 @@ func TestGetEvents(t *testing.T) { store := events.NewMemoryStore("unit-tests", 100) contractID := xdr.Hash([32]byte{}) otherContractID := xdr.Hash([32]byte{1}) - number := xdr.Int64(1) + number := xdr.Uint64(1) txMeta := []xdr.TransactionMeta{ // This matches neither the contract id nor the topic transactionMetaWithEvents([]xdr.ContractEvent{ @@ -585,7 +585,7 @@ func TestGetEvents(t *testing.T) { xdr.ScVec{ xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }), // This matches the contract id but not the topic @@ -595,7 +595,7 @@ func TestGetEvents(t *testing.T) { xdr.ScVec{ xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }), // This matches the topic but not the contract id @@ -604,9 +604,9 @@ func TestGetEvents(t *testing.T) { otherContractID, xdr.ScVec{ xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }), // This matches both the contract id and the topic @@ -615,9 +615,9 @@ func TestGetEvents(t *testing.T) { contractID, xdr.ScVec{ xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }), } @@ -636,7 +636,7 @@ func TestGetEvents(t *testing.T) { Topics: []TopicFilter{ []SegmentFilter{ {scval: &xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &counter}}, - {scval: &xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}}, + {scval: &xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}}, }, }, }, @@ -646,8 +646,8 @@ func TestGetEvents(t *testing.T) { id := events.Cursor{Ledger: 1, Tx: 4, Op: 0, Event: 0}.String() value, err := xdr.MarshalBase64(xdr.ScVal{ - Type: xdr.ScValTypeScvU63, - U63: &number, + Type: xdr.ScValTypeScvU64, + U64: &number, }) assert.NoError(t, err) expected := []EventInfo{ @@ -722,15 +722,15 @@ func TestGetEvents(t *testing.T) { contractID := xdr.Hash([32]byte{}) var txMeta []xdr.TransactionMeta for i := 0; i < 180; i++ { - number := xdr.Int64(i) + number := xdr.Uint64(i) txMeta = append(txMeta, transactionMetaWithEvents( []xdr.ContractEvent{ contractEvent( contractID, xdr.ScVec{ - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, }, - xdr.ScVal{Type: xdr.ScValTypeScvU63, U63: &number}, + xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &number}, ), }, )) diff --git a/cmd/soroban-rpc/internal/test/docker-compose.yml b/cmd/soroban-rpc/internal/test/docker-compose.yml index f6a9a9622..3bc8171fa 100644 --- a/cmd/soroban-rpc/internal/test/docker-compose.yml +++ b/cmd/soroban-rpc/internal/test/docker-compose.yml @@ -15,7 +15,7 @@ services: # Note: Please keep the image pinned to an immutable tag matching the Captive Core version. # This avoid implicit updates which break compatibility between # the Core container and captive core. - image: ${CORE_IMAGE:-2opremio/stellar-core:19.7.1-1178.e352f0012.focal-soroban} + image: ${CORE_IMAGE:-2opremio/stellar-core:19.8.1-1238.903afe5e1.focal-soroban} depends_on: - core-postgres restart: on-failure diff --git a/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go b/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go index 606a1b54e..40e0a07a0 100644 --- a/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go +++ b/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go @@ -31,7 +31,9 @@ func TestGetLedgerEntryNotFound(t *testing.T) { Type: xdr.LedgerEntryTypeContractData, ContractData: &xdr.LedgerKeyContractData{ ContractId: contractID, - Key: getContractCodeLedgerKey(), + Key: xdr.ScVal{ + Type: xdr.ScValTypeScvLedgerKeyContractExecutable, + }, }, }) require.NoError(t, err) diff --git a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go index 5943e13fd..30c6a0030 100644 --- a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go @@ -37,16 +37,12 @@ func getHelloWorldContract(t *testing.T) []byte { } func createInvokeHostOperation(sourceAccount string, footprint xdr.LedgerFootprint, contractID xdr.Hash, method string, args ...xdr.ScVal) *txnbuild.InvokeHostFunction { - var contractIDBytes []byte = contractID[:] - contractIDObj := &xdr.ScObject{ - Type: xdr.ScObjectTypeScoBytes, - Bin: &contractIDBytes, - } + var contractIDBytes = xdr.ScBytes(contractID[:]) methodSymbol := xdr.ScSymbol(method) parameters := xdr.ScVec{ xdr.ScVal{ - Type: xdr.ScValTypeScvObject, - Obj: &contractIDObj, + Type: xdr.ScValTypeScvBytes, + Bytes: &contractIDBytes, }, xdr.ScVal{ Type: xdr.ScValTypeScvSymbol, @@ -108,7 +104,9 @@ func createCreateContractOperation(t *testing.T, sourceAccount string, contractC Type: xdr.LedgerEntryTypeContractData, ContractData: &xdr.LedgerKeyContractData{ ContractId: xdr.Hash(getContractID(t, sourceAccount, testSalt, networkPassphrase)), - Key: getContractCodeLedgerKey(), + Key: xdr.ScVal{ + Type: xdr.ScValTypeScvLedgerKeyContractExecutable, + }, }, }, }, @@ -136,8 +134,8 @@ func createCreateContractOperation(t *testing.T, sourceAccount string, contractC Type: xdr.ContractIdTypeContractIdFromSourceAccount, Salt: &saltParam, }, - Source: xdr.ScContractCode{ - Type: xdr.ScContractCodeTypeSccontractCodeWasmRef, + Source: xdr.ScContractExecutable{ + Type: xdr.ScContractExecutableTypeSccontractExecutableWasmRef, WasmId: &contractHash, }, }, @@ -146,15 +144,6 @@ func createCreateContractOperation(t *testing.T, sourceAccount string, contractC } } -func getContractCodeLedgerKey() xdr.ScVal { - ledgerKeyContractCodeAddr := xdr.ScStaticScsLedgerKeyContractCode - contractCodeLedgerKey := xdr.ScVal{ - Type: xdr.ScValTypeScvStatic, - Ic: &ledgerKeyContractCodeAddr, - } - return contractCodeLedgerKey -} - func getContractID(t *testing.T, sourceAccount string, salt [32]byte, networkPassphrase string) [32]byte { networkID := xdr.Hash(sha256.Sum256([]byte(networkPassphrase))) preImage := xdr.HashIdPreimage{ @@ -341,13 +330,6 @@ func TestSimulateInvokeContractTransactionSucceeds(t *testing.T) { }) assert.NoError(t, err) sendSuccessfulTransaction(t, client, sourceAccount, tx) - addressObject := &xdr.ScObject{ - Type: xdr.ScObjectTypeScoAddress, - Address: &xdr.ScAddress{ - Type: xdr.ScAddressTypeScAddressTypeAccount, - AccountId: &authAccountIDArg, - }, - } tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &account, IncrementSequenceNum: true, @@ -358,8 +340,11 @@ func TestSimulateInvokeContractTransactionSucceeds(t *testing.T) { contractID, "auth", xdr.ScVal{ - Type: xdr.ScValTypeScvObject, - Obj: &addressObject, + Type: xdr.ScValTypeScvAddress, + Address: &xdr.ScAddress{ + Type: xdr.ScAddressTypeScAddressTypeAccount, + AccountId: &authAccountIDArg, + }, }, xdr.ScVal{ Type: xdr.ScValTypeScvSymbol, @@ -387,11 +372,10 @@ func TestSimulateInvokeContractTransactionSucceeds(t *testing.T) { var obtainedResult xdr.ScVal err = xdr.SafeUnmarshalBase64(response.Results[0].XDR, &obtainedResult) assert.NoError(t, err) - assert.Equal(t, xdr.ScValTypeScvObject, obtainedResult.Type) - obj := *obtainedResult.Obj - assert.Equal(t, xdr.ScObjectTypeScoVec, obj.Type) - assert.Len(t, *obj.Vec, 2) - world := (*obj.Vec)[1] + assert.Equal(t, xdr.ScValTypeScvVec, obtainedResult.Type) + assert.NotNil(t, *obtainedResult.Vec) + assert.Len(t, **obtainedResult.Vec, 2) + world := (**obtainedResult.Vec)[1] assert.Equal(t, xdr.ScValTypeScvSymbol, world.Type) assert.Equal(t, xdr.ScSymbol("world"), *world.Sym) @@ -407,8 +391,7 @@ func TestSimulateInvokeContractTransactionSucceeds(t *testing.T) { ro1 := obtainedFootprint.ReadOnly[1] assert.Equal(t, xdr.LedgerEntryTypeContractData, ro1.Type) assert.Equal(t, xdr.Hash(contractID), ro1.ContractData.ContractId) - assert.Equal(t, xdr.ScValTypeScvStatic, ro1.ContractData.Key.Type) - assert.Equal(t, xdr.ScStaticScsLedgerKeyContractCode, *ro1.ContractData.Key.Ic) + assert.Equal(t, xdr.ScValTypeScvLedgerKeyContractExecutable, ro1.ContractData.Key.Type) ro2 := obtainedFootprint.ReadOnly[2] assert.Equal(t, xdr.LedgerEntryTypeContractCode, ro2.Type) installContractCodeArgs, err := xdr.InstallContractCodeArgs{Code: helloWorldContract}.MarshalBinary() diff --git a/cmd/soroban-rpc/internal/test/transaction_test.go b/cmd/soroban-rpc/internal/test/transaction_test.go index 44f8f2119..467677f96 100644 --- a/cmd/soroban-rpc/internal/test/transaction_test.go +++ b/cmd/soroban-rpc/internal/test/transaction_test.go @@ -80,8 +80,8 @@ func TestSendTransactionSucceedsWithResults(t *testing.T) { resultVal := *invokeHostFunctionResult.Success expectedContractID, err := hex.DecodeString("ea9fcb81ae54a29f6b3bf293847d3fd7e9a369fd1c80acafec6abd571317e0c2") assert.NoError(t, err) - expectedObj := &xdr.ScObject{Type: xdr.ScObjectTypeScoBytes, Bin: &expectedContractID} - expectedScVal := xdr.ScVal{Type: xdr.ScValTypeScvObject, Obj: &expectedObj} + contractIDBytes := xdr.ScBytes(expectedContractID) + expectedScVal := xdr.ScVal{Type: xdr.ScValTypeScvBytes, Bytes: &contractIDBytes} assert.True(t, expectedScVal.Equals(resultVal)) expectedResult := xdr.TransactionResult{ diff --git a/go.mod b/go.mod index 93ea4e91f..ba435e2ca 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/sirupsen/logrus v1.4.1 github.com/spf13/cobra v0.0.0-20160830174925-9c28e4bbd74e github.com/spf13/viper v0.0.0-20150621231900-db7ff930a189 - github.com/stellar/go v0.0.0-20230307175517-b2d1e113c534 + github.com/stellar/go v0.0.0-20230320165241-a5f3278b8282 github.com/stretchr/testify v1.8.0 golang.org/x/mod v0.6.0 ) diff --git a/go.sum b/go.sum index afaf98c79..da919561c 100644 --- a/go.sum +++ b/go.sum @@ -167,8 +167,8 @@ github.com/spf13/pflag v0.0.0-20161005214240-4bd69631f475 h1:RtZIgreTwcayPTOw7G5 github.com/spf13/pflag v0.0.0-20161005214240-4bd69631f475/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v0.0.0-20150621231900-db7ff930a189 h1:fvB1AFbBd6SfI9Rd0ooAJp8uLkZDbZaLFHi7ZnNP6uI= github.com/spf13/viper v0.0.0-20150621231900-db7ff930a189/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= -github.com/stellar/go v0.0.0-20230307175517-b2d1e113c534 h1:ecxXXWGTHRY765WueJi8QCN21Ckxb0XNIRDbNbZ5TG4= -github.com/stellar/go v0.0.0-20230307175517-b2d1e113c534/go.mod h1:QXwuKmYVvqQZlByv0EeNb0Rgog9AP+eMmARcdt3h2rI= +github.com/stellar/go v0.0.0-20230320165241-a5f3278b8282 h1:Lijy4+s8ZwC6omEHHI4zThxxqKkQ0q1JyUn0WLfKFgI= +github.com/stellar/go v0.0.0-20230320165241-a5f3278b8282/go.mod h1:QXwuKmYVvqQZlByv0EeNb0Rgog9AP+eMmARcdt3h2rI= github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee h1:fbVs0xmXpBvVS4GBeiRmAE3Le70ofAqFMch1GTiq/e8= github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=