Skip to content

Commit

Permalink
Move merkle impl to core
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Oct 14, 2024
1 parent d5cadfa commit 0905c41
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 71 deletions.
17 changes: 0 additions & 17 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ members = [
"bridges/snowbridge/pallets/inbound-queue/fixtures",
"bridges/snowbridge/pallets/outbound-queue",
"bridges/snowbridge/pallets/outbound-queue-v2",
"bridges/snowbridge/pallets/outbound-queue-v2/merkle-tree",
"bridges/snowbridge/pallets/outbound-queue-v2/runtime-api",
"bridges/snowbridge/pallets/outbound-queue/merkle-tree",
"bridges/snowbridge/pallets/outbound-queue/runtime-api",
Expand Down Expand Up @@ -1208,7 +1207,6 @@ snowbridge-beacon-primitives = { path = "bridges/snowbridge/primitives/beacon",
snowbridge-core = { path = "bridges/snowbridge/primitives/core", default-features = false }
snowbridge-ethereum = { path = "bridges/snowbridge/primitives/ethereum", default-features = false }
snowbridge-outbound-queue-merkle-tree = { path = "bridges/snowbridge/pallets/outbound-queue/merkle-tree", default-features = false }
snowbridge-outbound-queue-merkle-tree-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2/merkle-tree", default-features = false }
snowbridge-outbound-queue-runtime-api = { path = "bridges/snowbridge/pallets/outbound-queue/runtime-api", default-features = false }
snowbridge-outbound-queue-runtime-api-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2/runtime-api", default-features = false }
snowbridge-pallet-ethereum-client = { path = "bridges/snowbridge/pallets/ethereum-client", default-features = false }
Expand Down
2 changes: 0 additions & 2 deletions bridges/snowbridge/pallets/outbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ sp-arithmetic = { workspace = true }
bridge-hub-common = { workspace = true }

snowbridge-core = { features = ["serde"], workspace = true }
snowbridge-outbound-queue-merkle-tree-v2 = { workspace = true }
ethabi = { workspace = true }
hex-literal = { workspace = true, default-features = true }

Expand All @@ -56,7 +55,6 @@ std = [
"scale-info/std",
"serde/std",
"snowbridge-core/std",
"snowbridge-outbound-queue-merkle-tree-v2/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ codec = { features = ["derive"], workspace = true }
sp-std = { workspace = true }
sp-api = { workspace = true }
frame-support = { workspace = true }
snowbridge-outbound-queue-merkle-tree-v2 = { workspace = true }
snowbridge-core = { workspace = true }

[features]
Expand All @@ -28,7 +27,6 @@ std = [
"codec/std",
"frame-support/std",
"snowbridge-core/std",
"snowbridge-outbound-queue-merkle-tree-v2/std",
"sp-api/std",
"sp-std/std",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use frame_support::traits::tokens::Balance as BalanceT;
use snowbridge_outbound_queue_merkle_tree_v2::MerkleProof;
use snowbridge_core::merkle::MerkleProof;

sp_api::decl_runtime_apis! {
pub trait OutboundQueueApiV2<Balance> where Balance: BalanceT
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/outbound-queue-v2/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use crate::{Config, MessageLeaves};
use frame_support::storage::StorageStreamIter;
use snowbridge_outbound_queue_merkle_tree_v2::{merkle_proof, MerkleProof};
use snowbridge_core::merkle::{merkle_proof, MerkleProof};

pub fn prove_message<T>(leaf_index: u64) -> Option<MerkleProof>
where
Expand Down
3 changes: 1 addition & 2 deletions bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ use frame_support::{
};
use snowbridge_core::{
inbound::Message as DeliveryMessage,
merkle::merkle_root,
outbound_v2::{CommandWrapper, Fee, GasMeter, Message},
BasicOperatingMode,
};
use snowbridge_outbound_queue_merkle_tree_v2::merkle_root;
pub use snowbridge_outbound_queue_merkle_tree_v2::MerkleProof;
use sp_core::H256;
use sp_runtime::{traits::Hash, ArithmeticError, DigestItem};
use sp_std::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/outbound-queue-v2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use sp_std::prelude::*;

use super::Pallet;

pub use snowbridge_core::merkle::MerkleProof;
use snowbridge_core::outbound_v2::CommandWrapper;
pub use snowbridge_outbound_queue_merkle_tree_v2::MerkleProof;

pub type ProcessMessageOriginOf<T> = <Pallet<T> as ProcessMessage>::Origin;

Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod tests;

pub mod inbound;
pub mod location;
pub mod merkle;
pub mod operating_mode;
pub mod outbound;
pub mod outbound_v2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ impl_runtime_apis! {
}

impl snowbridge_outbound_queue_runtime_api_v2::OutboundQueueApiV2<Block, Balance> for Runtime {
fn prove_message(leaf_index: u64) -> Option<snowbridge_pallet_outbound_queue_v2::MerkleProof> {
fn prove_message(leaf_index: u64) -> Option<snowbridge_core::merkle::MerkleProof> {
snowbridge_pallet_outbound_queue_v2::api::prove_message::<Runtime>(leaf_index)
}
}
Expand Down

0 comments on commit 0905c41

Please sign in to comment.