Skip to content

Commit 6587622

Browse files
Merge pull request #136 from multiversx/handle-transfer-only-07-16
Fix reconcilation failure: improve detection of (in)effective "transfer value only" events
2 parents 4490f3f + ce2a5d2 commit 6587622

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

server/services/constants.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var (
2929
durationAlarmThresholdAccountServiceGetAccountBalance = time.Duration(500) * time.Millisecond
3030
)
3131

32-
var (
32+
const (
3333
transactionEventSignalError = core.SignalErrorOperation
3434
transactionEventSCDeploy = core.SCDeployIdentifier
3535
transactionEventTransferValueOnly = "transferValueOnly"
@@ -48,9 +48,10 @@ var (
4848

4949
transactionEventDataExecuteOnDestContext = "ExecuteOnDestContext"
5050
transactionEventDataAsyncCall = "AsyncCall"
51+
transactionEventDataTransferAndExecute = "TransferAndExecute"
5152
)
5253

53-
var (
54+
const (
5455
numTopicsOfEventESDTTransfer = 4
5556
numTopicsPerTransferOfEventMultiESDTNFTTransfer = 3
5657
numTopicsOfEventESDTLocalBurn = 3

server/services/transactionEventsController.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ func (controller *transactionEventsController) decideEffectiveEventTransferValue
7777
return nil, nil
7878
}
7979

80-
if string(event.Data) != transactionEventDataExecuteOnDestContext && string(event.Data) != transactionEventDataAsyncCall {
80+
eventData := string(event.Data)
81+
if eventData != transactionEventDataExecuteOnDestContext && eventData != transactionEventDataAsyncCall && eventData != transactionEventDataTransferAndExecute {
8182
// Ineffective event, since the balance change is already captured by a SCR.
8283
return nil, nil
8384
}

server/services/transactionEventsController_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,35 @@ func TestTransactionEventsController_ExtractEvents(t *testing.T) {
235235
require.Equal(t, "100", events[0].value)
236236
})
237237

238+
t.Run("transferValueOnly, after Sirius, effective (intra-shard TransferAndExecute)", func(t *testing.T) {
239+
topic0 := big.NewInt(100).Bytes()
240+
topic1 := testscommon.TestContractBarShard0.PubKey
241+
242+
tx := &transaction.ApiTransactionResult{
243+
Epoch: 43,
244+
Logs: &transaction.ApiLogs{
245+
Events: []*transaction.Events{
246+
{
247+
Identifier: "transferValueOnly",
248+
Address: testscommon.TestContractFooShard0.Address,
249+
Topics: [][]byte{
250+
topic0,
251+
topic1,
252+
},
253+
Data: []byte("TransferAndExecute"),
254+
},
255+
},
256+
},
257+
}
258+
259+
events, err := controller.extractEventTransferValueOnly(tx)
260+
require.NoError(t, err)
261+
require.Len(t, events, 1)
262+
require.Equal(t, testscommon.TestContractFooShard0.Address, events[0].sender)
263+
require.Equal(t, testscommon.TestContractBarShard0.Address, events[0].receiver)
264+
require.Equal(t, "100", events[0].value)
265+
})
266+
238267
t.Run("transferValueOnly, after Sirius, ineffective (cross-shard AsyncCall)", func(t *testing.T) {
239268
topic0 := big.NewInt(100).Bytes()
240269
topic1 := testscommon.TestContractBarShard1.PubKey

systemtests/check_with_mesh_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def run_rosetta(configuration: Configuration, shard: int):
7676
f"--first-historical-epoch={current_epoch}",
7777
f"--num-historical-epochs={configuration.num_historical_epochs}",
7878
f"--activation-epoch-spica={configuration.activation_epoch_spica}",
79+
"--log-level=*:DEBUG",
7980
"--handle-contracts",
8081
"--pprof"
8182
]

version/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ const (
77

88
var (
99
// RosettaMiddlewareVersion is the version of this package (application)
10-
RosettaMiddlewareVersion = "v0.7.0"
10+
RosettaMiddlewareVersion = "v0.7.1"
1111
)

0 commit comments

Comments
 (0)