Skip to main content

Smart Contract Upgrade/Migrate

SmartMuv revolutionizes smart contract upgrades and migrations by eliminating the need for pre-deployment modifications. It ensures seamless state variable association and enables effortless migration between blockchains, including EVM and non-EVM platforms.

Smartmuv

Smart Contract Upgrade

Upgrading smart contracts is a critical yet challenging task. Existing tools like EVM Patch and OpenZeppelin enable smart contract code modification to make contracts upgradable. These tools are useful if the smart contract is patched before deployment. However, they do not address upgrading deployed contracts while preserving state variable associations.

Data-Logic Separation and Delegate-Call Proxies are other recommended techniques for upgrading smart contracts. Data-logic separation involves using one contract for data (state variables) and another for logic (operations). This method works well for basic variables but becomes complex with intricate data structures. It also makes state variables non-private, increasing security risks.

Delegate-call proxies separate data and logic into two contracts. Instead of the logic contract pointing to the data contract, the data contract holds a pointer to the logic contract and executes its code using delegate calls. Delegate calls allow one contract to run another's code while retaining the caller’s context, including storage. This method requires careful implementation to ensure consistent memory layouts and compiler upgrades.

Both techniques are complex, error-prone, and typically applied before contract deployment, offering no post-deployment solutions on the Ethereum mainnet.

In contrast, SmartMuv provides a seamless upgrade solution without requiring any changes to the smart contract source code or pre-deployment prerequisites. It only needs the contract's source code and can return the state in seconds. This innovative approach simplifies the upgrade process, making it more efficient and less error-prone.

Smart Contract Migration

Smart contract migration involves transferring contracts from one blockchain to another. This process is necessary for various reasons, such as enhancing performance or leveraging better features on another platform. Bandra et al. discuss scenarios for cross-platform dApp migration, emphasizing the need for state extraction to maintain application state. One common case is migrating from Ethereum to other EVM-compatible blockchains by packing the contract’s source code and state.

Tools like Sol2Js convert Solidity smart contracts to Hyperledger JavaScript chain code but fail to migrate the storage state. SmartMuv fills this gap by extracting and packing the storage state of all variables in Ethereum contracts, enabling resurrection on the target blockchain with minimal developer effort. This task is complex due to differences in data structures between Ethereum and other platforms.

VeriSmart migrates the state and logic of Ethereum contracts across EVM-supported blockchains by extracting and redeploying bytecode. It calculates state differences for each transaction but doesn't map state variables to their values. Therefore, it struggles with modified data models during upgrades.

Existing techniques for scalability and interoperability require implementing a "moving technique" before deployment, demanding detailed EVM and Solidity knowledge. These methods require consistent data models, limiting their usefulness for contracts needing storage structure modifications.

SmartMuv aims to simplify the extraction of deployed contract storage states with minimal effort. Basic state variable extraction is straightforward, but mapping data structures pose challenges due to the need for hash calculations combining slot numbers and keys. Keys are not stored and must be obtained from the user or during contract execution. SmartMuv addresses this challenge by reliably extracting mapping keys and their values, offering a substantial solution that other tools lack.