Skip to content

op-chain-ops: Add parallel migration#5151

Merged
mergify[bot] merged 1 commit intodevelopfrom
feat/parallel-migration
Mar 16, 2023
Merged

op-chain-ops: Add parallel migration#5151
mergify[bot] merged 1 commit intodevelopfrom
feat/parallel-migration

Conversation

@mslipper
Copy link
Contributor

@mslipper mslipper commented Mar 15, 2023

After some research, I discovered that we can iterate over Geth's storage in parallel as long as we don't share the state database. This PR updates the OVM ETH check script to parallelize state iteration across 64 workers. The parallelization works by partitioning storage keyspace based on the number of workers. To optimize further, I also moved the state balance checking into the main iteration loop to avoid unnecessary iteration. Note that state mutation must be done serially. Overall, this should safe about 40 minutes during the migration.

This PR was tested by running it against a mainnet data directory. The entire process took approximately one hour. As part of this testing I discovered an invalid check in check.go, which was verifying the wrong storage slot in the withdrawals check function. This has been fixed.I confirmed with Mark that the updated MessageSender value is the correct one to be checking for. The filtering code was correct from the beginning.

Builds on #5147.

@mslipper mslipper requested a review from a team as a code owner March 15, 2023 10:22
@mslipper mslipper requested review from protolambda and removed request for a team March 15, 2023 10:22
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2023

⚠️ No Changeset found

Latest commit: 47dada2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mslipper mslipper force-pushed the feat/parallel-migration branch 4 times, most recently from af443ee to e904a02 Compare March 15, 2023 10:35
@mslipper mslipper requested a review from tynes March 15, 2023 10:42
@mslipper mslipper force-pushed the feat/parallel-migration branch 2 times, most recently from c63da3f to cd013d5 Compare March 15, 2023 17:58
@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Merging #5151 (47dada2) into develop (025de3d) will decrease coverage by 3.86%.
The diff coverage is 37.53%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5151      +/-   ##
===========================================
- Coverage    40.45%   36.59%   -3.86%     
===========================================
  Files          353      211     -142     
  Lines        21570    17716    -3854     
  Branches       776        0     -776     
===========================================
- Hits          8727     6484    -2243     
+ Misses       12175    10592    -1583     
+ Partials       668      640      -28     
Flag Coverage Δ
bedrock-go-tests 36.59% <37.53%> (+0.51%) ⬆️
contracts-bedrock-tests ?
contracts-tests ?
core-utils-tests ?
dtl-tests ?
fault-detector-tests ?
sdk-tests ?

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

Impacted Files Coverage Δ
op-chain-ops/cmd/check-migration/main.go 0.00% <0.00%> (ø)
op-chain-ops/cmd/op-migrate/main.go 0.00% <0.00%> (ø)
op-chain-ops/ether/cli.go 63.63% <0.00%> (+63.63%) ⬆️
op-chain-ops/ether/migrate.go 0.00% <0.00%> (ø)
op-chain-ops/genesis/check.go 1.51% <0.00%> (ø)
op-chain-ops/genesis/db_migration.go 0.00% <0.00%> (ø)
op-chain-ops/ether/precheck.go 77.87% <76.88%> (+77.87%) ⬆️

... and 148 files with indirect coverage changes

Base automatically changed from bugfix/revert-single-step to develop March 15, 2023 19:28
@mslipper mslipper force-pushed the feat/parallel-migration branch from cd013d5 to acd8d4d Compare March 15, 2023 19:31
@netlify
Copy link

netlify bot commented Mar 15, 2023

Deploy Preview for opstack-docs ready!

Name Link
🔨 Latest commit 47dada2
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/64128ecab16d7c00080a3d1a
😎 Deploy Preview https://deploy-preview-5151--opstack-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@mslipper mslipper force-pushed the feat/parallel-migration branch from acd8d4d to b2376eb Compare March 16, 2023 03:31
@semgrep-app
Copy link
Contributor

semgrep-app bot commented Mar 16, 2023

Semgrep found 1 detected-generic-api-key finding:

  • docs/op-stack/src/.vuepress/config.js: L42

Generic API Key detected

Created by detected-generic-api-key.

After some research, I discovered that we can iterate over Geth's storage in parallel as long as we don't share the state database. This PR updates the OVM ETH check script to parallelize state iteration across 64 workers. The parallelization works by partitioning storage keyspace based on the number of workers. To optimize further, I also moved the state balance checking into the main iteration loop to avoid unnecessary iteration. Note that state mutation must be done serially. Overall, this should safe about 40 minutes during the migration.

This PR was tested by running it against a mainnet data directory. The entire process took approximately one hour. As part of this testing I discovered an invalid check in `check.go`, which was verifying the wrong storage slot in the withdrawals check function. This has been fixed.I confirmed with Mark that the updated `MessageSender` value is the correct one to be checking for. The filtering code was correct from the beginning.
@mslipper mslipper force-pushed the feat/parallel-migration branch from b2376eb to 47dada2 Compare March 16, 2023 03:36
@mergify mergify bot merged commit 60129ad into develop Mar 16, 2023
@mergify mergify bot deleted the feat/parallel-migration branch March 16, 2023 03:55
@mergify
Copy link
Contributor

mergify bot commented Mar 16, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented Mar 16, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

@mergify mergify bot removed the on-merge-train label Mar 16, 2023
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