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

feat: dummy light client #25

Merged
merged 17 commits into from
Jul 30, 2024
Merged

feat: dummy light client #25

merged 17 commits into from
Jul 30, 2024

Conversation

rnbguy
Copy link
Member

@rnbguy rnbguy commented Jul 23, 2024

Closes #7

This PR implements an ibc-rs light client - which doesn't validate anything. Its purpose is to bootstrap IBC workflow without having a fully working light client.

This should be only used in debugging or testing scenarios.


Any serialized ClientState, ConsensusState are as follows:

Any {
    type_url: "/DummyClientState".to_string(),
    value: client_state
        .latest_height
        .revision_number()
        .to_be_bytes()
        .to_vec(),
}
Any {
    type_url: "/DummyConsensusState".to_string(),
    value: vec![],
}

Any serialized Header can be anything. For example, it can take empty type_url and value:

Any {
    type_url: "".to_string(),
    value: vec![],
}

dummy-light-client/cw-contract/src/client_type.rs Outdated Show resolved Hide resolved
dummy-light-client/impls/Cargo.toml Outdated Show resolved Hide resolved
dummy-light-client/cw-contract/Cargo.toml Outdated Show resolved Hide resolved
@soareschen
Copy link
Collaborator

Btw, there is already a boiletplate crate at https://github.com/informalsystems/ibc-starknet/tree/main/light-client?

@Farhad-Shabani
Copy link
Member

Thank you @rnbguy for this PR 🙌

I, as well, suggest to set up the dummy light client within the boilerplate, as it eventually evolves to a fully fledged Starknet light client, and won’t be needing the dummy one in later phases.

@rnbguy
Copy link
Member Author

rnbguy commented Jul 25, 2024

Overwritten the light-client members with the minimum ibc client implementation.

Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

@rnbguy Is there anything left to prepare the PR for review?
By the way, I requested a few minor tweaks. It would be beneficial to include a just command and a CI job to check the build.

light-client/types/src/client_state.rs Outdated Show resolved Hide resolved
light-client/types/src/client_state.rs Outdated Show resolved Hide resolved
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, derive_more::From)]
pub struct ClientState {
pub latest_height: Height,
Copy link
Member Author

@rnbguy rnbguy Jul 29, 2024

Choose a reason for hiding this comment

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

Just adding a comment in the context of this PR.

As discussed with Farhad, removing this field probably works with the IBC stack.

But it is good to have - as this would act as a debugging flag; to observe if an ClientUpdate actually happened - because that increments this height.

Copy link
Collaborator

@soareschen soareschen left a comment

Choose a reason for hiding this comment

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

Looks good, except some minor nits.

Cargo.toml Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move the Cargo workspace to the project sub directory light-client/? We could also create a top-level directory like starknet-on-cosmos to host the Cargo workspace.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will let @Farhad-Shabani and you to decide this. Feel free to update my PR as I will be OOO.

use ibc_core::commitment_types::commitment::CommitmentRoot;
use ibc_core::primitives::proto::{Any, Protobuf};

pub const CONSENSUS_STATE_TYPE_URL: &str = "/DummyConsensusState";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we update the type URL to something like "/StarknetConsensusState"?

Copy link
Member Author

Choose a reason for hiding this comment

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

@soareschen soareschen marked this pull request as ready for review July 30, 2024 08:15
@soareschen
Copy link
Collaborator

Let's get this merged first. We can continue rapid development on further PRs.

@soareschen soareschen merged commit 9fc4f1b into main Jul 30, 2024
2 checks passed
@soareschen soareschen deleted the rano/light-client-blind branch July 30, 2024 08:16
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.

Build a minimal Wasm client contract for Starknet on Cosmos
3 participants