Skip to content

feat: add announcePlannedUpgrade flow for ServiceProviderRegistry#356

Merged
wjmelements merged 4 commits intoFilOzone:mainfrom
Chaitu-Tatipamula:feat/announce-planned-upgrade
Nov 26, 2025
Merged

feat: add announcePlannedUpgrade flow for ServiceProviderRegistry#356
wjmelements merged 4 commits intoFilOzone:mainfrom
Chaitu-Tatipamula:feat/announce-planned-upgrade

Conversation

@Chaitu-Tatipamula
Copy link
Contributor

@Chaitu-Tatipamula Chaitu-Tatipamula commented Nov 26, 2025

Summary

This PR covers the ServiceProviderRegistry side of FS #355 by adopting the announcePlannedUpgrade pattern already used by FilecoinWarmStorageService. PDPVerifier changes are implemented in a separate PR in pdp and are not included here.

Changes

ServiceProviderRegistry contract

  • Add PlannedUpgrade struct and nextUpgrade storage field
  • Add UpgradeAnnounced(PlannedUpgrade) event
  • Implement:
    • announcePlannedUpgrade(PlannedUpgrade plannedUpgrade) — owner-only, validates code size and afterEpoch > block.number, stores the plan and emits UpgradeAnnounced
    • getNextUpgrade() returns (address nextImplementation, uint96 afterEpoch) — exposes the planned upgrade via the proxy
  • Update _authorizeUpgrade(address newImplementation) to:
    • Require newImplementation == nextUpgrade.nextImplementation
    • Require block.number >= nextUpgrade.afterEpoch
    • Clear the stored plan on successful upgrade
  • Update migrate(string newVersion) to:
    • public onlyProxy onlyOwner reinitializer(2)
    • Emit ContractUpgraded(newVersion, ERC1967Utils.getImplementation())

Upgrade scripts

  • Add tools/announce-planned-upgrade-registry.sh
    • Announces a planned upgrade for a ServiceProviderRegistry proxy using announcePlannedUpgrade((address,uint96))
  • Add tools/upgrade-registry.sh
    • Reads getNextUpgrade() from the registry proxy
    • Verifies the planned implementation and afterEpoch
    • Calls upgradeToAndCall(address,bytes) with migrate(string) and the desired version
    • Verifies the final implementation using the standard ERC-1967 implementation slot
      (0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)

Tests

  • Extend ServiceProviderRegistryTest to cover:
    • testAnnouncePlannedUpgrade — happy-path announce and gated upgrade flow
    • testAnnouncePlannedUpgradeOnlyOwner — only the owner can announce
    • testAnnouncePlannedUpgradeInvalidImplementation — revert on non-contract implementation
    • testAnnouncePlannedUpgradeInvalidEpoch — revert when afterEpoch <= block.number
    • testOnlyOwnerCanUpgrade — validates that:
      • Non-owner upgrades revert
      • Owner can upgrade after a valid announcement and epoch gating

Closes : #355

@FilOzzy FilOzzy added this to FOC Nov 26, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Nov 26, 2025
@Chaitu-Tatipamula Chaitu-Tatipamula changed the title feat: add announcePlannedUpgrade flow for ServiceProviderRegistry (FS #355) feat: add announcePlannedUpgrade flow for ServiceProviderRegistry Nov 26, 2025
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feat/announce-planned-upgrade branch from 6244630 to 277127f Compare November 26, 2025 14:38
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feat/announce-planned-upgrade branch from 277127f to e915931 Compare November 26, 2025 14:43
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Nov 26, 2025
@rjan90 rjan90 requested a review from wjmelements November 26, 2025 16:26
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ⌨️ In Progress in FOC Nov 26, 2025
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feat/announce-planned-upgrade branch from 8da6ef3 to 9994318 Compare November 26, 2025 20:32
- made nextUpgrade public removed the getter
- reverted the one-step process only have the 2 step mechanism
- some fixes in scripts
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feat/announce-planned-upgrade branch from 9994318 to fa8092c Compare November 26, 2025 20:34
@github-project-automation github-project-automation bot moved this from ⌨️ In Progress to ✔️ Approved by reviewer in FOC Nov 26, 2025
@wjmelements wjmelements added the enhancement New feature or request label Nov 26, 2025
@wjmelements wjmelements merged commit 55e6e67 into FilOzone:main Nov 26, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

feat: announcePlannedUpgrade

2 participants