-
Notifications
You must be signed in to change notification settings - Fork 10
Migration Guide
Table of Contents
This guide provides instructions for upgrading to the Nexus protocol from any upgradable smart contract. It includes general steps for the upgrade process and specific guidance for users migrating from Biconomy Smart Account V2 to Nexus.
Upgrading to Nexus involves replacing the current smart contract implementation with the Nexus implementation. This ensures that your smart contract benefits from Nexus's enhanced functionality, security, and modular architecture.
-
Prepare the Upgrade:
- New Implementation Address: Obtain the address of the Nexus implementation contract.
- Initialization Data: Prepare any initialization data required by the new implementation.
-
Call the Upgrade Function:
-
Function to Use: Use a function like
upgradeToAndCall
to initiate the upgrade process. - Parameters: Provide the new implementation address and any initialization data.
-
Function to Use: Use a function like
-
Verify the Upgrade:
- Ensure the upgrade was successful by verifying the new implementation address and testing critical functionalities.
Important
Always verify the new implementation address and initialization data to prevent any security risks or functionality issues.
It’s essential to perform thorough testing to ensure the new implementation functions correctly. Testing should include:
- Functionality Tests: Verify that all critical functions work as expected.
- Security Tests: Ensure no new vulnerabilities have been introduced.
- Performance Tests: Confirm that performance metrics meet expectations.
Tip
Use automated test scripts to streamline the testing process and ensure consistency.
Warning
When upgrading from a non-ERC7579 compatible smart account, you will lose access to the modules already installed. You will need to install them manually or through the migration process when calling the upgradeToAndCall
function.
Important
At all times, a validation module should be present in the Nexus smart account.
For users migrating from Biconomy Smart Account V2, additional steps and specific guidance are provided.
-
Retrieve the New Implementation Address:
- Obtain the Nexus implementation contract address from the official Nexus repository or documentation.
-
Upgrade Function:
- Use the
updateImplementation
function on your Biconomy Smart Account V2 contract. - Example call:
updateImplementation(newImplementation)
- Use the
-
Initialization:
- Ensure that the new implementation is initialized with the necessary data.
- Call
initializeAccount
with appropriate initialization data.
Tip
You can find an example in our Foundry test here: ArbitrumSmartAccountUpgradeTest.t.sol and here: UpgradeSmartAccountTest.t.sol.
When upgrading from Biconomy Smart Account V2 to Nexus, the initialization data should include the following:
-
Validators: Addresses and initialization data for validator modules.
- Example: Use
BootstrapLib.createArrayConfig
to prepare the validators configuration.
- Example: Use
-
Hook: Configuration for the hook module.
- Example: Use
BootstrapLib.createSingleConfig
for the hook module.
- Example: Use
The initialization data is prepared using the BOOTSTRAPPER
utility, ensuring the new Nexus account is correctly configured with the required modules and validators.
- Backward Compatibility: Ensure that the new implementation maintains compatibility with existing data and functionality.
- Data Migration: Migrate any necessary data to the new implementation if required.
Caution
Ensure you test the upgrade process in a controlled environment before applying it to production to avoid any potential disruptions.
The Nexus SDK simplifies the upgrade process with streamlined methods for direct upgrades and validation tools. The SDK supports:
- Direct Upgrade: Simplified methods to call upgrade functions with the required parameters.
- Validation Tools: Tools to verify the successful upgrade and initialization.
Note
The Nexus SDK is still under development. Always perform upgrades in a controlled environment and thoroughly test all functionalities before deploying to production.
Upgrading to Nexus enhances your smart contract with improved security, modularity, and functionality. Follow the outlined steps and utilize the Nexus SDK for a smooth and secure migration process. For further information and access to the SDK, please refer to the Nexus GitHub repository.
- Home
- Nexus Architecture
- Access Control
- Execution Framework
- Modules
- Factories
- Migration Guide
- Testing Documentation
- Configuration and Security
- Libraries
- FAQ
- Biconomy Solidity Style Guide
- Security Considerations
- Team
-
Contracts
- Nexus
- Base
- Common
- Factory
- AbstractNexusFactory
- BiconomyMetaFactory
- K1ValidatorFactory
- ModuleWhitelistFactory
- NexusAccountFactory
- Modules
- Utils