Skip to content

Commit

Permalink
horizon: update core testing image (#5049)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsachiherman authored Sep 14, 2023
1 parent 337ae6f commit af0378b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

[[VALIDATORS]]
NAME="local_core"
Expand Down
4 changes: 2 additions & 2 deletions services/horizon/internal/integration/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
13 changes: 11 additions & 2 deletions services/horizon/internal/integration/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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())
Expand Down
9 changes: 5 additions & 4 deletions services/horizon/internal/integration/sac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions services/horizon/internal/test/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions support/contractevents/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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[:])

Expand All @@ -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[:])

Expand Down
18 changes: 2 additions & 16 deletions support/contractevents/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit af0378b

Please sign in to comment.