-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(xcc): Method in router contract for upgradability (#866)
## Description The initial XCC implementation was meant to allow the contracts deployed to the sub-accounts created by the Engine as part of the XCC flow to be upgradable. However, that upgrade code did not work as intended. The problem is that Near enforces [only an account itself](https://github.com/near/nearcore/blob/83fe943e4e270db87a89535037d2b3a8909a2c6d/runtime/runtime/src/actions.rs#L852) can use the `DeployContract` action after the account has been created (if the account is being created during that receipt then `DeployContract` is allowed to be part of the batch). But the initial implementation attempted to push the `DeployContract` action directly, causing an `ActorNoPermission` error. The correct way to implement an upgrade mechanism is to have the deployed contract contain a method which accepts new code then creates a receipt to itself with the `DeployContract` action. This PR changes the XCC Router contract to include such a method. Unfortunately since V1 XCC Routers did not have any upgrade method, and they have no access keys associated with them, they can never be upgraded. After releasing the V2 Router contract with upgradability we may encourage existing XCC users (for example the fast bridge) to migrate to a new XCC account. ## Performance / NEAR gas cost considerations N/A ## Testing A new integration test for upgrading XCC contracts is included in this PR.
- Loading branch information
Showing
10 changed files
with
357 additions
and
60 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.