Move.

帖子

分享您的知识。

farshad.
Feb 13, 2025
专家问答

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
0
1
分享
评论
.

答案

1
Forever_A-gator.
Feb 13 2025, 11:09

你不能在 SUI Move 软件包升级中直接更改函数签名. 相反,您可以添加具有所需签名和逻辑的新函数,但不能删除旧函数. 升级不支持删除或更改现有函数签名,因为这可能会破坏与依赖于旧函数定义的现有包或数据的兼容性. 一个有用的解决方法是创建一个包含新功能的辅助函数或包装器. 查看有关 SUI Move 软件包升级的官方文档以获取更多指导:https://docs.sui.io/concepts/sui-move-concepts/packages/upgrade#upgrade-requirements

1
评论
.

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息