Abstract
Perform an test upgrade on a testnet deployment of Sui Lazer contract to ensure that the process works correctly.
The update itself only changes the included version number - goal is to test whether the contract can successfully execute governance action.
Rationale
Sui Lazer contract only allows maintenance through Wormhole’s Verified Action Approvals (VAAs) tied to specific emitter address and chain. We’ve tested the process with dummy emitter tied to ordinary wallet, but this flow doesn’t test implementation of proposal submitting and execution.
Description
Proposal should emit a single Wormhole message targeted to Sui chain, with update version 2 and digest of build of current version of the contract, with slight modification (see below), available after this commit in pyth-crosschain repository: https://github.com/pyth-network/pyth-crosschain/commit/d6dd7841edfd9fd4925b3b5477aa28c212968133
Implementation plan
-
Contract implementation: https://github.com/pyth-network/pyth-crosschain/tree/d6dd7841edfd9fd4925b3b5477aa28c212968133/lazer/contracts/sui
-
Proposal ID: 8tLtUiWjJ4jn8u4RwDuHjqBc3L6wLwhQC8iXDfT2FSq2
Proposal verification
suiup install sui
- Clone the
pyth-crosschainrepository and buildcontract_manager:
git clone https://github.com/pyth-network/pyth-crosschain.git
cd pyth-crosschain/contract_manager
pnpm install && pnpm turbo build
- Modify
pyth-crosschain/lazer/contracts/sui/sources/pyth_lazer.moveby appending the following lines (used to avoid accidental use of this proposal on mainnet):
public struct ThisIsATestContractMeantForTestnetOnly {}
- Temporarily modify the
pyth-crosschain/contract_manager/check_proposal.tsscript to check the testnet contract instead of a mainnet one:
@@ -248,7 +248,7 @@ async function main() {
console.log(`Verifying UpgradeSuiLazerContract on '${targetChainId}'`);
if (targetChainId === "sui") {
- const chain = DefaultStore.chains.sui_mainnet;
+ const chain = DefaultStore.chains.sui_testnet;
if (!(chain instanceof SuiChain)) {
console.error("Could not find valid Sui mainnet chain in store");
@@ -260,9 +260,13 @@ async function main() {
"../../lazer/contracts/sui",
);
- const contracts = Object.values(DefaultStore.lazer_contracts)
- .filter((c) => c instanceof SuiLazerContract)
- .filter((c) => c.chain.isMainnet());
+ const contracts = [
+ new SuiLazerContract(
+ chain,
+ "0x219e26647e9e54d3915f82aeeabfbd1f008929c60ca12181a5eb5e3236848db3",
+ "31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",
+ ),
+ ];
if (contracts.length === 0) {
console.error("Could not find valid Sui Lazer contract in store");
- Within
pyth-crosschain/contract_managerdirectory, run thecheck_proposalscript:
pnpm tsx scripts/check_proposal.ts --cluster mainnet-beta --proposal 8tLtUiWjJ4jn8u4RwDuHjqBc3L6wLwhQC8iXDfT2FSq2