Post
Share your knowledge.
How to handle function signature changes in SUI Move Package
I'm working on a SUI Move package and encountered an error when I tried to change a function signature. The error message is 'PackageUpgradeError { upgrade_error: IncompatibleUpgrade }'. How can I upgrade the package with the new function signature without causing errors?
- Move CLI
Answers
1You can't make changes to function signatures directly in a SUI Move package upgrade. Instead, you can add a new function with the desired signature and logic but you cannot remove the old function. Removing or changing existing function signatures isn't supported for upgrades, as this could break compatibility with existing packages or data dependent on the old function definitions. A useful workaround is to create a helper function or wrapper that includes the new functionality. Check the official documentation on SUI Move package upgrades for further guidance: https://docs.sui.io/concepts/sui-move-concepts/packages/upgrade#upgrade-requirements
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.