Closed tkporter closed 1 year ago
We've so far taken a somewhat top-down approach to adding Sealevel support; the warp UI, hyp-deploy have been updated before the SDK and Utils packages. We can continue that trend with HelloWorld/Kathy or we can make a bigger upfront investment and redesign the SDK+Utils now.
Kathy is built around HelloWorld, which is just a thin wrapper around the App/Deployer/Checker abstractions in the SDK. So updating just HelloWorld to be sealevel compatible wouldn't make sense. Sealevel support for Kathy would require a new, parallel HelloWorld version that live alongside the EVM one.
This option is still less work than Option 2 but feels short-sighted.
Updating the common utilities (e.g. address encoder, msg formatter) and SDK primitives (e.g. MultiProvider, App, Checker, Deployer) feels like a daunting task but also seems like the natural next step for Sealevel support.
I won't lay out a complete plan just yet until we have agreement on this direction but structural changes would include:
The new architecture would ideally be a plugin-like architecture with sub-packages. Something that allows SDK users to bundle only the libs for the environments they care about. Otherwise all EVM-only users would be unintentionally including in large libs for Sealevel (and soon Cosmos).
IMHO, this option is tricky but feasible.
Continuing on the last post above ^, we decided on Discord to try option 1.5. We will not modify existing classes in SDK but we will add new multi-protocol versions (e.g. MultiProtocolProvider
) as needed to get a HelloWorld (and then Kathy) working.
So far I've got a Draft PR open with a new MultiProtocolProvider based partly on the one I made for Warp UI. This introduces a new set of Provider-related types and builders, which allow us to support different libraries (Viem, Ethers6, SolanaWeb3, etc.)
Next I took a stab at a MultiProtocolApp
abstraction today but sadly the concept falls apart almost immediately 😭 . Our HyperlaneApp
is a fancy map, from chain -> contracts. Sealevel's JS lib (solana/web3.js
) doesn't have anything comparable to an Ethers/Viem Contract. Data must be manually (de)serialized with serializers custom defined for each contract. So scrap MultiProtocolApp
I think.
Children Apps like RouterApp add some functionality like fetching ISMs or quoting gas. We'll def still want those features somewhere. Another step down, TokenApp adds a transfer method, i.e. a method to translate a user intent into a tx. Like @yorhodes pointed out last week, this is where the TokenApp overlaps with my ITokenAdapter in the Warp UI:
TokenApp = TokenAdapter + ChainMap<Addresses & Ethers Contracts>
I guess it will need to be something like: MultiProtocolTokenApp = TokenAdapter + ChainMap<Addresses & Desired provider types>
, where the adapter part needs to do more heavy lifting than it does now for non-EVM chains.
I deployed a helloworld program onto solanadevnet - here's the current state of things:
fuji
-> solanadevnet
messages via the rc helloworld router contract are deliverable (i.e. from this one https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/infra/config/environments/testnet3/helloworld/rc/addresses.json#L6). This is just because only fuji validators have been enrolled in the ISM that lives on solanadevnet for now. This is the address of the helloworld contract on solanadevnet https://explorer.solana.com/address/DdTMkk9nuqH5LnD56HLkPiKMV3yB3BNEYSQfgmJHa5i7?cluster=devnet (DdTMkk9nuqH5LnD56HLkPiKMV3yB3BNEYSQfgmJHa5i7
in base58, 0xbba2f483e642449d0a39efe5f9603f7c559423acebd3c854d07560ccd0439228
in hex).0x5983bd101129f7c3d717ad2c7bdb81979cf076e8ace97c2096736a1778e33b0e
that was delivered by this transaction https://explorer.solana.com/tx/vBTHYuhM2BrWQ7ivFFa5AChpsQQyst7CQNAFt1Ntc6ut77RCCVXusWibYFGUXBvScX2MDAoDMC7ooDseU5dss1j?cluster=devnet (https://explorer.solana.com/address/F2Qpm4DrYVoUg6HKT1foQvjcJSxoZqwUdbutcHSwicrQ?cluster=devnet is the relayer address that delivered the message)Wanted to share this stuff ASAP though just to unblock you as much as possible
Here's info on how to get the # of sent or received messages and/or the remote routers:
pub type HelloWorldStorageAccount = AccountData<HelloWorldStorage>;
is what's actually serialized and stored, which inserts that first byte prefix)And to send a hello world message from solanadevnet:
This is the expected instruction data passed in: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/dd7ff727b0d3d393a159afa5f0a364775bde3a58/rust/sealevel/programs/helloworld/src/instruction.rs#L44 (note there is no 8-byte prefix here or anything, unlike the warp routes)
The expected accounts passed in can be found here https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/dd7ff727b0d3d393a159afa5f0a364775bde3a58/rust/sealevel/programs/helloworld/src/processor.rs#L157-L174, for clarity I'll explain each one:
/// 0. [writeable] Program storage.
/// 1. [executable] The Mailbox program.
/// 2. [writeable] Outbox PDA.
/// 3. [] This program's dispatch authority.
/// 4. [executable] System program.
/// 5. [executable] SPL Noop program.
/// 6. [signer] Payer.
/// 7. [signer] Unique message account.
/// 8. [writeable] Dispatched message PDA. An empty message PDA relating to the seeds
/// mailbox_dispatched_message_pda_seeds
where the message contents will be stored.
/// ---- if an IGP is configured ----
/// 9. [executable] The IGP program.
/// 10. [writeable] The IGP program data.
/// 11. [writeable] The gas payment PDA.
/// 12. [] OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP.
/// 13. [writeable] The IGP account.
/// ---- end if an IGP is configured ----
[writeable] Program storage.
- Same as described above for getting stats or routers - the PDA relating to these seeds https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/dd7ff727b0d3d393a159afa5f0a364775bde3a58/rust/sealevel/programs/helloworld/src/processor.rs#L44-L59 and the helloworld program ID[executable] The Mailbox program.
- The mailbox program ID[writeable] Outbox PDA.
- The mailbox's outbox PDA[] This program's dispatch authority.
- The helloworld program's dispatch authority. I.e. the PDA relating to these seeds https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/trevor/helloworld-program/rust/sealevel/programs/mailbox/src/pda_seeds.rs#L55-L68 and the helloworld program ID.[executable] System program.
- the system program id[executable] SPL Noop program.
- the noop program id[signer] Payer.
- the account that is paying for the tx[signer] Unique message account.
- the unique message account - i.e. the random keypair that needs to be created, just like in warp routes[writeable] Dispatched message PDA
- the PDA relating to the dispatched message, i.e. from these seeds https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/trevor/helloworld-program/rust/sealevel/programs/mailbox/src/pda_seeds.rs#L30-L51, the "unique message account"'s public key passed in there, and the mailbox program ID. Just like in warp routesHyperlaneToken
typeKathy updates for sealevel are now live! We'll monitor Kathy's health over the next few days to confirm everything is okay
Partially blocked by https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2502 - I think we can start this ticket before that's finished though