Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verification tool for evm offchain replay #6755

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Nov 22, 2024

This PR adds a util cmd for verifying the evm offchain replay.

No API change for gateway.

@zhangchiqing zhangchiqing changed the base branch from master to leo/add-testcase-for-offchain-evm-backward-compatibilities November 22, 2024 16:22
@zhangchiqing zhangchiqing marked this pull request as ready for review November 22, 2024 16:23
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 1.99275% with 541 lines in your changes missing coverage. Please review.

Project coverage is 41.11%. Comparing base (8a3055c) to head (556d903).

Files with missing lines Patch % Lines
fvm/evm/offchain/utils/verify.go 0.00% 186 Missing ⚠️
cmd/util/cmd/verify-evm-offchain-replay/verify.go 0.00% 112 Missing ⚠️
fvm/evm/testutils/gob.go 0.00% 66 Missing ⚠️
fvm/evm/offchain/utils/replay.go 0.00% 52 Missing ⚠️
cmd/util/cmd/verify-evm-offchain-replay/main.go 0.00% 46 Missing ⚠️
fvm/evm/offchain/blocks/provider.go 0.00% 34 Missing ⚠️
fvm/evm/offchain/blocks/block_proposal.go 0.00% 22 Missing ⚠️
fvm/evm/offchain/sync/replay.go 40.00% 12 Missing ⚠️
fvm/evm/offchain/sync/replayer.go 33.33% 6 Missing ⚠️
fvm/evm/handler/blockHashList.go 0.00% 4 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6755      +/-   ##
==========================================
- Coverage   41.26%   41.11%   -0.15%     
==========================================
  Files        2061     2067       +6     
  Lines      182702   183228     +526     
==========================================
- Hits        75384    75336      -48     
- Misses     101010   101582     +572     
- Partials     6308     6310       +2     
Flag Coverage Δ
unittests 41.11% <1.99%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@zhangchiqing zhangchiqing force-pushed the leo/add-verify-evm-offchain-replay branch from 103f257 to d379a68 Compare November 22, 2024 16:49
Copy link
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.

Nice!

return nil
}

func parseEVMEvents(evts flow.EventsList) (*events.BlockEventPayload, []events.TransactionEventPayload, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not seem to handle the case where there was a period that did not have blocks executed events, but did have transaction executed.

The solution is to accumulate the transaction executed events, until you hit the next block executed event.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's handled by the NewEVMEventsAccumulator module

return nil
}

func initStorages(chainID flow.ChainID, dataDir string, executionDataDir string) (
Copy link
Contributor

Choose a reason for hiding this comment

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

chain ID is not needed

@zhangchiqing zhangchiqing force-pushed the leo/add-verify-evm-offchain-replay branch 2 times, most recently from 8f6ed3b to 5db925d Compare November 23, 2024 00:57
@zhangchiqing zhangchiqing force-pushed the leo/add-testcase-for-offchain-evm-backward-compatibilities branch from 4fe749e to 27c0f3a Compare November 23, 2024 04:47
@zhangchiqing zhangchiqing force-pushed the leo/add-verify-evm-offchain-replay branch from a725780 to f564161 Compare November 23, 2024 04:48
@zhangchiqing zhangchiqing force-pushed the leo/add-testcase-for-offchain-evm-backward-compatibilities branch from 27c0f3a to 0cfcb7d Compare November 25, 2024 19:13
Base automatically changed from leo/add-testcase-for-offchain-evm-backward-compatibilities to master November 26, 2024 20:56
@zhangchiqing zhangchiqing requested review from janezpodhostnik and removed request for Kay-Zee November 26, 2024 23:30
@zhangchiqing zhangchiqing force-pushed the leo/add-verify-evm-offchain-replay branch from 887419e to a41e107 Compare November 27, 2024 00:40
transactionEvents []events.TransactionEventPayload,
blockEvent *events.BlockEventPayload,
) (types.ReplayResultCollector, error) {
) (types.ReplayResultCollector, []*types.Result, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Added the result for comparing trie updates, but the original ReplayBlock is unchanged, so that gateway doesn't need to update its usage.

if chainID == flow.Testnet {
return flowHeight == 211176670
} else if chainID == flow.Mainnet {
return flowHeight == 85981135
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe that the proper Flow Height should be 85981134. This is where the EVM contract was first deployed on mainnet, see https://www.flowscan.io/contract/A.e467b9dd11fa00df.EVM/deployments?deployment=85981134

Copy link
Collaborator

@m-Peter m-Peter left a comment

Choose a reason for hiding this comment

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

LGTM! Just one correction on the mainnet first EVM height.

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