Skip to content

Release: V1 Migrator for OHM v1→v2 migration, emergency shutdown improvements, and developer tooling - #218

Merged
0xJem merged 285 commits into
masterfrom
develop
Mar 10, 2026
Merged

0xJem merged 285 commits into
masterfrom
develop

Conversation

@0xJem

@0xJem 0xJem commented Mar 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Introduces the V1 Migrator policy enabling OHM v1 holders to migrate to OHM v2 via merkle drop, plus
emergency shutdown improvements and enhanced developer tooling.

Key Changes

V1 Migrator (#196)

  • New V1Migrator policy with merkle-based OHM v1 → v2 migration
  • Migration cap governance control via setRemainingMintApproval()
  • Mainnet deployment scripts and OCG proposal
  • previewMigrate() view helper for users
  • rescue() function for recovering accidentally sent tokens
  • Guards against griefing and duplicate merkle root setting

Emergency Shutdown (#183)

  • Centralized emergency-config.json with JSON schema validation
  • GitHub workflow to automatically validate emergency config
  • Improved update-emergency-config skill using jq and contract sources

Developer Tooling (#195, #197)

  • New Claude skills: /test-write, /test-debug, /lint-fix
  • AGENTS.md with comprehensive project guidance
  • MCP server configuration (CodeRabbit, Context7, Etherscan, GitHub)

Other Changes

  • Burner policy: Added PolicyEnabler, IVersioned, IERC165 support
  • OlyBatch: Tenderly sender fixes, anvil fork support
  • Fork testing documentation improvements

Summary by CodeRabbit

Release Notes

  • New Features

    • Added OHM V1-to-V2 migration capability with merkle-verified eligibility and mint approval caps
    • Introduced emergency shutdown configuration system with validation and documentation
    • Added Anvil fork testing support for proposal execution and local testing workflows
  • Documentation

    • Comprehensive emergency shutdown procedures and configuration schemas
    • V1 migrator user guide and technical specifications
    • Local fork testing and staking replacement documentation
  • Developer Experience

    • Enhanced testing infrastructure with validation helpers and fork utilities
    • Improved CI/CD workflows with emergency config validation
    • New governance proposal execution tools for local and testnet environments

0xJem and others added 30 commits January 12, 2026 17:44
0xJem and others added 23 commits March 10, 2026 14:18
- Restrict contract mode to .sol files under src/policies/ or src/periphery/
- Add path validation in B1 to reject contracts outside valid directories
- Update mode detection to explicitly define error case for invalid paths
- Remove fallback logic that attempted to resolve unknown contract keys
- Enumerate concrete contract declarations instead of file-level grep
- Walk inheritance chain up to 3 levels to detect indirect inheritance
- Skip only abstract contract declarations, not entire files containing abstract contracts
- Track and report inheritance level (direct vs indirect) for detected enablers
- Properly handle cases like BaseDepositFacility -> PolicyEnabler
- Explain that /update-emergency-config is a Claude Code skill
- Document its capabilities: scan, generate, validate, and update
- Add example usage for both scan mode and contract mode
- Clarify access location (repository's Claude Code environment)
- Add ajv dependency for JSON schema validation
- Validate config against emergency-config.schema.json (previously loaded but unused)
- Remove $schema property before validation to avoid meta-schema issues
- Use validateFormats: false since dates/URLs are validated by custom validators
- Log schema validation errors and abort on failure

Fixes issue where schema was loaded but never used for validation.
- Check that call.function exists in the ABI definition (call.abi)
- Look up ABI definition from abis[call.abi] after confirming key exists
- Search for matching function name in ABI array using abiDef.some()
- Report clear error when function is missing from ABI
- Maintains original unknown-ABI error when abiDef is undefined

This catches typos and wrong function names in calldata definitions during CI.
- Add pnpm setup and installation steps
- Add pnpm cache for faster workflow runs
- Install dependencies with pnpm install --frozen-lockfile
- Fixes "Cannot find module 'ajv'" error in CI

The ajv package was added for JSON schema validation but the CI workflow
wasn't installing dependencies before running the validation script.
- CoolerV2: 0x19b7... → 0x8bEB...
- CoolerV2Composites: 0xe7A8... → 0x992e...
- EmissionManager: 0x8478... → 0x79cF...
…oyment

Replace staking contracts on Sepolia to correct sOHM index
@0xJem 0xJem self-assigned this Mar 10, 2026
@coderabbitai

coderabbitai Bot commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces OHM v1-to-v2 migration infrastructure via merkle-verified eligibility, adds comprehensive emergency shutdown documentation and validation tooling, updates operational scripts to support chain-based parameter resolution, refactors GitHub Actions workflows with consolidated dependency installation, and adds extensive LLM/agent guidance and Claude skills documentation.

Changes

Cohort / File(s) Summary
V1 Migration Contracts
src/external/OwnedERC20.sol, src/policies/V1Migrator.sol, src/policies/Burner.sol, src/policies/interfaces/IV1Migrator.sol, src/proposals/MigrationProposal.sol, src/proposals/MigrationProposalHelper.sol
New migration policy infrastructure: OwnedERC20 (owner-controlled minting), V1Migrator (merkle-gated eligibility with nonce-based cap management), Burner (token burning with category tracking), MigrationProposal (multi-step governance activation), and MigrationProposalHelper (one-time migration orchestration).
Legacy Contract Interfaces
src/interfaces/IOlympusTokenMigrator.sol, src/interfaces/IOlympusTreasury.sol, src/interfaces/IStaking.sol, src/interfaces/IgOHM.sol, src/interfaces/IsOHM.sol
New interfaces for v1 token migration, treasury management, staking contracts with getter expansion (OHM, sOHM, gOHM addresses, index, supply), and legacy contract compatibility.
V1 Migration Tests
src/test/policies/V1Migrator/*, src/test/proposals/MigrationProposal.t.sol, src/test/proposals/MigrationProposalHelperFork.t.sol
Comprehensive test suites covering merkle verification, migration flows, access control, edge cases (cap reached, insufficient approval, invalid proofs), integration tests, and fork-based validation against mainnet state.
Deployment & Operations
src/scripts/deploy/DeployV3.s.sol, src/scripts/ops/batches/MigrationProposalSetup.sol, src/scripts/ops/batches/V1MigratorConfig.sol, src/scripts/ops/ReplaceStaking.s.sol, src/scripts/ops/VerifyLegacyStaking.s.sol
New deployment functions for migration contracts, batch scripts orchestrating multi-step activation/configuration with post-batch validation, and legacy staking replacement/verification workflows.
Operational Script Updates
shell/mint/*.sh, shell/roles/*.sh, shell/safeBatch.sh, shell/safeBatchV2.sh, src/scripts/ops/Minter.s.sol, src/scripts/ops/Roles.s.sol
Refactored to derive chain from block.chainid and load environment dynamically; removed explicit RPC_URL/CHAIN dependencies in favor of --chain/--ledger parameters; added Anvil fork support and Ledger signing workflow.
GitHub Actions & CI
.github/workflows/*.yml, foundry.toml, package.json, remappings.txt
Consolidated dependency installation steps with explicit pnpm install and build stages; updated safe-utils (0.0.13→0.0.17) and solidity-http (0.0.6→0.0.7) dependencies; added multisig profile; refactored npm scripts for expanded glob patterns and new anvil:fork command.
Emergency Shutdown Infrastructure
documentation/emergency/EMERGENCY_SHUTDOWN.md, documentation/emergency/emergency-config.json, documentation/emergency/emergency-config.schema.json, documentation/emergency/emergency-abis.json, .github/workflows/validate-emergency-config.yml, shell/validate-emergency-config.js
Comprehensive emergency configuration system: schema-validated JSON structure defining per-chain emergency multisigs, contract addresses, and parameterized shutdown procedures; validation script with integrity checks (semver, ABI references, component coverage); automated CI workflow with uncommitted-changes detection.
Proposal Execution Updates
src/proposals/ProposalScript.sol, src/scripts/proposals/executeOn*.sh, src/scripts/proposals/submitProposal.sh, src/scripts/proposals/printInputs.sh, src/scripts/ops/OlyBatch.sol, src/scripts/ops/lib/BatchScriptV2.sol
Added Anvil fork execution path alongside Tenderly; refactored proposal scripts to use consolidated argument loading and chain-based RPC; enhanced BatchScriptV2 with post-batch validation selectors, fork-mode dispatching, and snapshot-based simulation.
LLM/Agent Guidance & Configuration
AGENTS.md, CLAUDE.md, .claude/commands/update-emergency-config.md, .claude/skills/lint-fix/SKILL.md, .claude/skills/test-debug/SKILL.md, .claude/skills/test-write/SKILL.md, .claude/skills/test-write/SAMPLE_TEST.md, .mcp.json, .gitignore
Comprehensive agent guidelines covering project overview, development workflow, testing disciplines, safety/permissions, code standards, and tool usage; skill definitions for emergency config updates, linting, testing, and debugging; MCP server configuration for GitHub/Etherscan/Context7 integration; updated .gitignore to track .claude/ and agent documentation.
Environment & Deployment Config
src/scripts/env.json, deployments/.mainnet-*.json, src/scripts/deploy/savedDeployments/v1_migrator.json, src/proposals/addresses.json, conductor.json
Added tempOHM, legacy OHMv1, migration contracts, and updated staking/treasury addresses; saved deployment manifests and script addresses for migration contracts; new conductor.json with test/setup scripts.
Documentation
audit/2026-01_v1-migrator/README.md, documentation/V1_MIGRATOR.md, documentation/FORK.md, src/scripts/DEPLOY_TESTNET.md, src/scripts/REPLACE_STAKING.md, src/scripts/ops/README.md
Audit documentation detailing V1Migrator architecture, merkle verification, and governance flow; user-facing V1Migrator guide; fork testing workflow; testnet deployment and staking-replacement procedures; updated ops README for new --function/--fork/--ledger workflow.
Test Infrastructure & Mocks
src/test/mocks/MockGohm.sol, src/test/mocks/MockStakingForZD.sol, src/test/external/ClaimTransfer.t.sol, src/test/policies/Burner.t.sol, src/test/policies/EmissionManager.t.sol, src/test/policies/pOLY.t.sol
Updated MockGohm with mutable index and setter; added staking interface stubs; expanded test scaffolding for Burner with disabled-state tests; added sOHM getter to mock contracts for interface alignment.
Anvil Utilities
shell/anvil/deal_gohm.sh, shell/anvil/warp.sh
New shell utilities for local fork testing: deal_gohm automates gOHM distribution and voting delegation; warp mines blocks on Anvil.
Postinstall & Build
shell/postinstall.sh, README.md
Removed dependency installation from postinstall (now handled in workflows); updated README with explicit pnpm install and forge/pnpm build instructions.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through migration paths so grand,
Where v1 meets v2 in merkle-tree command;
Emergency configs keep the protocol sound,
While agents guide scripting on every ground!
From Anvil to Tenderly, fork tests run free—
This refactor's a feast, hoppy coding spree! 🥕

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

@0xJem
0xJem merged commit 916a753 into master Mar 10, 2026
9 of 10 checks passed
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