8. FHE UpgradeFHE Engine Upgrade & Migration

8. FHE Engine Upgrade & Migration

On April 27, 13:00 - 16:00 UTC, Fhenix will execute a critical upgrade of the underlying Fully Homomorphic Encryption (FHE) engine to improve performance, efficiency, and long-term compatibility. This upgrade includes a non-backward compatible ciphertext state migration, requiring all developers to update their applications within the specified maintenance window.

This section documents the upgrade procedure, migration paths, breaking changes, and emergency protocols to ensure zero downtime for Fhenix-FairMarket and other dependent applications.

Quick Summary

  • Upgrade Window: April 27, 13:00 - 16:00 UTC (3-hour maintenance window)
  • Target Version: @cofhe/sdk / cofhejs v0.5.0
  • Breaking Change: Non-backward compatible ciphertext state migration
  • Action Required: All applications must upgrade within the window
  • Risk: Upgrading before or after the window will cause downtime and ciphertext incompatibility

Detailed Answer (Cited)

8.1. Upgrade Objectives & Technical Improvements

The FHE engine upgrade addresses three critical areas:

ObjectiveTechnical ImplementationImpact
PerformanceOptimized FHE circuit evaluation, reduced ciphertext expansion40-60% faster encryption/decryption cycles
EfficiencySmaller ciphertext size, reduced memory footprintLower gas costs for on-chain operations
Long-term CompatibilityStandardized ciphertext format aligned with ZK-proof systemsFuture-proof integration with EigenLayer AVS and Layer 2 rollups

8.2. Breaking Changes & Migration Paths

Non-Backward Compatible Ciphertext Migration

The v0.5.0 engine introduces a new ciphertext serialization format. Ciphertexts generated with v0.4.x or earlier will not be compatible with v0.5.0, requiring migration.

Migration Path by Current Version:

Current VersionMigration StepsComplexity
v0.4.0+1. Wait for upgrade window
2. Update package.json: "@cofhe/sdk": "^0.5.0"
3. Reinstall dependencies
4. No code changes required
Simple
v0.3.x or older1. Follow legacy migration guide
2. Update to v0.4.0 first
3. Then upgrade to v0.5.0 during window
4. Test ciphertext serialization
Moderate
Production with active auctions1. Complete all active auctions before window
2. Or migrate ciphertexts using migration utility
3. Coordinate with Fhenix team for custom migration script
Critical

8.3. Fhenix-FairMarket Impact Assessment

Critical Components Requiring Updates

// packages/frontend/package.json (UPDATE REQUIRED)
{
 "dependencies": {
 "@cofhe/sdk": "^0.5.0", // WAS: ^0.4.0
 "@fhenixprotocol/cofhe-contracts": "^0.5.0" // WAS: ^0.4.0
 }
}
 
// packages/contracts/package.json (UPDATE REQUIRED)
{
 "devDependencies": {
 "@cofhe/hardhat-plugin": "^0.5.0" // WAS: ^0.4.0
 }
}

State Migration for Active Auctions

If Fhenix-FairMarket has active auctions during the upgrade window, the following migration procedure applies:

  1. Pre-Window (April 26):
  • Pause new auction creation 24 hours before window
  • Notify users of scheduled maintenance
  • Export all active ciphertext states to migration format
  1. During Window (April 27, 13:00-16:00 UTC):
  • Fhenix team executes ciphertext state migration
  • Upgrade SDK to v0.5.0
  • Run migration validation tests
  • Verify FHE.lte() and FHE.select() operations
  1. Post-Window (April 27, 16:00+ UTC):
  • Resume auction creation
  • Monitor for ciphertext serialization errors
  • Activate emergency rollback if migration fails

8.4. Testing & Validation Checklist

Before and after the upgrade, execute the following validation suite:

# Pre-upgrade validation (April 26)
npx hardhat test --grep "FHE encryption"
npm run test:e2e -- --grep "bid submission"
 
# Post-upgrade validation (April 27, 16:00+ UTC)
npx hardhat test --grep "FHE v0.5.0 compatibility"
npm run test:integration -- --grep "ciphertext migration"
 
# Critical test cases
 encryptBid() produces valid v0.5.0 ciphertext
 FHE.lte(encryptedBid, escrowBalance) executes without error
 FHE.select() constant-time execution verified
 Ciphertext hash matches expected v0.5.0 format
 Auction settlement completes with migrated ciphertexts

8.5. Emergency Rollback Procedure

If the upgrade causes critical failures, the following rollback protocol applies:

