@@ -30,10 +30,6 @@ const constructor_contract = "soroban_constructor_contract.wasm"
3030// contract code if needed to new wasm.
3131
3232func 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
8177func 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
133125func 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
186174func 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 ,
@@ -270,18 +254,20 @@ func TestContractInvokeHostFunctionCreateConstructorContract(t *testing.T) {
270254 assert .Len (t , invokeHostFunctionOpJson .AssetBalanceChanges , 1 )
271255 assetBalanceChange := invokeHostFunctionOpJson .AssetBalanceChanges [0 ]
272256 assert .Equal (itest .CurrentTest (), assetBalanceChange .Amount , "10.0000000" )
273- assert .Equal (itest .CurrentTest (), assetBalanceChange .From , issuer )
274257 assert .Equal (itest .CurrentTest (), assetBalanceChange .To , strkey .MustEncode (strkey .VersionByteContract , contractID [:]))
275- assert .Equal (itest .CurrentTest (), assetBalanceChange .Type , "transfer" )
258+ if integration .GetCoreMaxSupportedProtocol () < 23 {
259+ assert .Equal (itest .CurrentTest (), assetBalanceChange .From , issuer )
260+ assert .Equal (itest .CurrentTest (), assetBalanceChange .Type , "transfer" )
261+ } else {
262+ // see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0067.md#protocol-upgrade-transition
263+ assert .Equal (itest .CurrentTest (), assetBalanceChange .From , "" )
264+ assert .Equal (itest .CurrentTest (), assetBalanceChange .Type , "mint" )
265+ }
276266 assert .Equal (itest .CurrentTest (), assetBalanceChange .Asset .Code , strings .TrimRight (asset .GetCode (), "\x00 " ))
277267 assert .Equal (itest .CurrentTest (), assetBalanceChange .Asset .Issuer , asset .GetIssuer ())
278268}
279269
280270func TestContractInvokeHostFunctionInvokeStatelessContractFn (t * testing.T ) {
281- if integration .GetCoreMaxSupportedProtocol () < 20 {
282- t .Skip ("This test run does not support less than Protocol 20" )
283- }
284-
285271 itest := integration .NewTest (t , integration.Config {
286272 EnableStellarRPC : true ,
287273 })
@@ -362,7 +348,8 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
362348 expectedScVal := xdr.ScVal {Type : xdr .ScValTypeScvU64 , U64 : & invokeResult }
363349 var transactionMeta xdr.TransactionMeta
364350 assert .NoError (t , xdr .SafeUnmarshalBase64 (tx .ResultMetaXdr , & transactionMeta ))
365- assert .True (t , expectedScVal .Equals (transactionMeta .V3 .SorobanMeta .ReturnValue ))
351+
352+ assert .True (t , expectedScVal .Equals (mustGetSorobanMetaReturnValue (t , transactionMeta )))
366353
367354 clientInvokeOp , err := itest .Client ().Operations (horizonclient.OperationRequest {
368355 ForTransaction : tx .Hash ,
@@ -385,11 +372,20 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) {
385372 assert .Equal (t , invokeHostFunctionOpJson .Parameters [3 ].Type , "U64" )
386373}
387374
388- func TestContractInvokeHostFunctionInvokeStatefulContractFn (t * testing.T ) {
389- if integration .GetCoreMaxSupportedProtocol () < 20 {
390- 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 )
391384 }
385+ return returnValue
386+ }
392387
388+ func TestContractInvokeHostFunctionInvokeStatefulContractFn (t * testing.T ) {
393389 itest := integration .NewTest (t , integration.Config {
394390 EnableStellarRPC : true ,
395391 })
@@ -457,7 +453,8 @@ func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) {
457453 expectedScVal := xdr.ScVal {Type : xdr .ScValTypeScvU32 , U32 : & invokeResult }
458454 var transactionMeta xdr.TransactionMeta
459455 assert .NoError (t , xdr .SafeUnmarshalBase64 (clientTx .ResultMetaXdr , & transactionMeta ))
460- assert .True (t , expectedScVal .Equals (transactionMeta .V3 .SorobanMeta .ReturnValue ))
456+
457+ assert .True (t , expectedScVal .Equals (mustGetSorobanMetaReturnValue (t , transactionMeta )))
461458
462459 clientInvokeOp , err := itest .Client ().Operations (horizonclient.OperationRequest {
463460 ForTransaction : tx .Hash ,
0 commit comments