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 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.
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 can use the
DeployContract
action after the account has been created (if the account is being created during that receipt thenDeployContract
is allowed to be part of the batch). But the initial implementation attempted to push theDeployContract
action directly, causing anActorNoPermission
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.