Skip to content

[Flow EVM] Add test cases for restricted EOA functionality#8297

Merged
m-Peter merged 5 commits intov0.44from
mpeter/test-restricted-eoa-functionality
Jan 8, 2026
Merged

[Flow EVM] Add test cases for restricted EOA functionality#8297
m-Peter merged 5 commits intov0.44from
mpeter/test-restricted-eoa-functionality

Conversation

@m-Peter
Copy link
Copy Markdown
Collaborator

@m-Peter m-Peter commented Jan 6, 2026

  • Refactor the EOA restriction functionality
  • Add E2E tests to verify the correctness of EOA restriction
  • Remove reclaimFundsFromAttackerEOAs function from EVM contract code

@m-Peter m-Peter self-assigned this Jan 6, 2026
@m-Peter m-Peter requested a review from a team as a code owner January 6, 2026 11:17
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
fvm/evm/emulator/emulator.go 20.00% 2 Missing and 2 partials ⚠️
utils/unittest/execution_state.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@janezpodhostnik janezpodhostnik left a comment

Choose a reason for hiding this comment

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

Are we keeping this feature or is it temporary?
If we are keeping it, we probably want to change some wording in the errors...

Comment thread fvm/evm/emulator/emulator.go Outdated
WithTransactionTracer(ctx.Tracer),
WithBlockTotalGasUsedSoFar(ctx.TotalGasUsedSoFar),
WithBlockTxCountSoFar(ctx.TxCountSoFar),
WithRestrictedEOAs(restrictedEOAs),
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.

I would make the restrictedEOAs a map[ChainId]gethCommon.Address, so that their definition is cleaner and we can easily tell which are for mainnet/testnet/etc.

Copy link
Copy Markdown
Collaborator Author

@m-Peter m-Peter Jan 6, 2026

Choose a reason for hiding this comment

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

Well, I don't think that we actually want to distinguish between networks. If someone had a malicious activity on Testnet, then we certainly don't want their EOA to also interact with Mainnet too. The opposite is also true.

Keep in mind that wallets such as MetaMask, will use the same address between networks, as EOAs are controller by a private key only.

@m-Peter
Copy link
Copy Markdown
Collaborator Author

m-Peter commented Jan 6, 2026

Are we keeping this feature or is it temporary? If we are keeping it, we probably want to change some wording in the errors...

@janezpodhostnik Yes, these EOAs will be permanently restricted from accessing Flow EVM. But the error was actually written by comms team. What do you have in mind as an error message?

@janezpodhostnik
Copy link
Copy Markdown
Contributor

We might need this feature in the future which means the error message maybe shouldn't mention a specific attack:

"this account has been restricted by the Community Governance Council in connection to a protocol exploit, please reach out to security@flowfoundation.com for inquiries or information related to the attack"

->

"this account has been restricted by the Community Governance Council, please reach out to security@flowfoundation.com for inquiries",

@m-Peter
Copy link
Copy Markdown
Collaborator Author

m-Peter commented Jan 6, 2026

We might need this feature in the future which means the error message maybe shouldn't mention a specific attack:

"this account has been restricted by the Community Governance Council in connection to a protocol exploit, please reach out to security@flowfoundation.com for inquiries or information related to the attack"

->

"this account has been restricted by the Community Governance Council, please reach out to security@flowfoundation.com for inquiries",

Good point, updated in 0972247 .

Comment thread fvm/evm/emulator/config.go Outdated
Comment on lines +35 to +36
// This is only a test EOA, used during tests
gethCommon.HexToAddress("0xad7cBF4b6edAd1A4Bc08Fa74741445918B3C54f4"),
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.

suggestion: restrictedEOAs is a variable. we could add the test EOA during the test so its not listed here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point indeed 👍 Updated in 03e3c7e .

@m-Peter m-Peter force-pushed the mpeter/test-restricted-eoa-functionality branch from 0972247 to 5fc0247 Compare January 8, 2026 11:20
@m-Peter m-Peter force-pushed the mpeter/test-restricted-eoa-functionality branch from 5fc0247 to 03e3c7e Compare January 8, 2026 11:32
@m-Peter m-Peter merged commit d445816 into v0.44 Jan 8, 2026
113 of 114 checks passed
@m-Peter m-Peter deleted the mpeter/test-restricted-eoa-functionality branch January 8, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants