Skip to content

Fix reconcilation failure: improve detection of (in)effective "transfer value only" events#136

Merged
andreibancioiu merged 4 commits intomainfrom
handle-transfer-only-07-16
Jul 16, 2025
Merged

Fix reconcilation failure: improve detection of (in)effective "transfer value only" events#136
andreibancioiu merged 4 commits intomainfrom
handle-transfer-only-07-16

Conversation

@andreibancioiu
Copy link
Collaborator

@andreibancioiu andreibancioiu commented Jul 16, 2025

Original reconciliation failure:

Command Failed: unable to sync to 26038290: failed to sequence block range 26035294-26038290: unable to process block range 26035294-26038290: 
unable to process block 26035294: failed to handle the event of block 26035294 is added: unable to add block 26035294 (block hash: e447fbfbfe40e83a24c81f983aeb8271328d482058923979f26dfdd191c512ba) to storage: 
unable to update balance: account balance -24625648702188092 of currency {"symbol":"EGLD","decimals":18} for 

account {"address":"erd1qqqqqqqqqqqqqpgqkcllq2mgrnshhf543ese6gww3y2fjgs6u7zsmq34k6"} at block {"index":26035294,"hash":"e447fbfbfe40e83a24c81f983aeb8271328d482058923979f26dfdd191c512ba"} is invalid: negative balance

The transfer value only event with value 0.024625648702188092 was previously ignored - mistakenly thought as being ineffective, in the function decideEffectiveEventTransferValueOnlyAfterSirius.

We've changed the logic, so that transfer value only events emitted within ExecuteOnDestContext, AsyncCall and TransferAndExecute are properly considered (previously, the latter wasn't).

@andreibancioiu andreibancioiu self-assigned this Jul 16, 2025
@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.65%. Comparing base (43261e1) to head (ce2a5d2).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   61.64%   61.65%   +0.01%     
==========================================
  Files          48       48              
  Lines        3791     3792       +1     
==========================================
+ Hits         2337     2338       +1     
  Misses       1302     1302              
  Partials      152      152              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreibancioiu andreibancioiu changed the title Fix detection of ineffective "transfer value only" events Fix reconcilation failure: improve detection of ineffective "transfer value only" events Jul 16, 2025
@andreibancioiu andreibancioiu marked this pull request as ready for review July 16, 2025 09:07
@andreibancioiu andreibancioiu changed the title Fix reconcilation failure: improve detection of ineffective "transfer value only" events Fix reconcilation failure: improve detection of (in)effective "transfer value only" events Jul 16, 2025
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).

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).

}

if string(event.Data) != transactionEventDataExecuteOnDestContext && string(event.Data) != transactionEventDataAsyncCall {
if string(event.Data) != transactionEventDataExecuteOnDestContext && string(event.Data) != transactionEventDataAsyncCall && string(event.Data) != transactionEventTransferAndExecute {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't need a loop (yet!), I think.

@andreibancioiu andreibancioiu requested a review from Copilot July 16, 2025 10:18

This comment was marked as outdated.

@andreibancioiu andreibancioiu requested a review from Copilot July 16, 2025 10:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes reconciliation failures by improving how “transfer value only” events are detected, particularly for TransferAndExecute contexts, and updates related versioning and tests.

  • Bumped RosettaMiddlewareVersion to v0.7.1.
  • Extended decideEffectiveEventTransferValueOnlyAfterSirius to treat TransferAndExecute events as effective and added the corresponding constant.
  • Added a unit test for intra-shard TransferAndExecute events and enabled DEBUG logging in system tests.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
version/constants.go Updated middleware version to v0.7.1.
systemtests/check_with_mesh_cli.py Enabled --log-level=*:DEBUG for mesh CLI checks.
server/services/constants.go Converted event var blocks to const, added TransferAndExecute.
server/services/transactionEventsController.go Included TransferAndExecute in effective event logic.
server/services/transactionEventsController_test.go Added test for intra-shard TransferAndExecute events.
Comments suppressed due to low confidence (1)

server/services/constants.go:51

  • [nitpick] The constant name transactionEventTransferAndExecute is inconsistent with the existing transactionEventData* constants. Consider renaming it to transactionEventDataTransferAndExecute for naming consistency.
	transactionEventTransferAndExecute       = "TransferAndExecute"

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.

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).

@andreibancioiu andreibancioiu merged commit 6587622 into main Jul 16, 2025
7 checks passed
@andreibancioiu andreibancioiu deleted the handle-transfer-only-07-16 branch July 16, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants