From af0378b020b0874ea111b8714e4befacdb3cc638 Mon Sep 17 00:00:00 2001 From: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:21:53 -0400 Subject: [PATCH] horizon: update core testing image (#5049) --- .github/workflows/horizon.yml | 6 +++--- ...eingest-range-classic-integration-tests.cfg | 9 +++++++++ ...e-core-reingest-range-integration-tests.cfg | 1 + .../internal/integration/contracts/Cargo.toml | 4 ++-- .../horizon/internal/integration/db_test.go | 13 +++++++++++-- .../horizon/internal/integration/sac_test.go | 9 +++++---- .../internal/test/integration/integration.go | 5 +++++ support/contractevents/event.go | 4 ++-- support/contractevents/generate.go | 18 ++---------------- 9 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 services/horizon/docker/captive-core-reingest-range-classic-integration-tests.cfg diff --git a/.github/workflows/horizon.yml b/.github/workflows/horizon.yml index 16c60ccd45..8395ac3934 100644 --- a/.github/workflows/horizon.yml +++ b/.github/workflows/horizon.yml @@ -33,9 +33,9 @@ jobs: env: HORIZON_INTEGRATION_TESTS_ENABLED: true HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.13.1-1469.76fed6ead.focal~soroban - PROTOCOL_20_CORE_DOCKER_IMG: stellar/unsafe-stellar-core-next:19.13.1-1469.76fed6ead.focal-soroban - PROTOCOL_20_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:0.9.4-fix-fees-31 + PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.13.1-1481.3acf6dd26.focal + PROTOCOL_20_CORE_DOCKER_IMG: stellar/stellar-core:19.13.1-1481.3acf6dd26.focal + PROTOCOL_20_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:20.0.0-rc1-double-counting-34 PROTOCOL_19_CORE_DEBIAN_PKG_VERSION: 19.12.0-1378.2109a168a.focal PROTOCOL_19_CORE_DOCKER_IMG: stellar/stellar-core:19.12.0-1378.2109a168a.focal PGHOST: localhost diff --git a/services/horizon/docker/captive-core-reingest-range-classic-integration-tests.cfg b/services/horizon/docker/captive-core-reingest-range-classic-integration-tests.cfg new file mode 100644 index 0000000000..4902cf8d15 --- /dev/null +++ b/services/horizon/docker/captive-core-reingest-range-classic-integration-tests.cfg @@ -0,0 +1,9 @@ +ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true + +[[VALIDATORS]] +NAME="local_core" +HOME_DOMAIN="core.local" +# From "SACJC372QBSSKJYTV5A7LWT4NXWHTQO6GHG4QDAVC2XDPX6CNNXFZ4JK" +PUBLIC_KEY="GD5KD2KEZJIGTC63IGW6UMUSMVUVG5IHG64HUTFWCHVZH2N2IBOQN7PS" +ADDRESS="localhost" +QUALITY="MEDIUM" diff --git a/services/horizon/docker/captive-core-reingest-range-integration-tests.cfg b/services/horizon/docker/captive-core-reingest-range-integration-tests.cfg index 4902cf8d15..26a4cd6fd2 100644 --- a/services/horizon/docker/captive-core-reingest-range-integration-tests.cfg +++ b/services/horizon/docker/captive-core-reingest-range-integration-tests.cfg @@ -1,4 +1,5 @@ ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true +TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true [[VALIDATORS]] NAME="local_core" diff --git a/services/horizon/internal/integration/contracts/Cargo.toml b/services/horizon/internal/integration/contracts/Cargo.toml index cfa9e207be..7e413dfed7 100644 --- a/services/horizon/internal/integration/contracts/Cargo.toml +++ b/services/horizon/internal/integration/contracts/Cargo.toml @@ -22,6 +22,6 @@ codegen-units = 1 lto = true [workspace.dependencies.soroban-sdk] -version = "0.9.1" +version = "20.0.0-rc1" git = "https://github.com/stellar/rs-soroban-sdk" -rev = "ee44e420b9badeb16cab870ed25bef397c058f64" +rev = "f743d6f9e49caa08924318907cd0588b60d7f187" diff --git a/services/horizon/internal/integration/db_test.go b/services/horizon/internal/integration/db_test.go index d9532b2079..020d934930 100644 --- a/services/horizon/internal/integration/db_test.go +++ b/services/horizon/internal/integration/db_test.go @@ -12,6 +12,7 @@ import ( "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/historyarchive" + "github.com/stellar/go/ingest/ledgerbackend" "github.com/stellar/go/keypair" horizoncmd "github.com/stellar/go/services/horizon/cmd" horizon "github.com/stellar/go/services/horizon/internal" @@ -526,7 +527,7 @@ func TestReingestDB(t *testing.T) { horizonConfig.CaptiveCoreConfigPath = filepath.Join( filepath.Dir(horizonConfig.CaptiveCoreConfigPath), - "captive-core-reingest-range-integration-tests.cfg", + getCoreConfigFile(itest), ) horizoncmd.RootCmd.SetArgs(command(t, horizonConfig, "db", @@ -541,6 +542,14 @@ func TestReingestDB(t *testing.T) { tt.NoError(horizoncmd.RootCmd.Execute(), "Repeat the same reingest range against db, should not have errors.") } +func getCoreConfigFile(itest *integration.Test) string { + coreConfigFile := "captive-core-reingest-range-classic-integration-tests.cfg" + if itest.Config().ProtocolVersion >= ledgerbackend.MinimalSorobanProtocolSupport { + coreConfigFile = "captive-core-reingest-range-integration-tests.cfg" + } + return coreConfigFile +} + func command(t *testing.T, horizonConfig horizon.Config, args ...string) []string { return append([]string{ "--stellar-core-url", @@ -679,7 +688,7 @@ func TestFillGaps(t *testing.T) { horizonConfig.CaptiveCoreConfigPath = filepath.Join( filepath.Dir(horizonConfig.CaptiveCoreConfigPath), - "captive-core-reingest-range-integration-tests.cfg", + getCoreConfigFile(itest), ) horizoncmd.RootCmd.SetArgs(command(t, horizonConfig, "db", "fill-gaps", "--parallel-workers=1")) tt.NoError(horizoncmd.RootCmd.Execute()) diff --git a/services/horizon/internal/integration/sac_test.go b/services/horizon/internal/integration/sac_test.go index db654ecb8f..18a167969a 100644 --- a/services/horizon/internal/integration/sac_test.go +++ b/services/horizon/internal/integration/sac_test.go @@ -502,9 +502,10 @@ func TestContractBurnFromAccount(t *testing.T) { ) fx := getTxEffects(itest, burnTx, asset) - assert.Len(t, fx, 1) - burnEffect := assertContainsEffect(t, fx, - effects.EffectAccountDebited)[0].(effects.AccountDebited) + require.Len(t, fx, 1) + assetEffects := assertContainsEffect(t, fx, effects.EffectAccountDebited) + require.GreaterOrEqual(t, len(assetEffects), 1) + burnEffect := assetEffects[0].(effects.AccountDebited) assert.Equal(t, issuer, burnEffect.Asset.Issuer) assert.Equal(t, code, burnEffect.Asset.Code) @@ -833,7 +834,7 @@ func assertEventPayments(itest *integration.Test, txHash string, asset xdr.Asset invokeHostFn := ops.Embedded.Records[0].(operations.InvokeHostFunction) assert.Equal(itest.CurrentTest(), invokeHostFn.Function, "HostFunctionTypeHostFunctionTypeInvokeContract") - assert.Equal(itest.CurrentTest(), 1, len(invokeHostFn.AssetBalanceChanges)) + require.Equal(itest.CurrentTest(), 1, len(invokeHostFn.AssetBalanceChanges)) assetBalanceChange := invokeHostFn.AssetBalanceChanges[0] assert.Equal(itest.CurrentTest(), assetBalanceChange.Amount, amount) assert.Equal(itest.CurrentTest(), assetBalanceChange.From, from) diff --git a/services/horizon/internal/test/integration/integration.go b/services/horizon/internal/test/integration/integration.go index df560d75ac..e83b061b3e 100644 --- a/services/horizon/internal/test/integration/integration.go +++ b/services/horizon/internal/test/integration/integration.go @@ -774,6 +774,11 @@ func (i *Test) WaitForHorizon() { i.t.Fatal("Horizon not ingesting...") } +// Config returns the testing configuration for the current integration test run. +func (i *Test) Config() Config { + return i.config +} + // CoreClient returns a stellar core client connected to the Stellar Core instance. func (i *Test) CoreClient() *stellarcore.Client { return i.coreClient diff --git a/support/contractevents/event.go b/support/contractevents/event.go index 8971e6e99c..fbdc595dcc 100644 --- a/support/contractevents/event.go +++ b/support/contractevents/event.go @@ -173,7 +173,7 @@ func parseCanonicalAsset(assetStr string) (*xdr.Asset, error) { Ed25519: issuerKey.Ed25519, }) - if len(rawCode) == 4 { + if len(rawCode) <= 4 { code := [4]byte{} copy(code[:], rawCode[:]) @@ -182,7 +182,7 @@ func parseCanonicalAsset(assetStr string) (*xdr.Asset, error) { AssetCode: xdr.AssetCode4(code), Issuer: accountId, } - } else if len(rawCode) == 12 { + } else if len(rawCode) <= 12 { code := [12]byte{} copy(code[:], rawCode[:]) diff --git a/support/contractevents/generate.go b/support/contractevents/generate.go index f3d34d3c73..ed4e7da264 100644 --- a/support/contractevents/generate.go +++ b/support/contractevents/generate.go @@ -169,22 +169,8 @@ func makeAsset(asset xdr.Asset) xdr.ScVal { panic(err) } - case xdr.AssetTypeAssetTypeCreditAlphanum4: - _, err := xdr.Marshal(buffer, asset.AlphaNum4.AssetCode) - if err != nil { - panic(err) - } - buffer.WriteString(":") - buffer.WriteString(asset.AlphaNum4.Issuer.Address()) - - case xdr.AssetTypeAssetTypeCreditAlphanum12: - _, err := xdr.Marshal(buffer, asset.AlphaNum12.AssetCode) - if err != nil { - panic(err) - } - buffer.WriteString(":") - buffer.WriteString(asset.AlphaNum12.Issuer.Address()) - + case xdr.AssetTypeAssetTypeCreditAlphanum4, xdr.AssetTypeAssetTypeCreditAlphanum12: + buffer.WriteString(asset.GetCode() + ":" + asset.GetIssuer()) default: panic("unexpected asset type") }