fix: migrate trees ix preserve work#2320
Conversation
📝 WalkthroughWalkthroughThese changes tighten validation rules for forester eligibility and network fee handling across registry initialization and migration paths. The modifications replace direct forester checks with ForesterEpochPda-based validation and enforce stricter constraints on forester definition relative to protocol network fees. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@programs/registry/src/lib.rs`:
- Around line 684-693: The code currently loads metadata and calls
ForesterEpochPda::check_forester_in_program(...) directly, which bypasses the
wrapper flow; change this to follow the wrapper pattern: load metadata (metadata
= ctx.accounts.merkle_tree.load()?.metadata), keep the network_fee non-zero
check, determine work units (use DEFAULT_WORK_V1), call check_forester(...) (the
wrapper) instead of ForesterEpochPda::check_forester_in_program so the
designated-forester fallback for private trees is preserved, and then proceed to
call the processing function; reference the symbols metadata, DEFAULT_WORK_V1,
check_forester, and ForesterEpochPda::check_forester_in_program when updating
the call.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
program-tests/registry-test/tests/tests.rsis excluded by none and included by none
📒 Files selected for processing (2)
programs/registry/src/lib.rssdk-libs/program-test/src/indexer/test_indexer.rs
Summary by CodeRabbit