Skip to content

Fixes altered accounts - #7956

Merged
miiu96 merged 6 commits into
feat/recon-by-metafrom
fixes-altered-accounts
Aug 12, 2026
Merged

Fixes altered accounts#7956
miiu96 merged 6 commits into
feat/recon-by-metafrom
fixes-altered-accounts

Conversation

@miiu96

@miiu96 miiu96 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Fixed altered accounts detection for newly deployed smart contracts
  • The altered accounts provider now scans transaction logs for SCDeploy events and marks the deployed contract address (first topic) as altered with balance change. Previously, newly deployed SCs were missed since they don't appear in tx senders/receivers.

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@miiu96 miiu96 self-assigned this Aug 11, 2026
ssd04
ssd04 previously approved these changes Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves altered-accounts detection in the outport pipeline by ensuring newly deployed smart contract addresses are marked as altered based on SCDeploy log events, not just transaction sender/receiver analysis.

Changes:

  • Scan transaction logs for SCDeploy events and mark the deployed contract address as balance-changed.
  • Add unit tests covering log-based extraction behavior (including missing topics and invalid addresses).

Reviewed changes

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

File Description
outport/process/alteredaccounts/alteredAccountsProvider.go Adds log scanning for SCDeploy events to detect newly deployed smart contracts as altered accounts.
outport/process/alteredaccounts/alteredAccountsProvider_test.go Adds tests for extractAddressesFromLogs covering core success/skip cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +286 to 305
func (aap *alteredAccountsProvider) extractAddressesFromLogs(
logs []*transaction.LogData,
markedAlteredAccounts map[string]*markedAlteredAccount) {
for _, logEvent := range logs {
if logEvent.Log == nil {
continue
}
for _, event := range logEvent.Log.Events {
if string(event.Identifier) != core.SCDeployIdentifier {
continue
}
if len(event.Topics) < 1 {
continue
}

scAddress := event.Topics[0]
aap.addAddressWithBalanceChangeInMap(scAddress, markedAlteredAccounts, false)
}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.71%. Comparing base (cf9a835) to head (862d967).

Files with missing lines Patch % Lines
...process/alteredaccounts/alteredAccountsProvider.go 77.77% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/recon-by-meta    #7956   +/-   ##
===================================================
  Coverage               77.71%   77.71%           
===================================================
  Files                     892      892           
  Lines                  129025   129043   +18     
===================================================
+ Hits                   100267   100281   +14     
- Misses                  22209    22211    +2     
- Partials                 6549     6551    +2     

☔ View full report in Codecov by Harness.
📢 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.

continue
}

scAddress := event.Topics[0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A WASM contract can expose an endpoint named SCDeploy, this name is not reserved and writeLog uses the current endpoint name as the event identifier while allowing the contract to choose the topics. Such a contract can therefore place any same-length account in Topics[0], causing that unrelated account to be marked and exported as balance-changed. Protocol-generated deployment events set event.Address equal to Topics[0]; reject events where these differ and reject addresses outside the current shard before adding them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@miiu96
miiu96 merged commit 6701ce3 into feat/recon-by-meta Aug 12, 2026
11 checks passed
@miiu96
miiu96 deleted the fixes-altered-accounts branch August 12, 2026 10:22
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.

4 participants