Skip to content

Conversation

@jayantk
Copy link
Contributor

@jayantk jayantk commented Dec 29, 2022

Add the code for upgrading the contract and patch up the deployment script so it works on the new Terra network.

I haven't tested the upgrade process yet, as it's hard to do with the current deployment tools. I'll do some more work on the deployment process and then circle back to testing upgrades.

/// this function can safely be implemented as:
/// ```ignore
/// Ok(Response::default())
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure if there's a difference between ::new and ::default, but wormhole is using ::default)

"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"deploy-pyth": "node deploy-pyth-bridge.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the README claims this command exists, but it doesn't for whatever reason.

Err(PythContractError::InvalidGovernancePayload)?
}

// Hack: We're using the first 8 bytes of the address field as the new code id.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the inconsistency here.. for this one aptos uses 32 bytes and Eth uses 20 bytes. I think it is fine to define the governance instruction to use only 8 bytes instead of getting a prefix of a longer address.

Although not used anywhere, you will need to define it here too (for scripts/tools that manage deployments):
https://github.com/pyth-network/pyth-crosschain/blob/main/third_party/pyth/xc-governance-sdk-js/src/instructions.ts#L103-L121

},
governance_source_index: 0,
governance_sequence_number: 0,
chain_id: 18,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this pr, can we query this from wormhole contract instead of manually specifying it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this as part of the cleanup PR before. Unfortunately wormhole doesn't expose a query for it. We could read it out of their config struct, but that felt a little hacky. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we could add support to it to the wormhole contract?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok never mind then 😅 second one is good but it takes time for wh to merge and then deploy it. let's stick to this one 😅

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments about the upgrade payload (and adding it to the js sdk). I do not fully know general cosmos and terra differences and I have a question before approving this one: Don't we need to change the admin of the contract to itself? If so, can we add that to the deploy script? iirc we cannot know the contract address before instantiation and it should be a separate message.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 it ser

@jayantk jayantk merged commit cdf99f4 into main Dec 30, 2022
@jayantk jayantk deleted the cw_upgrade2 branch December 30, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants