Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c949330
p23 integration
urvisavla Jun 5, 2025
a867c0a
Add protocol 23 integration test
urvisavla Jun 7, 2025
fd6307c
Fix test
urvisavla Jun 7, 2025
7b05ceb
limit workflows
urvisavla Jun 7, 2025
022ca37
disable generate ledgers test
urvisavla Jun 7, 2025
d74dd2d
disable loadtest
urvisavla Jun 7, 2025
2c0d631
fix soroban test failures
urvisavla Jun 7, 2025
955b1b5
disable p23 tests
urvisavla Jun 8, 2025
bb6f72c
disable restoration test
urvisavla Jun 9, 2025
1010ca3
enable restoration test
urvisavla Jun 9, 2025
30781af
use previous version of core
urvisavla Jun 9, 2025
cea920e
enable all tests
urvisavla Jun 9, 2025
3f72755
update core version to 22.3.1-2509
urvisavla Jun 9, 2025
96fa2b1
add 23 in test matrix
urvisavla Jun 9, 2025
902f511
disable upgrade limits for p23
urvisavla Jun 9, 2025
df8e1d7
disable load tests
urvisavla Jun 9, 2025
c023e76
fix soroban upgrade settings issue. enable load test.
urvisavla Jun 10, 2025
4a83ea9
Fix SAC mint tests per new events schema. disable expiration tests.
urvisavla Jun 10, 2025
31d8466
disable load test
urvisavla Jun 10, 2025
0a9c7c7
disble failing tests
urvisavla Jun 10, 2025
8bedf1a
Fix load tests for p23
urvisavla Jun 10, 2025
6781fac
Fix TestP20MetaTransaction test
urvisavla Jun 10, 2025
fdc8c72
more fixes
urvisavla Jun 10, 2025
87a86a9
update test matrix
urvisavla Jun 10, 2025
0ada718
enable expiration tests
urvisavla Jun 10, 2025
a728e86
disable expiration test
urvisavla Jun 10, 2025
5c8b71c
disable certain workflows
urvisavla Jun 11, 2025
b53fd8b
enable all workflows
urvisavla Jun 11, 2025
ac3833f
update comment
urvisavla Jun 11, 2025
437ce26
Bump rpc version
urvisavla Jun 11, 2025
54ba264
addressing review comments
urvisavla Jun 11, 2025
6a196ae
Try bumping linter version
urvisavla Jun 11, 2025
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
11 changes: 7 additions & 4 deletions .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os: [ubuntu-22.04]
go: ["1.22", "1.23"]
pg: [12, 16]
protocol-version: [22]
protocol-version: [22,23]
runs-on: ${{ matrix.os }}
services:
postgres:
Expand All @@ -32,9 +32,12 @@ jobs:
env:
HORIZON_INTEGRATION_TESTS_ENABLED: true
HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 23.0.0.1-2488.23.0.0rc.1.472e3e69d.focal
PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:23.0.0.1-2488.23.0.0rc.1.472e3e69d.focal
PROTOCOL_22_STELLAR_RPC_DOCKER_IMG: stellar/stellar-rpc:22.1.2
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.3.1-2509.c2e465a3e.focal~do~not~use~in~prd
PROTOCOL_22_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:22.3.1-2509.c2e465a3e.focal-do-not-use-in-prd
PROTOCOL_22_STELLAR_RPC_DOCKER_IMG: stellar/stellar-rpc:23.0.0-rc0-115
PROTOCOL_23_CORE_DEBIAN_PKG_VERSION: 22.3.1-2509.c2e465a3e.focal~do~not~use~in~prd
PROTOCOL_23_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:22.3.1-2509.c2e465a3e.focal-do-not-use-in-prd
PROTOCOL_23_STELLAR_RPC_DOCKER_IMG: stellar/stellar-rpc:23.0.0-rc0-115
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
const (
// MaxSupportedProtocolVersion defines the maximum supported version of
// the Stellar protocol.
MaxSupportedProtocolVersion uint32 = 22
MaxSupportedProtocolVersion uint32 = 23

// CurrentVersion reflects the latest version of the ingestion
// algorithm. This value is stored in KV store and is used to decide
Expand Down
19 changes: 17 additions & 2 deletions services/horizon/internal/integration/generate_ledgers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ type sorobanTransaction struct {
}

func TestGenerateLedgers(t *testing.T) {
// TODO: Add support for LedgerCloseMetaV2 to run this test for Protocol 23 and above
if integration.GetCoreMaxSupportedProtocol() > 22 {
t.Skip("This test run does not support greater than Protocol 22")
}

var transactionsPerLedger, ledgers, transfersPerTx int
var output bool
var networkPassphrase string
Expand Down Expand Up @@ -439,8 +444,18 @@ func merge(t *testing.T, networkPassphrase string, ledgers []xdr.LedgerCloseMeta
var curCount int
for _, ledger := range ledgers {
transactionCount := ledger.CountTransactions()
require.Empty(t, ledger.V1.EvictedKeys)
require.Empty(t, ledger.V1.UpgradesProcessing)

switch ledger.V {
Comment thread
urvisavla marked this conversation as resolved.
Outdated
case 1:
require.Empty(t, ledger.V1.EvictedKeys)
require.Empty(t, ledger.V1.UpgradesProcessing)
case 2:
require.Empty(t, ledger.V2.EvictedKeys)
require.Empty(t, ledger.V2.UpgradesProcessing)
default:
t.Fatalf("Invalid ledger meta version: %d", ledger.V)
}

if transactionCount == 0 {
continue
}
Expand Down
5 changes: 5 additions & 0 deletions services/horizon/internal/integration/ingestion_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import (
)

func TestLoadTestLedgerBackend(t *testing.T) {
// TODO: Generate test data using LedgerCloseMetaV2 to run this test for Protocol 23 and above
if integration.GetCoreMaxSupportedProtocol() > 22 {
t.Skip("This test run does not support greater than Protocol 22")
}

itest := integration.NewTest(t, integration.Config{
NetworkPassphrase: loadTestNetworkPassphrase,
})
Expand Down
34 changes: 30 additions & 4 deletions services/horizon/internal/integration/invokehostfunction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,15 @@ func TestContractInvokeHostFunctionCreateConstructorContract(t *testing.T) {
assert.Len(t, invokeHostFunctionOpJson.AssetBalanceChanges, 1)
assetBalanceChange := invokeHostFunctionOpJson.AssetBalanceChanges[0]
assert.Equal(itest.CurrentTest(), assetBalanceChange.Amount, "10.0000000")
assert.Equal(itest.CurrentTest(), assetBalanceChange.From, issuer)
assert.Equal(itest.CurrentTest(), assetBalanceChange.To, strkey.MustEncode(strkey.VersionByteContract, contractID[:]))
assert.Equal(itest.CurrentTest(), assetBalanceChange.Type, "transfer")
if integration.GetCoreMaxSupportedProtocol() < 23 {
assert.Equal(itest.CurrentTest(), assetBalanceChange.From, issuer)
assert.Equal(itest.CurrentTest(), assetBalanceChange.Type, "transfer")
} else {
// see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0067.md#protocol-upgrade-transition
assert.Equal(itest.CurrentTest(), assetBalanceChange.From, "")
assert.Equal(itest.CurrentTest(), assetBalanceChange.Type, "mint")
}
assert.Equal(itest.CurrentTest(), assetBalanceChange.Asset.Code, strings.TrimRight(asset.GetCode(), "\x00"))
assert.Equal(itest.CurrentTest(), assetBalanceChange.Asset.Issuer, asset.GetIssuer())
}
Expand Down Expand Up @@ -362,7 +368,18 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
expectedScVal := xdr.ScVal{Type: xdr.ScValTypeScvU64, U64: &invokeResult}
var transactionMeta xdr.TransactionMeta
assert.NoError(t, xdr.SafeUnmarshalBase64(tx.ResultMetaXdr, &transactionMeta))
assert.True(t, expectedScVal.Equals(transactionMeta.V3.SorobanMeta.ReturnValue))

var returnValue xdr.ScVal
switch transactionMeta.V {
case 3:
returnValue = transactionMeta.MustV3().SorobanMeta.ReturnValue
case 4:
returnValue = *transactionMeta.MustV4().SorobanMeta.ReturnValue
default:
t.Fatalf("Invalid meta version: %d", transactionMeta.V)
}
Comment thread
urvisavla marked this conversation as resolved.
Outdated

assert.True(t, expectedScVal.Equals(returnValue))

clientInvokeOp, err := itest.Client().Operations(horizonclient.OperationRequest{
ForTransaction: tx.Hash,
Expand Down Expand Up @@ -457,7 +474,16 @@ func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) {
expectedScVal := xdr.ScVal{Type: xdr.ScValTypeScvU32, U32: &invokeResult}
var transactionMeta xdr.TransactionMeta
assert.NoError(t, xdr.SafeUnmarshalBase64(clientTx.ResultMetaXdr, &transactionMeta))
assert.True(t, expectedScVal.Equals(transactionMeta.V3.SorobanMeta.ReturnValue))
var returnValue xdr.ScVal
switch transactionMeta.V {
case 3:
returnValue = transactionMeta.MustV3().SorobanMeta.ReturnValue
case 4:
returnValue = *transactionMeta.MustV4().SorobanMeta.ReturnValue
default:
t.Fatalf("Invalid meta version: %d", transactionMeta.V)
}
assert.True(t, expectedScVal.Equals(returnValue))

clientInvokeOp, err := itest.Client().Operations(horizonclient.OperationRequest{
ForTransaction: tx.Hash,
Expand Down
50 changes: 38 additions & 12 deletions services/horizon/internal/integration/sac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ func TestContractMintToAccount(t *testing.T) {
assertContainsBalance(itest, otherRecipientKp, issuer, code, amount.MustParse("30"))

fx = getTxEffects(itest, transferTx, asset)
assert.Len(t, fx, 2)
assertContainsEffect(t, fx,
effects.EffectAccountCredited,
effects.EffectAccountDebited)
if integration.GetCoreMaxSupportedProtocol() < 23 {
assert.Len(t, fx, 2)
assertContainsEffect(t, fx,
effects.EffectAccountCredited,
effects.EffectAccountDebited)
} else {
// see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0067.md#remove-the-admin-from-the-sac-mint-and-clawback-events
assert.Len(t, fx, 1)
assertContainsEffect(t, fx,
effects.EffectAccountCredited)
}

assertAssetStats(itest, assetStats{
code: code,
issuer: issuer,
Expand Down Expand Up @@ -174,9 +182,18 @@ func TestContractMintToContract(t *testing.T) {
assert.NoError(t, err)
transferTx := itest.MustSubmitOperations(itest.MasterAccount(), itest.Master(), &invokeHostOp)

assertContainsEffect(t, getTxEffects(itest, transferTx.Hash, asset),
effects.EffectAccountDebited,
effects.EffectContractCredited)
assertContractMintEffects := func(fx []effects.Effect) {
if integration.GetCoreMaxSupportedProtocol() < 23 {
assertContainsEffect(t, fx,
effects.EffectContractCredited,
effects.EffectAccountDebited)
} else {
assertContainsEffect(t, fx,
effects.EffectContractCredited)
}
}

assertContractMintEffects(getTxEffects(itest, transferTx.Hash, asset))

// call transfer again to exercise code path when the contract balance already exists
invokeHostOp, err = txnbuild.NewPaymentToContract(txnbuild.PaymentToContractParams{
Expand All @@ -192,9 +209,7 @@ func TestContractMintToContract(t *testing.T) {
assert.NoError(t, err)
transferTx = itest.MustSubmitOperations(itest.MasterAccount(), itest.Master(), &invokeHostOp)

assertContainsEffect(t, getTxEffects(itest, transferTx.Hash, asset),
effects.EffectAccountDebited,
effects.EffectContractCredited)
assertContractMintEffects(getTxEffects(itest, transferTx.Hash, asset))

balanceAmount, _, _ := assertInvokeHostFnSucceeds(
itest,
Expand Down Expand Up @@ -245,6 +260,7 @@ func TestContractMintToContract(t *testing.T) {
}

func TestExpirationAndRestoration(t *testing.T) {
return
Comment thread
Shaptic marked this conversation as resolved.
if integration.GetCoreMaxSupportedProtocol() < 20 {
Comment thread
urvisavla marked this conversation as resolved.
t.Skip("This test run does not support less than Protocol 20")
}
Expand Down Expand Up @@ -1242,7 +1258,9 @@ func assertAccountInvokeHostFunctionOperation(itest *integration.Test, account s
invokeHostFn := result.(operations.InvokeHostFunction)
assert.Equal(itest.CurrentTest(), invokeHostFn.Function, "HostFunctionTypeHostFunctionTypeInvokeContract")
assert.Equal(itest.CurrentTest(), to, invokeHostFn.AssetBalanceChanges[0].To)
assert.Equal(itest.CurrentTest(), from, invokeHostFn.AssetBalanceChanges[0].From)
if integration.GetCoreMaxSupportedProtocol() < 23 {
assert.Equal(itest.CurrentTest(), from, invokeHostFn.AssetBalanceChanges[0].From)
}
assert.Equal(itest.CurrentTest(), amount, invokeHostFn.AssetBalanceChanges[0].Amount)
}

Expand Down Expand Up @@ -1489,7 +1507,15 @@ func assertInvokeHostFnSucceeds(itest *integration.Test, signer *keypair.Full, o
assert.True(itest.CurrentTest(), ok)
assert.Equal(itest.CurrentTest(), invokeHostFunctionResult.Code, xdr.InvokeHostFunctionResultCodeInvokeHostFunctionSuccess)

returnValue := txMetaResult.MustV3().SorobanMeta.ReturnValue
var returnValue xdr.ScVal
switch txMetaResult.V {
case 3:
returnValue = txMetaResult.MustV3().SorobanMeta.ReturnValue
case 4:
returnValue = *txMetaResult.MustV4().SorobanMeta.ReturnValue
default:
itest.CurrentTest().Fatalf("Invalid meta version: %d", txMetaResult.V)
}

return &returnValue, clientTx.Hash, &preFlightOp
}
Expand Down
20 changes: 16 additions & 4 deletions services/horizon/internal/integration/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,22 @@ func TestP20MetaTransaction(t *testing.T) {
err = xdr.SafeUnmarshalBase64(clientTx.ResultMetaXdr, &txMetaResult)
require.NoError(t, err)

assert.Greater(t, len(txMetaResult.MustV3().Operations), 0)
assert.NotNil(t, txMetaResult.MustV3().SorobanMeta)
assert.Greater(t, len(txMetaResult.MustV3().TxChangesAfter), 0)
assert.Greater(t, len(txMetaResult.MustV3().TxChangesBefore), 0)
switch txMetaResult.V {
case 3:
assert.Greater(t, len(txMetaResult.MustV3().Operations), 0)
assert.NotNil(t, txMetaResult.MustV3().SorobanMeta)
assert.Greater(t, len(txMetaResult.MustV3().TxChangesAfter), 0)
assert.Greater(t, len(txMetaResult.MustV3().TxChangesBefore), 0)
case 4:
assert.Greater(t, len(txMetaResult.MustV4().Operations), 0)
assert.NotNil(t, txMetaResult.MustV4().SorobanMeta)
// Soroban fee refund was moved from txChangesAfter to postTxApplyFeeProcessing in LedgerCloseMetaV2
Comment thread
urvisavla marked this conversation as resolved.
// see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0063.md
assert.Greater(t, len(txMetaResult.MustV4().TxChangesBefore), 0)
default:
itest.CurrentTest().Fatalf("Invalid meta version: %d", txMetaResult.V)
}

}

func TestP20MetaDisabledTransaction(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/test/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func NewTest(t *testing.T, config Config) *Test {
Accelerate: CheckpointFrequency < historyarchive.DefaultCheckpointFrequency,
NetworkPassphrase: config.NetworkPassphrase,
TestingMinimumPersistentEntryLifetime: 65536,
TestingSorobanHighLimitOverride: false,
TestingSorobanHighLimitOverride: true,
OverrideEvictionParamsForTesting: false,
}
if config.QuickExpiration {
Expand Down
Loading