Skip to content

Commit 54ba264

Browse files
committed
addressing review comments
1 parent 437ce26 commit 54ba264

File tree

2 files changed

+17
-56
lines changed

2 files changed

+17
-56
lines changed

services/horizon/internal/integration/generate_ledgers_test.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,8 @@ func merge(t *testing.T, networkPassphrase string, ledgers []xdr.LedgerCloseMeta
444444
var curCount int
445445
for _, ledger := range ledgers {
446446
transactionCount := ledger.CountTransactions()
447-
448-
switch ledger.V {
449-
case 1:
450-
require.Empty(t, ledger.V1.EvictedKeys)
451-
require.Empty(t, ledger.V1.UpgradesProcessing)
452-
case 2:
453-
require.Empty(t, ledger.V2.EvictedKeys)
454-
require.Empty(t, ledger.V2.UpgradesProcessing)
455-
default:
456-
t.Fatalf("Invalid ledger meta version: %d", ledger.V)
457-
}
458-
447+
require.Empty(t, ledger.V1.EvictedKeys)
448+
require.Empty(t, ledger.V1.UpgradesProcessing)
459449
if transactionCount == 0 {
460450
continue
461451
}

services/horizon/internal/integration/invokehostfunction_test.go

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ const constructor_contract = "soroban_constructor_contract.wasm"
3030
// contract code if needed to new wasm.
3131

3232
func TestContractInvokeHostFunctionInstallContract(t *testing.T) {
33-
if integration.GetCoreMaxSupportedProtocol() < 20 {
34-
t.Skip("This test run does not support less than Protocol 20")
35-
}
36-
3733
itest := integration.NewTest(t, integration.Config{
3834
EnableStellarRPC: true,
3935
})
@@ -79,10 +75,6 @@ func TestContractInvokeHostFunctionInstallContract(t *testing.T) {
7975
}
8076

8177
func TestSorobanFeeBumpTransaction(t *testing.T) {
82-
if integration.GetCoreMaxSupportedProtocol() < 20 {
83-
t.Skip("This test run does not support less than Protocol 20")
84-
}
85-
8678
itest := integration.NewTest(t, integration.Config{
8779
EnableStellarRPC: true,
8880
})
@@ -131,10 +123,6 @@ func TestSorobanFeeBumpTransaction(t *testing.T) {
131123
}
132124

133125
func TestContractInvokeHostFunctionCreateContractByAddress(t *testing.T) {
134-
if integration.GetCoreMaxSupportedProtocol() < 20 {
135-
t.Skip("This test run does not support less than Protocol 20")
136-
}
137-
138126
itest := integration.NewTest(t, integration.Config{
139127
EnableStellarRPC: true,
140128
})
@@ -184,10 +172,6 @@ func TestContractInvokeHostFunctionCreateContractByAddress(t *testing.T) {
184172
}
185173

186174
func TestContractInvokeHostFunctionCreateConstructorContract(t *testing.T) {
187-
if integration.GetCoreMaxSupportedProtocol() < 22 {
188-
t.Skip("This test run does not support less than Protocol 22")
189-
}
190-
191175
itest := integration.NewTest(t, integration.Config{
192176
EnableStellarRPC: true,
193177
QuickExpiration: true,
@@ -284,10 +268,6 @@ func TestContractInvokeHostFunctionCreateConstructorContract(t *testing.T) {
284268
}
285269

286270
func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
287-
if integration.GetCoreMaxSupportedProtocol() < 20 {
288-
t.Skip("This test run does not support less than Protocol 20")
289-
}
290-
291271
itest := integration.NewTest(t, integration.Config{
292272
EnableStellarRPC: true,
293273
})
@@ -369,17 +349,7 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
369349
var transactionMeta xdr.TransactionMeta
370350
assert.NoError(t, xdr.SafeUnmarshalBase64(tx.ResultMetaXdr, &transactionMeta))
371351

372-
var returnValue xdr.ScVal
373-
switch transactionMeta.V {
374-
case 3:
375-
returnValue = transactionMeta.MustV3().SorobanMeta.ReturnValue
376-
case 4:
377-
returnValue = *transactionMeta.MustV4().SorobanMeta.ReturnValue
378-
default:
379-
t.Fatalf("Invalid meta version: %d", transactionMeta.V)
380-
}
381-
382-
assert.True(t, expectedScVal.Equals(returnValue))
352+
assert.True(t, expectedScVal.Equals(mustGetSorobanMetaReturnValue(t, transactionMeta)))
383353

384354
clientInvokeOp, err := itest.Client().Operations(horizonclient.OperationRequest{
385355
ForTransaction: tx.Hash,
@@ -402,11 +372,20 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
402372
assert.Equal(t, invokeHostFunctionOpJson.Parameters[3].Type, "U64")
403373
}
404374

405-
func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) {
406-
if integration.GetCoreMaxSupportedProtocol() < 20 {
407-
t.Skip("This test run does not support less than Protocol 20")
375+
func mustGetSorobanMetaReturnValue(t *testing.T, meta xdr.TransactionMeta) xdr.ScVal {
376+
var returnValue xdr.ScVal
377+
switch meta.V {
378+
case 3:
379+
returnValue = meta.MustV3().SorobanMeta.ReturnValue
380+
case 4:
381+
returnValue = *meta.MustV4().SorobanMeta.ReturnValue
382+
default:
383+
t.Fatalf("Invalid meta version: %d", meta.V)
408384
}
385+
return returnValue
386+
}
409387

388+
func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) {
410389
itest := integration.NewTest(t, integration.Config{
411390
EnableStellarRPC: true,
412391
})
@@ -474,16 +453,8 @@ func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) {
474453
expectedScVal := xdr.ScVal{Type: xdr.ScValTypeScvU32, U32: &invokeResult}
475454
var transactionMeta xdr.TransactionMeta
476455
assert.NoError(t, xdr.SafeUnmarshalBase64(clientTx.ResultMetaXdr, &transactionMeta))
477-
var returnValue xdr.ScVal
478-
switch transactionMeta.V {
479-
case 3:
480-
returnValue = transactionMeta.MustV3().SorobanMeta.ReturnValue
481-
case 4:
482-
returnValue = *transactionMeta.MustV4().SorobanMeta.ReturnValue
483-
default:
484-
t.Fatalf("Invalid meta version: %d", transactionMeta.V)
485-
}
486-
assert.True(t, expectedScVal.Equals(returnValue))
456+
457+
assert.True(t, expectedScVal.Equals(mustGetSorobanMetaReturnValue(t, transactionMeta)))
487458

488459
clientInvokeOp, err := itest.Client().Operations(horizonclient.OperationRequest{
489460
ForTransaction: tx.Hash,

0 commit comments

Comments
 (0)