Skip to content

Commit

Permalink
revert unnessary changes and create new beacon fixtures crate
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Jan 25, 2024
1 parent e55362d commit f78e40b
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 1,977 deletions.
1 change: 1 addition & 0 deletions parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository = "https://github.com/snowfork/snowbridge.git"
resolver = "2"
members = [
"pallets/ethereum-client",
"pallets/ethereum-client/fixtures",
"pallets/inbound-queue",
"pallets/outbound-queue",
"pallets/outbound-queue/merkle-tree",
Expand Down
4 changes: 4 additions & 0 deletions parachain/pallets/ethereum-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sp-io = { path = "../../../polkadot-sdk/substrate/primitives/io", default-featur

snowbridge-core = { path = "../../primitives/core", default-features = false }
snowbridge-ethereum = { path = "../../primitives/ethereum", default-features = false }
snowbridge-pallet-ethereum-client-fixtures = { path = "./fixtures", optional = true }
primitives = { package = "snowbridge-beacon-primitives", path = "../../primitives/beacon", default-features = false }
static_assertions = { version = "1.1.0", default-features = false }
bp-runtime = { path = "../../../polkadot-sdk/bridges/primitives/runtime", default-features = false }
Expand All @@ -47,6 +48,7 @@ sp-keyring = { path = "../../../polkadot-sdk/substrate/primitives/keyring" }
serde_json = "1.0.111"
hex-literal = "0.4.1"
pallet-timestamp = { path = "../../../polkadot-sdk/substrate/frame/timestamp" }
snowbridge-pallet-ethereum-client-fixtures = { path = "./fixtures" }
sp-io = { path = "../../../polkadot-sdk/substrate/primitives/io" }
serde = "1.0.195"

Expand All @@ -73,6 +75,7 @@ std = [
"serde",
"snowbridge-core/std",
"snowbridge-ethereum/std",
"snowbridge-pallet-ethereum-client-fixtures/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
Expand All @@ -87,6 +90,7 @@ runtime-benchmarks = [
"hex-literal",
"pallet-timestamp?/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
Expand Down
44 changes: 44 additions & 0 deletions parachain/pallets/ethereum-client/fixtures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "snowbridge-pallet-ethereum-client-fixtures"
description = "Snowbridge Ethereum Client Test Fixtures"
version = "0.9.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
license = "Apache-2.0"
categories = ["cryptography::cryptocurrencies"]

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
hex-literal = { version = "0.4.1" }
sp-core = { path = "../../../../polkadot-sdk/substrate/primitives/core", default-features = false }
sp-std = { path = "../../../../polkadot-sdk/substrate/primitives/std", default-features = false }
frame-benchmarking = { path = "../../../../polkadot-sdk/substrate/frame/benchmarking", default-features = false, optional = true }
frame-support = { path = "../../../../polkadot-sdk/substrate/frame/support", default-features = false }
frame-system = { path = "../../../../polkadot-sdk/substrate/frame/system", default-features = false }
snowbridge-core = { path = "../../../primitives/core", default-features = false }
snowbridge-beacon-primitives = { path = "../../../primitives/beacon", default-features = false }

[features]
default = ["std"]
std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"sp-core/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
// Generated, do not edit!
// See README.md for instructions to generate
#![cfg_attr(not(feature = "std"), no_std)]

use crate::{CheckpointUpdate, ExecutionHeaderUpdate, Update};
use hex_literal::hex;
use primitives::{
types::deneb, updates::AncestryProof, BeaconHeader, NextSyncCommitteeUpdate, SyncAggregate,
SyncCommittee, VersionedExecutionPayloadHeader,
types::deneb, updates::AncestryProof, BeaconHeader, NextSyncCommitteeUpdate, SyncAggregate,
SyncCommittee, VersionedExecutionPayloadHeader,
};
use sp_core::U256;
use sp_std::{boxed::Box, vec};

pub fn make_checkpoint() -> Box<CheckpointUpdate> {
Box::new(CheckpointUpdate {
Box::new(CheckpointUpdate {
header: BeaconHeader {
slot: 2496,
proposer_index: 2,
Expand Down Expand Up @@ -536,11 +540,11 @@ pub fn make_checkpoint() -> Box<CheckpointUpdate> {
aggregate_pubkey: hex!("8fbd66eeec2ff69ef0b836f04b1d67d88bcd4dfd495061964ad757c77abe822a39fa1cd8ed0d4d9bc9276cea73fd745c").into(),
},
current_sync_committee_branch: vec![
hex!("3ade38d498a062b50880a9409e1ca3a7fd4315d91eeb3bb83e56ac6bfe8d6a59").into(),
hex!("93880225bf99a0c5ec22b266ff829837754e9c5edf37a68c05b8f803fd82fa45").into(),
hex!("4c60656ec9a95fcf11030ad309c716b5b15beb7f60a0bcfc7c9d4eff505472ff").into(),
hex!("22d1645fceb4bf9a695043dda19a53e784ec70df6a6b1bd66ea30eba1cca5f2f").into(),
hex!("a8fc6cad84ceefc633ec56c2d031d525e1cb4b51c70eb252919fce5bba9a1fde").into(),
hex!("3ade38d498a062b50880a9409e1ca3a7fd4315d91eeb3bb83e56ac6bfe8d6a59").into(),
hex!("93880225bf99a0c5ec22b266ff829837754e9c5edf37a68c05b8f803fd82fa45").into(),
hex!("4c60656ec9a95fcf11030ad309c716b5b15beb7f60a0bcfc7c9d4eff505472ff").into(),
hex!("22d1645fceb4bf9a695043dda19a53e784ec70df6a6b1bd66ea30eba1cca5f2f").into(),
hex!("a8fc6cad84ceefc633ec56c2d031d525e1cb4b51c70eb252919fce5bba9a1fde").into(),
],
validators_root: hex!("270d43e74ce340de4bca2b1936beca0f4f5408d9e78aec4850920baf659d5b69").into(),
block_roots_root: hex!("d160b7687041891b73e54b06fc4e04f82d0fa8fdd76705895e216c6b24709dfe").into(),
Expand All @@ -555,7 +559,7 @@ pub fn make_checkpoint() -> Box<CheckpointUpdate> {
}

pub fn make_sync_committee_update() -> Box<Update> {
Box::new(Update {
Box::new(Update {
attested_header: BeaconHeader {
slot: 129,
proposer_index: 5,
Expand Down Expand Up @@ -1121,7 +1125,7 @@ pub fn make_sync_committee_update() -> Box<Update> {
}

pub fn make_finalized_header_update() -> Box<Update> {
Box::new(Update {
Box::new(Update {
attested_header: BeaconHeader {
slot: 2566,
proposer_index: 6,
Expand Down Expand Up @@ -1162,7 +1166,7 @@ pub fn make_finalized_header_update() -> Box<Update> {
}

pub fn make_execution_header_update() -> Box<ExecutionHeaderUpdate> {
Box::new(ExecutionHeaderUpdate {
Box::new(ExecutionHeaderUpdate {
header: BeaconHeader {
slot: 215,
proposer_index: 2,
Expand Down
3 changes: 1 addition & 2 deletions parachain/pallets/ethereum-client/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
use super::*;
mod fixtures;
mod util;

use crate::Pallet as EthereumBeaconClient;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;

use fixtures::*;
use snowbridge_pallet_ethereum_client_fixtures::*;

use primitives::{
fast_aggregate_verify, prepare_aggregate_pubkey, prepare_aggregate_signature,
Expand Down
9 changes: 1 addition & 8 deletions parachain/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,7 @@ pub mod pallet {
let execution_header_root: H256 = update
.execution_header
.hash_tree_root()
.map_err(|e| {
log::error!(
target: LOG_TARGET,
"💫 BlockBodyHashTreeRootFailed error {}.",
e
);
Error::<T>::BlockBodyHashTreeRootFailed
})?;
.map_err(|_| Error::<T>::BlockBodyHashTreeRootFailed)?;

ensure!(
verify_merkle_branch(
Expand Down
7 changes: 1 addition & 6 deletions parachain/runtime/test-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,4 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
beacon-spec-minimal = [
"snowbridge-pallet-ethereum-client/beacon-spec-minimal"
]
fast-runtime = [
"beacon-spec-minimal",
]
fast-runtime = []
Loading

0 comments on commit f78e40b

Please sign in to comment.