Module code.move
This module exposes functions that allow to publish and upgrade other modules.
Function: set_allowed_publishers
This function can only be called by the special @initia_std
address. It can be used to set the allowlist of addresses that are allowed to publish new modules.
Inputs
chain: &signer
Validation: Must be
@initia_std
.Impact: Used to verify the call is authorized.
allowed_publishers: vector<address>
Validation: If empty, publishing is not restricted; otherwise, the list must contain
@initia_std
.Impact: List of allowed publishers.
Function: publish
This function can be used by an allowed publisher to publish or upgrade a module.
Inputs
owner: &signer
Validation: Must be an authorized publisher and the owner of the module.
Impact: Used to authorize the operation.
module_ids: vector<String>
Validation: Must match the IDs of the modules provided in the
code
argument.Impact: Used to efficiently check the modules upgrade policy.
code: vector<vector<u8>>
Validation: Must be a valid module, and the IDs much match with
module_ids
.Impact: The code of the modules to be published or upgraded.
upgrade_policy: u8
Validation: Must be greater than zero. Could be further restricted to be at most two (not and exploitable issue). Must be compatible with the existing upgrade policy if upgrading a package.
Impact: New upgrade policy for the published packages.