ScenarioRollback ActionTimeline
Ciphertext serialization failureRevert to v0.4.0 SDK, restore pre-migration state< 30 minutes
FHE operation timeoutDisable CoFHE processing, activate Dynamic Dead Man's Switch< 1 hour
State corruptionRestore from pre-upgrade snapshot, notify users of 24h delay< 4 hours

Rollback Commands:

# Emergency SDK rollback
npm install @cofhe/sdk@0.4.0 @fhenixprotocol/cofhe-contracts@0.4.0
 
# Restore pre-migration state (admin only)
npx hardhat restore-state --network fhenix-mainnet --snapshot pre-upgrade-2024-04-27

Confirmed Facts

  1. Upgrade Window is Fixed: April 27, 13:00 - 16:00 UTC. No extensions planned.
  2. Non-Backward Compatible: Ciphertexts from v0.4.x will not work with v0.5.0 without migration.
  3. Timing is Critical: Upgrading before or after the window will cause downtime and incompatibility.
  4. Simple Migration for v0.4.0+: Only requires package.json version bump, no code changes.
  5. Legacy Versions Require Extra Steps: v0.3.x and older must follow migration guide first.

Unresolved Points & Explicit Gaps

Gap / Unresolved PointImpactCurrent StatusRecommended Action
Active Auction HandlingWhat happens to bids submitted during the 3-hour window?Not explicitly documented in announcement.Pause auction creation 24h before window; complete all active auctions or migrate ciphertexts.
Rollback SLAWhat is the guaranteed rollback time if migration fails?Announcement mentions downtime risk but no SLA.Coordinate with Fhenix team to establish < 1 hour rollback guarantee for critical failures.
Gas Cost ImpactWill the new FHE engine reduce gas costs for placeBid()?Performance improvements mentioned but no specific gas benchmarks.Run gas profiling tests post-upgrade to quantify cost reduction for user communication.
Testnet StagingWas the upgrade tested on Fhenix Testnet before mainnet deployment?No mention of testnet validation in announcement.Request testnet migration logs and validation reports from Fhenix team before mainnet window.
Cross-Protocol DependenciesDo EigenLayer AVS operators need to upgrade simultaneously?Announcement focuses on SDK but AVS integration may require coordination.Confirm with EigenLayer AVS team whether operator nodes require simultaneous upgrade.

Fact vs. Analysis Distinction: The upgrade window (April 27, 13:00-16:00 UTC), version requirement (v0.5.0), non-backward compatibility, and migration paths are verified facts from the official Fhenix announcement. Active auction handling, rollback SLA, gas cost impact, testnet staging, and cross-protocol dependencies are unresolved operational gaps requiring explicit coordination before the upgrade window.


Sources (Official Documentation References)

  1. Fhenix Discord Announcementdev-updates channel (April 2024)
  2. Migration Guidehttps://cofhesdk.fhenix.io/migrating-from-cofhejs
  3. Fhenix-FairMarket Whitepaper v2.0 → Section 2.1 (FHE Cryptography)
  4. Technical Specification v2.0 → Section 4.1 (CoFHE Integration)
  5. Phase 3 Sub-Tasks Matrix → Task 3.2 (FHEOS Integration)

Next Steps

  • Immediate (Before April 27): Complete all active auctions or prepare ciphertext migration scripts
  • During Window (April 27, 13:00-16:00 UTC): Update @cofhe/sdk to v0.5.0, run validation tests
  • Post-Upgrade (April 27, 16:00+ UTC): Monitor for errors, resume normal operations, document lessons learned
  • Contingency: If rollback required, execute emergency procedure within 30 minutes and notify users

Developer Action Items

Before April 27 (Pre-Upgrade)

  • [] Audit all @cofhe/sdk and cofhejs dependencies across projects
  • [] Complete or pause active auctions in Fhenix-FairMarket
  • [] Backup ciphertext state database
  • [] Test upgrade on local environment with v0.5.0 SDK
  • [] Notify users of scheduled maintenance window

During April 27, 13:00-16:00 UTC (Upgrade Window)

  • [] Update package.json: "@cofhe/sdk": "^0.5.0"
  • [] Run npm install or pnpm install
  • [] Execute migration validation tests
  • [] Verify FHE operations (encrypt, lte, select)
  • [] Monitor Fhenix Discord for real-time updates

After April 27, 16:00+ UTC (Post-Upgrade)

  • [] Resume auction creation and bid submission
  • [] Monitor logs for ciphertext serialization errors
  • [] Run integration test suite
  • [] Document any issues or performance improvements
  • [] Update internal documentation with v0.5.0 changes

Critical Reminder: Only upgrade during the specified window. Upgrading before or after will cause downtime and ciphertext incompatibility with the Fhenix network.