strangelove-ventures / wormhole

SL fork for wormhole dev work.
https://wormhole.com
Other
1 stars 0 forks source link

🟦 EPIC: `IBC` and `IBC Receiver` contracts should have tests #42

Open kakucodes opened 4 months ago

kakucodes commented 4 months ago

description of the use of the ibc and ibc receiver contracts here: https://github.com/wormhole-foundation/wormhole/blob/dc3a6cf804137525239dbdb69cd56687322f8d50/whitepapers/0012_ibc_generic_messaging.md

### Tasks
- [x] render the wasm binaries
- [x] generate the contract types
- [x] upload the files
- [x] create the channel
- [x] figure out how the gov'ce structures are connected
- [x] Create helpers for `ChainUpgrade` and `IbcReceiverUpdateChainConnections`
- [x] Add helper for `execute-governance-vaa` command
- [x] `ContractUpgrade` the core contract/sender contract to wormhole-ibc-receiver
- [x] `ContractUpgrade` the wormhole contract
- [x] Evaluate gov vaa relaying (spy vs manual/ad hoc)
- [x] https://github.com/strangelove-ventures/wormhole/issues/71
- [ ] https://github.com/strangelove-ventures/wormhole/issues/73
- [x] add the `IbcReceiverUpdateChainConnection` vaa
- [ ] https://github.com/wormhole-foundation/wormhole/pull/4121
- [x] add the channel id to the remote contact
- [ ] https://github.com/strangelove-ventures/wormhole/issues/91
- [ ] https://github.com/strangelove-ventures/wormhole/issues/92
- [x] https://github.com/strangelove-ventures/wormhole/issues/96
- [ ] https://github.com/strangelove-ventures/wormhole/issues/98
kakucodes commented 3 months ago

RE governance vaa learnings: some background can be gleaned here https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0002_governance_messaging.md

list of available modules https://github.com/wormhole-foundation/wormhole/blob/main/sdk/vaa/payloads.go#L15 list of payloads https://github.com/wormhole-foundation/wormhole/blob/main/sdk/vaa/payloads.go#L117

for this task we need BodyContractUpgrade and IbcReceiverUpdateChannelChain

jonathanpberger commented 3 months ago

blocked on #58

jonathanpberger commented 3 months ago

Q: "Is there a repo of sample VAAs that I can look at?" A: The VAAs are public, but you need to know the hash. There's an internal repo of all gov'ce comms, but the best option here is to ask in slack

It's complaining about bech32. @nik-suri sez there's a special way to encode. @kakucodes will post the command to slack and @nik-suri will help direct him from there

kakucodes commented 3 months ago

nikhil explained today that for all governance vaas manual/adhoc relaying is used so that is what i'll implement for this set of tests

https://strangeloveventures.slack.com/archives/C057DTCM76G/p1722606186283359

kakucodes commented 2 months ago

WIP diagramming as i've been debugging through the gov vaa encoding/decoding flow

---
title: Governance VAA Lifecycle
---
flowchart TD

    subgraph Encode 
        WormchainStoreContract --> ContractCodeId["Contract Code Id"]
        ContractCodeId .-> |"uint64 -> little endian byte order [32]byte"|CodeIdByteArray["[32]byte Representation of Code Id"]
        CodeIdByteArray --> SubmitContractUpgradeGovernanceVAA["helpers.SubmitContractUpgradeGovernanceVAA"]
        SubmitContractUpgradeGovernanceVAA .-> |"template into vaa.BodyContractUpgrade\n\nvaa.Serialize()\n\ngenerateGovernanceVaa\n\nmarshal vaa\n\nhex.EncodeToString"|WormchaindEncode["node.ExecTx/Wormchaind"]
    end

    subgraph Decode
    Wormchaind["wormchaind wormhole execute-governance-vaa [vaa]"] -->
         CmdExecuteGovernanceVAA
    CmdExecuteGovernanceVAA .-> |"hex.DecodeString\n\ntypes.NewMsgExecuteGovernanceVaa"|ExecuteGovernanceVAA
    ExecuteGovernanceVAA .-> |"ParseVAA - unmarshalling"|WormholeKeeper["keeper.VerifyGovernanceVaa"]
    WormholeKeeper .-> |"keeper.verifyVAA\n\naction = v.Payload[32]"|End[" "]
    end

    WormchaindEncode --> Decode
kakucodes commented 2 months ago

had a breakthrough in progress with evan redirecting me with how the gov vaas for core upgrades and ibc receiver update channel chains should be handled.

the tldr is that coreupgrade is meant to be triggered not explicitly as a gov vaa but instead using tx wormhole migrate and the ibcreceiverupdatechannelchains should be executed by executing the contract in question directly using the submit_v_a_a method.

more can be read here

jonathanpberger commented 2 months ago

@nik-suri sez "maybe share the mermaid in #wormhole-dev slack channel" in case it's useful to anyone else