onflow / flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
GNU Affero General Public License v3.0
534 stars 179 forks source link

[Util] Add verify execution result cmd #6746

Open zhangchiqing opened 5 days ago

zhangchiqing commented 5 days ago

Working towards https://github.com/onflow/flow-go/issues/6557

This PR implemented option 4 in the above issue.

It adds a util command verify-execution-result that takes execution node's data and verifies every single chunks for a range blocks.

Since we would like to make sure future cadence versions are backward compatible. This util allows us to capture any backward compatibilities issue from either FVM or cadence related changes.

For instance, if cadence introduces a breaking change, then it will be caught by running this verify-execution-result with a latest snapshot of EN. The util can verify the last 1M blocks, and 1 of the chunk might fail caused by the breaking change.

I have verified with the latest testnet snapshot, and it worked. It verified 200K blocks after 3 hours, roughly 18 blocks per sec. The memory needed is about 14G.

Future optimization can be done by parallelizing the verification.

codecov-commenter commented 5 days ago

Codecov Report

Attention: Patch coverage is 3.82979% with 226 lines in your changes missing coverage. Please review.

Project coverage is 41.18%. Comparing base (ed149a7) to head (6453fb4). Report is 99 commits behind head on master.

Files with missing lines Patch % Lines
engine/verification/verifier/verifiers.go 0.00% 124 Missing :warning:
cmd/util/cmd/verify_execution_result/cmd.go 0.00% 53 Missing :warning:
model/verification/convert/convert.go 0.00% 48 Missing :warning:
cmd/util/cmd/root.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6746 +/- ## ========================================== - Coverage 41.19% 41.18% -0.01% ========================================== Files 2052 2063 +11 Lines 182215 182822 +607 ========================================== + Hits 75069 75301 +232 - Misses 100852 101216 +364 - Partials 6294 6305 +11 ``` | [Flag](https://app.codecov.io/gh/onflow/flow-go/pull/6746/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/onflow/flow-go/pull/6746/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow) | `41.18% <3.82%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: