Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions bridges/snowbridge/pallets/ethereum-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ pallet-timestamp = { optional = true, workspace = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-ethereum = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-pallet-ethereum-client-fixtures = { optional = true, workspace = true }
snowbridge-verification-primitives = { workspace = true }
static_assertions = { workspace = true }

[dev-dependencies]
hex-literal = { workspace = true, default-features = true }
pallet-timestamp = { workspace = true, default-features = true }
rand = { workspace = true, default-features = true }
serde = { workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client-fixtures = { workspace = true, default-features = true }
Expand All @@ -64,8 +63,8 @@ std = [
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-ethereum/std",
"snowbridge-inbound-queue-primitives/std",
"snowbridge-pallet-ethereum-client-fixtures/std",
"snowbridge-verification-primitives/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
Expand All @@ -79,7 +78,6 @@ runtime-benchmarks = [
"hex-literal",
"pallet-timestamp?/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude-from-umbrella = true
hex-literal = { workspace = true, default-features = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-verification-primitives = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }

Expand All @@ -30,11 +30,10 @@ default = ["std"]
std = [
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-inbound-queue-primitives/std",
"snowbridge-verification-primitives/std",
"sp-core/std",
"sp-std/std",
]
runtime-benchmarks = [
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, NextSyncCommitteeUpdate,
SyncAggregate, SyncCommittee, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_verification_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::{boxed::Box, vec};

Expand Down Expand Up @@ -1225,8 +1225,8 @@ pub fn make_execution_proof() -> Box<ExecutionProof> {
})
}

pub fn make_inbound_fixture() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_inbound_fixture() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/pallets/ethereum-client/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use snowbridge_beacon_primitives::ExecutionProof;

use snowbridge_beacon_primitives::merkle_proof::{generalized_index_length, subtree_index};
use snowbridge_ethereum::Receipt;
use snowbridge_inbound_queue_primitives::{
use snowbridge_verification_primitives::{
VerificationError::{self, *},
*,
Verifier, *,
};

impl<T: Config> Verifier for Pallet<T> {
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::config;
use frame_support::{derive_impl, dispatch::DispatchResult, parameter_types};
use pallet_timestamp;
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_inbound_queue_primitives::{Log, Proof};
use snowbridge_verification_primitives::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::config;
use frame_support::{derive_impl, dispatch::DispatchResult, parameter_types};
use pallet_timestamp;
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_inbound_queue_primitives::{Log, Proof};
use snowbridge_verification_primitives::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};

Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use snowbridge_beacon_primitives::{
types::deneb,
Fork, ForkVersions, NextSyncCommitteeUpdate, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{VerificationError, Verifier};
use snowbridge_verification_primitives::{VerificationError, Verifier};
use sp_core::H256;
use sp_runtime::DispatchError;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use snowbridge_beacon_primitives::{
types::deneb,
Fork, ForkVersions, NextSyncCommitteeUpdate, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{VerificationError, Verifier};
use snowbridge_verification_primitives::{VerificationError, Verifier};
use sp_core::H256;
use sp_runtime::DispatchError;

Expand Down
3 changes: 0 additions & 3 deletions bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ bp-relayers = { workspace = true }
frame-benchmarking = { workspace = true, default-features = true }
hex = { workspace = true, default-features = true }
hex-literal = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client = { workspace = true, default-features = true }
snowbridge-test-utils = { workspace = true }
sp-keyring = { workspace = true, default-features = true }

Expand Down Expand Up @@ -89,7 +88,6 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-inbound-queue-v2-fixtures/runtime-benchmarks",
"snowbridge-test-utils/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
Expand All @@ -101,6 +99,5 @@ try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"snowbridge-pallet-ethereum-client/try-runtime",
"sp-runtime/try-runtime",
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_register_token_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_register_token_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("b1185ede04202fe62d38f5db72f71e38ff3e8305").into(),
Expand Down
41 changes: 2 additions & 39 deletions bridges/snowbridge/pallets/inbound-queue-v2/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use frame_support::{derive_impl, parameter_types, traits::ConstU32};
use hex_literal::hex;
use scale_info::TypeInfo;
use snowbridge_beacon_primitives::{
types::deneb, BeaconHeader, ExecutionProof, Fork, ForkVersions, VersionedExecutionPayloadHeader,
types::deneb, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_core::TokenId;
use snowbridge_inbound_queue_primitives::{v2::MessageToXcm, Log, Proof, VerificationError};
Expand All @@ -27,7 +27,6 @@ frame_support::construct_runtime!(
{
System: frame_system::{Pallet, Call, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
EthereumBeaconClient: snowbridge_pallet_ethereum_client::{Pallet, Call, Storage, Event<T>},
InboundQueue: inbound_queue_v2::{Pallet, Call, Storage, Event<T>},
}
);
Expand Down Expand Up @@ -56,42 +55,6 @@ impl pallet_balances::Config for Test {
type AccountStore = System;
}

parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 0, 1], // 0x00000001
epoch: 0,
},
altair: Fork {
version: [1, 0, 0, 1], // 0x01000001
epoch: 0,
},
bellatrix: Fork {
version: [2, 0, 0, 1], // 0x02000001
epoch: 0,
},
capella: Fork {
version: [3, 0, 0, 1], // 0x03000001
epoch: 0,
},
deneb: Fork {
version: [4, 0, 0, 1], // 0x04000001
epoch: 0,
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 80000000000,
}
};
}

impl snowbridge_pallet_ethereum_client::Config for Test {
type RuntimeEvent = RuntimeEvent;
type ForkVersions = ChainForkVersions;
type FreeHeadersInterval = ConstU32<32>;
type WeightInfo = ();
}

// Mock verifier
pub struct MockVerifier;

Expand All @@ -107,7 +70,7 @@ impl Verifier for MockVerifier {
const GATEWAY_ADDRESS: [u8; 20] = hex!["b1185ede04202fe62d38f5db72f71e38ff3e8305"];

#[cfg(feature = "runtime-benchmarks")]
impl<T: snowbridge_pallet_ethereum_client::Config> BenchmarkHelper<T> for Test {
impl<T: Config> BenchmarkHelper<T> for Test {
// not implemented since the MockVerifier is used for tests
fn initialize_storage(_: BeaconHeader, _: H256) {}
}
Expand Down
6 changes: 5 additions & 1 deletion bridges/snowbridge/pallets/inbound-queue-v2/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ fn zero_reward_does_not_register_reward() {
}
));

assert_eq!(RegisteredRewardsCount::get(), 0, "Zero relayer reward should not be registered");
assert_eq!(
RegisteredRewardsCount::get(),
0,
"Zero relayer reward should not be registered"
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can you revert the renaming please?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I rename it because InboundQueueFixture will be reused when benchmarking the extrinsic submit_delivery_receipt for the outbound queue, so I prefer to make it more neutral.

use sp_core::U256;
use sp_std::vec;

pub fn make_register_token_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_register_token_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_send_native_eth_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_send_native_eth_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("87d1f7fdfee7f651fabc8bfcb6e086c278b77a7d").into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_send_token_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_send_token_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_send_token_to_penpal_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_send_token_to_penpal_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
Expand Down
5 changes: 4 additions & 1 deletion bridges/snowbridge/pallets/outbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ sp-std = { workspace = true }
bp-relayers = { workspace = true }
bridge-hub-common = { workspace = true }

snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-merkle-tree = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
snowbridge-verification-primitives = { workspace = true }

xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

[dev-dependencies]
pallet-message-queue = { workspace = true }
sp-keyring = { workspace = true, default-features = true }

[features]
default = ["std"]
Expand All @@ -63,9 +64,11 @@ std = [
"pallet-message-queue/std",
"scale-info/std",
"serde/std",
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-merkle-tree/std",
"snowbridge-outbound-queue-primitives/std",
"snowbridge-verification-primitives/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
Expand Down
Loading
Loading