Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially implement IBC client update of sovereign rollups on Cosmos chains #98

Closed
Tracked by #10 ...
soareschen opened this issue Jan 26, 2024 · 0 comments · Fixed by #295
Closed
Tracked by #10 ...

Partially implement IBC client update of sovereign rollups on Cosmos chains #98

soareschen opened this issue Jan 26, 2024 · 0 comments · Fixed by #295

Comments

@soareschen
Copy link
Collaborator

soareschen commented Jan 26, 2024

Part of: #10
Prerequisites: #97
also informalsystems/sovereign-ibc#65

Summary

This is similar to #97, except that we are partially implementing IBC client update.

  • The UpdateClient message would contain a valid Celestia DA client update header.
  • The rollup client update would be mocked, i.e. the final state hash is randomly generated.
    • However, the initial rollup state hash should match the IBC client current rollup state hash
    • We will still not be communicating with the rollup node in this PR.
  • The UpdateClient message would contain a dummy aggregate proof, i.e. randomly generated blob.

Implementation strategy

Similar to #97, we would implement context-generic update client components as something like:

pub struct UpdateSovereignClientOnCosmos;

impl<SovereignChain, CosmosChain>
    ProvideUpdateClientPayloadType<SovereignChain, CosmosChain> 
    for UpdateSovereignClientOnCosmos
{ /* ... */ }

impl<SovereignChain, CosmosChain>
    UpdateClientPayloadBuilder<SovereignChain, CosmosChain> 
    for UpdateSovereignClientOnCosmos
{ /* ... */ }

impl<CosmosChain, SovereignChain>
    UpdateClientMessageBuilder<CosmosChain, SovereignChain>
    for UpdateSovereignClientOnCosmos
{ /* ... */ }

When testing, we would mock the client ID on the sovereign rollup so that we can perform the IBC client creation on the sovereign rollup at a later time. The SovereignToCosmosRelay context should implement CanBuildUpdateClientMessage via BuildUpdateClientMessages, with all the depedencies implemented. The test would expand on the original create client test and does something like:

#[test]
async fn test_sovereign_to_cosmos_create_client() -> Result<(), Error> {
    let cosmos_bootstrap = CosmosBootstrap { /* ... */ };

    let sovereign_bootstrap = SovereignBootstrap { /* ... */ };

    let cosmos_chain = cosmos_bootstrap.bootstrap_chain().await?;

    let sovereign_chain = sovereign_bootstrap.bootstrap_chain().await?;

    let create_client_options = SovereignToCosmosCreateClientOptions { /* ... */ };

    let cosmos_client_id = SovereignToCosmosRelay::create_client(
        DesitinationTarget,
        &cosmos_chain,
        &sovereign_chain,
        &create_client_options,
    ).await?;

    let sovereign_client_id = ClientId::default(); //mock

    let sovereign_to_cosmos_relay = SovereignToCosmosRelay { /* ... */ };

    let update_height = sovereign_chain.query_chain_height()?;

    let update_client_messages = sovereign_to_cosmos_relay
        .build_update_client_messages(
            DesitinationTarget,
            update_height,
        )?;
    
    cosmos_chain.send_messages(update_client_messages).await?;

    Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
1 participant