Skip to content

feat(tool): add forest-tool shed migrate state command#5461

Merged
hanabi1224 merged 3 commits intomainfrom
hm/shed-migrate-state
Mar 26, 2025
Merged

feat(tool): add forest-tool shed migrate state command#5461
hanabi1224 merged 3 commits intomainfrom
hm/shed-migrate-state

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Mar 26, 2025

Summary of changes

This PR ports lotus shed migrate-state tool into Forest

Changes introduced in this pull request:

➜  forest git:(main) ✗ forest-tool shed migrate-state --chain calibnet 25 bafy2bzaceb2pqqnclk6hptttsuxtcfhzzfewfizk4c6lonrvq7vesddasxkbo
Migrating... state_root: bafy2bzaceaftms6pagbrvjqmhmehjuxuvicbmyjaz4rfe2rke5xnloc4x3v6e, epoch: 2519400
2025-03-26T09:01:57.696451Z  INFO forest::state_migration::common::state_migration: Processed 100000 actors
2025-03-26T09:02:01.296881Z  INFO forest::state_migration::common::state_migration: Processing deferred migrations
2025-03-26T09:02:01.322608Z  INFO forest::state_migration::common::state_migration: Processed 158974 deferred migrations
Done. old_state: bafy2bzaceaftms6pagbrvjqmhmehjuxuvicbmyjaz4rfe2rke5xnloc4x3v6e, new_state: bafy2bzacec42jz3abzw6zn4gp4wtz2yo6fndqo7uhenpuwcgz3ku54aiyltiy, took: 9s 737ms 522us 710ns
➜  lotus git:(master) ./lotus-shed migrate-state 25 bafy2bzaceb2pqqnclk6hptttsuxtcfhzzfewfizk4c6lonrvq7vesddasxkbo
REMINDER: If you are running this, you likely want to ALSO run the continuity testing tool!
2025-03-26T17:02:37.876+0800    INFO    bundle  bundle/bundle.go:60     manifest cid: bafy2bzacebc7zpsrihpyd2jdcvmegbbk6yhzkifre3hxtoul5wdxxklbwitry
2025-03-26T17:02:37.917+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Creating migration jobs
2025-03-26T17:02:37.917+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Started 17 workers
2025-03-26T17:02:37.918+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer started
2025-03-26T17:02:39.918+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Performing migration: 44944 of 44945 jobs processed (22463/s) [2s elapsed]
2025-03-26T17:02:41.918+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Performing migration: 112121 of 112123 jobs processed (28024/s) [4s elapsed]
2025-03-26T17:02:43.228+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Done creating 158974 migration jobs after 5.3s
2025-03-26T17:02:43.228+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All workers done after 5.3s
2025-03-26T17:02:43.228+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer wrote 158974 results to state tree after 5.3s
2025-03-26T17:02:43.228+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All 158974 done after 5.3s (29930/s)
migration height  2519400
old cid  bafy2bzaceaftms6pagbrvjqmhmehjuxuvicbmyjaz4rfe2rke5xnloc4x3v6e
new cid  bafy2bzacec42jz3abzw6zn4gp4wtz2yo6fndqo7uhenpuwcgz3ku54aiyltiy
completed round actual (without cache), took  5.981188017s
2025-03-26T17:02:44.056+0800    INFO    bundle  bundle/bundle.go:60     manifest cid: bafy2bzacebc7zpsrihpyd2jdcvmegbbk6yhzkifre3hxtoul5wdxxklbwitry
2025-03-26T17:02:44.057+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Started 10 workers
2025-03-26T17:02:44.057+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer started
2025-03-26T17:02:44.057+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Creating migration jobs
2025-03-26T17:02:43.091+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Done creating 158940 migration jobs after 1.5s
2025-03-26T17:02:43.091+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All workers done after 1.5s
2025-03-26T17:02:43.091+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer wrote 158940 results to state tree after 1.5s
2025-03-26T17:02:43.091+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All 158940 done after 1.5s (104335/s)
completed premigration, took  1.89159788s
2025-03-26T17:02:43.290+0800    INFO    bundle  bundle/bundle.go:60     manifest cid: bafy2bzacebc7zpsrihpyd2jdcvmegbbk6yhzkifre3hxtoul5wdxxklbwitry
2025-03-26T17:02:43.290+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Creating migration jobs
2025-03-26T17:02:43.290+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Started 17 workers
2025-03-26T17:02:43.291+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer started
2025-03-26T17:02:43.719+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Done creating 158974 migration jobs after 400ms
2025-03-26T17:02:43.719+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All workers done after 400ms
2025-03-26T17:02:43.719+0800    INFO    fil-consensus   filcns/upgrades.go:3016 Result writer wrote 158974 results to state tree after 400ms
2025-03-26T17:02:43.719+0800    INFO    fil-consensus   filcns/upgrades.go:3016 All 158974 done after 400ms (371033/s)
completed round actual (with cache), took  521.446447ms

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 marked this pull request as ready for review March 26, 2025 09:05
@hanabi1224 hanabi1224 requested a review from a team as a code owner March 26, 2025 09:05
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and lemmih and removed request for a team March 26, 2025 09:05
@LesnyRumcajs
Copy link
Member

@hanabi1224 let's incorporate this tool into https://docs.forest.chainsafe.io/developers/guides/network_upgrades#state-migrations?

Testing the state migration on a relevant network is crucial before the upgrade epoch. This is done by changing the upgrade epoch in both Lotus and Forest and ensuring both migrations produce the same state root. This is done locally, but it might be facilitated in the future.

The future is now. :)

@hanabi1224
Copy link
Contributor Author

The future is now. :)

@LesnyRumcajs Done.

@hanabi1224 hanabi1224 added this pull request to the merge queue Mar 26, 2025
Merged via the queue into main with commit 0173743 Mar 26, 2025
42 checks passed
@hanabi1224 hanabi1224 deleted the hm/shed-migrate-state branch March 26, 2025 15:13
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.

3 participants