Skip to content

feat(fleet-identity): add version() function for upgrade verification#108

Merged
aliXsed merged 1 commit intomainfrom
aliX/add-contract-version
Apr 10, 2026
Merged

feat(fleet-identity): add version() function for upgrade verification#108
aliXsed merged 1 commit intomainfrom
aliX/add-contract-version

Conversation

@aliXsed
Copy link
Copy Markdown
Collaborator

@aliXsed aliXsed commented Apr 10, 2026

Overview

Add a version() function to FleetIdentityUpgradeable to enable reliable post-upgrade verification.

Changes

  • Added version() function to FleetIdentityUpgradeable.sol returning "1.0.0"

    • Marked as virtual to allow overriding in upgraded implementations
    • Industry-standard pattern for upgrade verification (used by OpenZeppelin Governor, Safe, Compound)
  • Updated test mocks to override with appropriate versions

    • V2 mock returns "2.0.0"
  • Added comprehensive tests

    • test_FleetIdentity_Version — verifies base contract returns "1.0.0"
    • test_FleetIdentity_VersionChangesAfterUpgrade — confirms proxy reflects new version after upgrade

Testing

All 20 upgrade tests pass, including new version verification tests.

Upgrade Verification

After deploying a FleetIdentity upgrade, call:

cast call 0xdd4437A148C828d47B887c11F55e6fE91d06AC4f "version()" --rpc-url "$L2_RPC"

The result should match the new implementation's version string, confirming the upgrade is live and executing new code.

- Add virtual version() returning '1.0.0' to FleetIdentityUpgradeable
- Update V2 mock to override with '2.0.0'
- Add test_FleetIdentity_Version and test_FleetIdentity_VersionChangesAfterUpgrade
- Fix override specifier in TestUpgradeOnAnvil V2 mock
@github-actions
Copy link
Copy Markdown

LCOV of commit fd6e5da during checks #645

Summary coverage rate:
  lines......: 32.2% (777 of 2414 lines)
  functions..: 28.6% (108 of 377 functions)
  branches...: 37.6% (140 of 372 branches)

Files changed coverage rate:
                                                  |Lines       |Functions  |Branches    
  Filename                                        |Rate     Num|Rate    Num|Rate     Num
  ======================================================================================
  src/swarms/FleetIdentityUpgradeable.sol         |96.3%    456|93.8%    64|80.3%     76
  test/upgrade-demo/TestUpgradeOnAnvil.s.sol      | 0.0%    139| 0.0%     6| 0.0%     24
  test/upgradeable/UpgradeableContracts.t.sol     | 0.0%     20| 0.0%     9| 0.0%      2

@aliXsed aliXsed merged commit 6dcb888 into main Apr 10, 2026
3 checks passed
@aliXsed aliXsed deleted the aliX/add-contract-version branch April 10, 2026 02:16
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.

1 participant