Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions server/services/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
durationAlarmThresholdAccountServiceGetAccountBalance = time.Duration(500) * time.Millisecond
)

var (
const (
transactionEventSignalError = core.SignalErrorOperation
transactionEventSCDeploy = core.SCDeployIdentifier
transactionEventTransferValueOnly = "transferValueOnly"
Expand All @@ -48,9 +48,10 @@ var (

transactionEventDataExecuteOnDestContext = "ExecuteOnDestContext"
transactionEventDataAsyncCall = "AsyncCall"
transactionEventDataTransferAndExecute = "TransferAndExecute"
)

var (
const (
numTopicsOfEventESDTTransfer = 4
numTopicsPerTransferOfEventMultiESDTNFTTransfer = 3
numTopicsOfEventESDTLocalBurn = 3
Expand Down
3 changes: 2 additions & 1 deletion server/services/transactionEventsController.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func (controller *transactionEventsController) decideEffectiveEventTransferValue
return nil, nil
}

if string(event.Data) != transactionEventDataExecuteOnDestContext && string(event.Data) != transactionEventDataAsyncCall {
eventData := string(event.Data)
if eventData != transactionEventDataExecuteOnDestContext && eventData != transactionEventDataAsyncCall && eventData != transactionEventDataTransferAndExecute {
// Ineffective event, since the balance change is already captured by a SCR.
return nil, nil
}
Expand Down
29 changes: 29 additions & 0 deletions server/services/transactionEventsController_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,35 @@ func TestTransactionEventsController_ExtractEvents(t *testing.T) {
require.Equal(t, "100", events[0].value)
})

t.Run("transferValueOnly, after Sirius, effective (intra-shard TransferAndExecute)", func(t *testing.T) {
topic0 := big.NewInt(100).Bytes()
topic1 := testscommon.TestContractBarShard0.PubKey

tx := &transaction.ApiTransactionResult{
Epoch: 43,
Logs: &transaction.ApiLogs{
Events: []*transaction.Events{
{
Identifier: "transferValueOnly",
Address: testscommon.TestContractFooShard0.Address,
Topics: [][]byte{
topic0,
topic1,
},
Data: []byte("TransferAndExecute"),
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use the transactionEventTransferAndExecute constant instead of a string literal here to keep the test in sync with production code.

Suggested change
Data: []byte("TransferAndExecute"),
Data: []byte(transactionEventTransferAndExecute),

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will not change. It's better to have failing tests in case of such a change.

Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding the event name string here risks a mismatch if the constant changes. Consider using the transactionEventTransferAndExecute constant instead of the literal.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

@andreibancioiu andreibancioiu Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad (very bad, ~extremely bad) advice. It's important to have a failing test in such circumstances (e.g. mistakenly changing the constant in the production code).

},
},
},
}

events, err := controller.extractEventTransferValueOnly(tx)
require.NoError(t, err)
require.Len(t, events, 1)
require.Equal(t, testscommon.TestContractFooShard0.Address, events[0].sender)
require.Equal(t, testscommon.TestContractBarShard0.Address, events[0].receiver)
require.Equal(t, "100", events[0].value)
})

t.Run("transferValueOnly, after Sirius, ineffective (cross-shard AsyncCall)", func(t *testing.T) {
topic0 := big.NewInt(100).Bytes()
topic1 := testscommon.TestContractBarShard1.PubKey
Expand Down
1 change: 1 addition & 0 deletions systemtests/check_with_mesh_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def run_rosetta(configuration: Configuration, shard: int):
f"--first-historical-epoch={current_epoch}",
f"--num-historical-epochs={configuration.num_historical_epochs}",
f"--activation-epoch-spica={configuration.activation_epoch_spica}",
"--log-level=*:DEBUG",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended (explicit logging for our system tests).

Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Adding DEBUG-level logging can flood test output; consider documenting why it’s needed or making it configurable.

Suggested change
"--log-level=*:DEBUG",
f"--log-level=*:{log_level}",

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For system tests. Intended. That is the default, anyway.

"--handle-contracts",
"--pprof"
]
Expand Down
2 changes: 1 addition & 1 deletion version/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ const (

var (
// RosettaMiddlewareVersion is the version of this package (application)
RosettaMiddlewareVersion = "v0.7.0"
RosettaMiddlewareVersion = "v0.7.1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hotfix (patch).

)
Loading