Skip to content

Add synthetic transaction execution and restrict inline contract operations - #3644

Merged
jason-aelf merged 6 commits into
masterfrom
hotfix/synthetic-transaction-execution
Sep 1, 2026
Merged

Add synthetic transaction execution and restrict inline contract operations#3644
jason-aelf merged 6 commits into
masterfrom
hotfix/synthetic-transaction-execution

Conversation

@jason-aelf

Copy link
Copy Markdown
Collaborator
  1. Add synthetic execution for transactions targeting the affected contract in normal and read-only execution paths.
  2. Disallow inline contract deployment and updates on side chains.

jason-aelf and others added 6 commits August 18, 2026 21:21
…ay deterministic

The bypass matched only on To == the malicious contract and applied at every
execution depth and on the read-only path, so it changed the result of ANY call
to the contract -- including a synchronous cross-contract Context.Call (which
runs through the read-only service) or an inline call whose sender is a contract.
Because the contract only leaks the node key when Context.Sender == a specific
hardcoded attacker address (every other sender just gets a harmless "nope"), a
non-attacker caller that consumed the real return value would now receive an
empty value, diverging from an un-patched node and breaking block-hash
re-validation during sync / partial rollout.

Match From == the attacker address (== Context.Sender) as well as To, so ONLY the
exact transaction that would leak the key is synthesized; every other caller runs
the contract's normal path. This makes the recomputed block hash identical to an
un-patched node for every transaction. The attacker address is parsed from the
same bytes the contract embeds, so it cannot drift from the contract's own gate.

Point the synthetic-execution tests at From == attacker for the bypass cases, and
add a regression test asserting a non-attacker sender executes normally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…calls stay deterministic"

This reverts commit 89fed1c.

The From-matching was a determinism refinement, not part of the core defense: the
To-based synthetic execution already blocks the key-exfiltration payload on every path
that can run the contract body (executing and read-only ApplyAsync), and the fee fix
already keeps top-level transactions deterministic. Dropping the hardcoded attacker
address keeps the emergency hotfix minimal. The only residual it addressed -- a
synchronous cross-contract Context.Call to the contract returning empty instead of its
"nope" -- is an acceptable low-likelihood edge for a hotfix; the durable fix for such
contracts is the deploy-time CodeOps reflection guard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@eanz17 eanz17 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.64%. Comparing base (d0980a8) to head (b5d9c75).

Files with missing lines Patch % Lines
...lication/ISyntheticTransactionExecutionProvider.cs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3644      +/-   ##
==========================================
+ Coverage   87.81%   90.64%   +2.83%     
==========================================
  Files         680      681       +1     
  Lines       26310    26325      +15     
  Branches     2370     2370              
==========================================
+ Hits        23104    23863     +759     
+ Misses       3090     2346     -744     
  Partials      116      116              
Files with missing lines Coverage Δ
...AElf.Contracts.Genesis/BasicContractZero_Helper.cs 98.22% <100.00%> (+1.15%) ⬆️
...tract.Parallel/Domain/ResourceExtractionService.cs 100.00% <100.00%> (ø)
...ct/Application/PlainTransactionExecutingService.cs 93.65% <100.00%> (+0.10%) ⬆️
...Application/TransactionReadOnlyExecutionService.cs 100.00% <100.00%> (ø)
...lf.Kernel.SmartContract/SmartContractAElfModule.cs 100.00% <100.00%> (ø)
...ernel.TransactionPool/TransactionPoolAElfModule.cs 100.00% <100.00%> (ø)
...lication/ISyntheticTransactionExecutionProvider.cs 88.88% <88.88%> (ø)

... and 14 files with indirect coverage changes

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

@jason-aelf
jason-aelf merged commit d1d0cf8 into master Sep 1, 2026
12 checks passed
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.

2 participants