Skip to content

Commit

Permalink
refactor: move ics23_commitment to a new package (#113)
Browse files Browse the repository at this point in the history
Resolves #105

This PR moves the `ics23_commitment` folder out as a separate package,
so that other projects can import it as dependency.

cc @gregdhill
  • Loading branch information
SebastianElvis authored Feb 20, 2025
1 parent e355223 commit 457242b
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ babylon-bitcoin = { path = "./packages/bitcoin" }
babylon-btcstaking = { path = "./packages/btcstaking" }
babylon-contract = { path = "./contracts/babylon" }
eots = { path = "./packages/eots" }
ics23-commitment = { path = "./packages/ics23_commitment" }
anyhow = "1.0.82"
bech32 = "0.9.1"
bitcoin = "0.31.1"
Expand Down
1 change: 1 addition & 0 deletions contracts/babylon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ babylon-apis = { path = "../../packages/apis" }
babylon-bindings = { path = "../../packages/bindings" }
babylon-proto = { path = "../../packages/proto" }
babylon-bitcoin = { path = "../../packages/bitcoin" }
ics23-commitment = { path = "../../packages/ics23_commitment" }
blst = { workspace = true }
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions contracts/babylon/src/utils/cosmos_store.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::ics23_commitment::merkle::convert_tm_proto_to_ics_merkle_proof;
use ics23_commitment::merkle::convert_tm_proto_to_ics_merkle_proof;

// the below keys are hard-coded for now. They have to be consistent with the Babylon repo.
// TODO: integration tests for ensuring they are the same, or parametrise them upon instantiation
Expand Down Expand Up @@ -43,7 +43,7 @@ pub fn verify_store(
.map_err(|err|format!("failed to convert tendermint_proto::crypto::ProofOps to ibc::core::ics23_commitment::merkle::MerkleProof: {err:?}"))?;

// construct values for verifying Merkle proofs
let specs = crate::utils::ics23_commitment::specs::ProofSpecs::default();
let specs = ics23_commitment::specs::ProofSpecs::default();
let merkle_root = root.to_vec();
let merkle_keys = vec![module_key.to_vec(), key.to_vec()];

Expand Down
1 change: 0 additions & 1 deletion contracts/babylon/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod bitcoin;
mod bls;
mod cosmos_store;
mod ics23_commitment;

pub mod babylon_epoch_chain;
pub mod btc_light_client;
Expand Down
15 changes: 15 additions & 0 deletions packages/ics23_commitment/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "ics23-commitment"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
authors.workspace = true
publish.workspace = true

[dependencies]
anyhow = { workspace = true }
ics23 = { workspace = true }
prost = { workspace = true }
thiserror = { workspace = true }
tendermint-proto = { workspace = true }
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::ics23_commitment::error::CommitmentError;
use crate::utils::ics23_commitment::specs::ProofSpecs;
use crate::error::CommitmentError;
use crate::specs::ProofSpecs;
use ics23::commitment_proof::Proof;
use ics23::{calculate_existence_root, verify_membership, CommitmentProof};

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/proto/babylon
Submodule babylon updated 408 files

0 comments on commit 457242b

Please sign in to comment.