Skip to content

Commit

Permalink
Merge branch 'paritytech:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alvicsam authored Jun 6, 2024
2 parents cc90132 + 2460cdd commit ddb6b22
Show file tree
Hide file tree
Showing 486 changed files with 2,868 additions and 2,120 deletions.
42 changes: 36 additions & 6 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 @@ -144,6 +144,7 @@ members = [
"cumulus/test/service",
"cumulus/xcm/xcm-emulator",
"docs/sdk",
"docs/sdk/src/reference_docs/chain_spec_runtime",
"polkadot",
"polkadot/cli",
"polkadot/core-primitives",
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ bp-runtime = { path = "../../primitives/runtime" }
# Substrate dependencies

sp-runtime = { path = "../../../substrate/primitives/runtime" }
substrate-prometheus-endpoint = { path = "../../../substrate/utils/prometheus" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../substrate/utils/prometheus" }
2 changes: 1 addition & 1 deletion bridges/relays/utils/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ pub enum Error {
ExposingMetricsInvalidHost(String, AddrParseError),
/// Prometheus error.
#[error("{0}")]
Prometheus(#[from] substrate_prometheus_endpoint::prometheus::Error),
Prometheus(#[from] prometheus_endpoint::prometheus::Error),
}
2 changes: 1 addition & 1 deletion bridges/relays/utils/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

pub use float_json_value::FloatJsonValueMetric;
pub use global::GlobalMetrics;
pub use substrate_prometheus_endpoint::{
pub use prometheus_endpoint::{
prometheus::core::{Atomic, Collector},
register, Counter, CounterVec, Gauge, GaugeVec, Opts, PrometheusError, Registry, F64, I64, U64,
};
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/utils/src/relay_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::{
};

use async_trait::async_trait;
use prometheus_endpoint::{init_prometheus, Registry};
use std::{fmt::Debug, future::Future, net::SocketAddr, time::Duration};
use substrate_prometheus_endpoint::{init_prometheus, Registry};

/// Default pause between reconnect attempts.
pub const RECONNECT_DELAY: Duration = Duration::from_secs(10);
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/pallets/ethereum-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sp-io = { path = "../../../../substrate/primitives/io", default-features = false
snowbridge-core = { path = "../../primitives/core", default-features = false }
snowbridge-ethereum = { path = "../../primitives/ethereum", default-features = false }
snowbridge-pallet-ethereum-client-fixtures = { path = "fixtures", default-features = false, optional = true }
primitives = { package = "snowbridge-beacon-primitives", path = "../../primitives/beacon", default-features = false }
snowbridge-beacon-primitives = { path = "../../primitives/beacon", default-features = false }
static_assertions = { version = "1.1.0", default-features = false }
pallet-timestamp = { path = "../../../../substrate/frame/timestamp", default-features = false, optional = true }

Expand Down Expand Up @@ -62,9 +62,9 @@ std = [
"frame-system/std",
"log/std",
"pallet-timestamp/std",
"primitives/std",
"scale-info/std",
"serde",
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-ethereum/std",
"snowbridge-pallet-ethereum-client-fixtures/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use frame_system::RawOrigin;

use snowbridge_pallet_ethereum_client_fixtures::*;

use primitives::{
use snowbridge_beacon_primitives::{
fast_aggregate_verify, prepare_aggregate_pubkey, prepare_aggregate_signature,
verify_merkle_branch,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
decompress_sync_committee_bits, Config, CurrentSyncCommittee, Pallet as EthereumBeaconClient,
Update, ValidatorsRoot, Vec,
};
use primitives::PublicKeyPrepared;
use snowbridge_beacon_primitives::PublicKeyPrepared;
use sp_core::H256;

pub fn participant_pubkeys<T: Config>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
use primitives::merkle_proof::{generalized_index_length, subtree_index};
use snowbridge_beacon_primitives::merkle_proof::{generalized_index_length, subtree_index};
use static_assertions::const_assert;

/// Generalized Indices
Expand Down
7 changes: 4 additions & 3 deletions bridges/snowbridge/pallets/ethereum-client/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use crate::config::{
pub fn decompress_sync_committee_bits(
input: [u8; SYNC_COMMITTEE_BITS_SIZE],
) -> [u8; SYNC_COMMITTEE_SIZE] {
primitives::decompress_sync_committee_bits::<SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_BITS_SIZE>(
input,
)
snowbridge_beacon_primitives::decompress_sync_committee_bits::<
SYNC_COMMITTEE_SIZE,
SYNC_COMMITTEE_BITS_SIZE,
>(input)
}

/// Compute the sync committee period in which a slot is contained.
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
use super::*;
use frame_support::ensure;
use primitives::ExecutionProof;
use snowbridge_beacon_primitives::ExecutionProof;

use snowbridge_core::inbound::{
VerificationError::{self, *},
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use frame_support::{
dispatch::DispatchResult, pallet_prelude::OptionQuery, traits::Get, transactional,
};
use frame_system::ensure_signed;
use primitives::{
use snowbridge_beacon_primitives::{
fast_aggregate_verify, verify_merkle_branch, verify_receipt_proof, BeaconHeader, BlsError,
CompactBeaconState, ForkData, ForkVersion, ForkVersions, PublicKeyPrepared, SigningData,
};
Expand Down
30 changes: 19 additions & 11 deletions bridges/snowbridge/pallets/ethereum-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate as ethereum_beacon_client;
use crate::config;
use frame_support::{derive_impl, dispatch::DispatchResult, parameter_types};
use pallet_timestamp;
use primitives::{Fork, ForkVersions};
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_core::inbound::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};
Expand All @@ -21,32 +21,40 @@ where
serde_json::from_reader(File::open(filepath).unwrap())
}

pub fn load_execution_proof_fixture() -> primitives::ExecutionProof {
pub fn load_execution_proof_fixture() -> snowbridge_beacon_primitives::ExecutionProof {
load_fixture("execution-proof.json".to_string()).unwrap()
}

pub fn load_checkpoint_update_fixture(
) -> primitives::CheckpointUpdate<{ config::SYNC_COMMITTEE_SIZE }> {
) -> snowbridge_beacon_primitives::CheckpointUpdate<{ config::SYNC_COMMITTEE_SIZE }> {
load_fixture("initial-checkpoint.json".to_string()).unwrap()
}

pub fn load_sync_committee_update_fixture(
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
pub fn load_sync_committee_update_fixture() -> snowbridge_beacon_primitives::Update<
{ config::SYNC_COMMITTEE_SIZE },
{ config::SYNC_COMMITTEE_BITS_SIZE },
> {
load_fixture("sync-committee-update.json".to_string()).unwrap()
}

pub fn load_finalized_header_update_fixture(
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
pub fn load_finalized_header_update_fixture() -> snowbridge_beacon_primitives::Update<
{ config::SYNC_COMMITTEE_SIZE },
{ config::SYNC_COMMITTEE_BITS_SIZE },
> {
load_fixture("finalized-header-update.json".to_string()).unwrap()
}

pub fn load_next_sync_committee_update_fixture(
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
pub fn load_next_sync_committee_update_fixture() -> snowbridge_beacon_primitives::Update<
{ config::SYNC_COMMITTEE_SIZE },
{ config::SYNC_COMMITTEE_BITS_SIZE },
> {
load_fixture("next-sync-committee-update.json".to_string()).unwrap()
}

pub fn load_next_finalized_header_update_fixture(
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
pub fn load_next_finalized_header_update_fixture() -> snowbridge_beacon_primitives::Update<
{ config::SYNC_COMMITTEE_SIZE },
{ config::SYNC_COMMITTEE_BITS_SIZE },
> {
load_fixture("next-finalized-header-update.json".to_string()).unwrap()
}

Expand Down
5 changes: 3 additions & 2 deletions bridges/snowbridge/pallets/ethereum-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use crate::mock::*;
use crate::config::{EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT};
use frame_support::{assert_err, assert_noop, assert_ok};
use hex_literal::hex;
use primitives::{
use snowbridge_beacon_primitives::{
types::deneb, Fork, ForkVersions, NextSyncCommitteeUpdate, VersionedExecutionPayloadHeader,
};
use snowbridge_core::inbound::{VerificationError, Verifier};
Expand Down Expand Up @@ -171,7 +171,8 @@ pub fn sync_committee_participation_is_supermajority() {
let bits =
hex!("bffffffff7f1ffdfcfeffeffbfdffffbfffffdffffefefffdffff7f7ffff77fffdf7bff77ffdf7fffafffffff77fefffeff7effffffff5f7fedfffdfb6ddff7b"
);
let participation = primitives::decompress_sync_committee_bits::<512, 64>(bits);
let participation =
snowbridge_beacon_primitives::decompress_sync_committee_bits::<512, 64>(bits);
assert_ok!(EthereumBeaconClient::sync_committee_participation_is_supermajority(&participation));
}

Expand Down
14 changes: 7 additions & 7 deletions bridges/snowbridge/pallets/ethereum-client/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use frame_support::storage::types::OptionQuery;
use snowbridge_core::RingBufferMapImpl;

// Specialize types based on configured sync committee size
pub type SyncCommittee = primitives::SyncCommittee<SC_SIZE>;
pub type SyncCommitteePrepared = primitives::SyncCommitteePrepared<SC_SIZE>;
pub type SyncAggregate = primitives::SyncAggregate<SC_SIZE, SC_BITS_SIZE>;
pub type CheckpointUpdate = primitives::CheckpointUpdate<SC_SIZE>;
pub type Update = primitives::Update<SC_SIZE, SC_BITS_SIZE>;
pub type NextSyncCommitteeUpdate = primitives::NextSyncCommitteeUpdate<SC_SIZE>;
pub type SyncCommittee = snowbridge_beacon_primitives::SyncCommittee<SC_SIZE>;
pub type SyncCommitteePrepared = snowbridge_beacon_primitives::SyncCommitteePrepared<SC_SIZE>;
pub type SyncAggregate = snowbridge_beacon_primitives::SyncAggregate<SC_SIZE, SC_BITS_SIZE>;
pub type CheckpointUpdate = snowbridge_beacon_primitives::CheckpointUpdate<SC_SIZE>;
pub type Update = snowbridge_beacon_primitives::Update<SC_SIZE, SC_BITS_SIZE>;
pub type NextSyncCommitteeUpdate = snowbridge_beacon_primitives::NextSyncCommitteeUpdate<SC_SIZE>;

pub use primitives::{AncestryProof, ExecutionProof};
pub use snowbridge_beacon_primitives::{AncestryProof, ExecutionProof};

/// FinalizedState ring buffer implementation
pub type FinalizedBeaconStateBuffer<T> = RingBufferMapImpl<
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/primitives/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ snowbridge-core = { path = "../core", default-features = false }
hex-literal = { version = "0.4.1" }

[dev-dependencies]
hex = { package = "rustc-hex", version = "2.1.0" }
rustc-hex = { version = "2.1.0" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sp-keystore = { path = "../../../../substrate/primitives/keystore" }
sp-runtime = { path = "../../../../substrate/primitives/runtime" }
sp-timestamp = { path = "../../../../substrate/primitives/timestamp" }
sp-state-machine = { path = "../../../../substrate/primitives/state-machine" }
substrate-prometheus-endpoint = { path = "../../../../substrate/utils/prometheus" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../../substrate/utils/prometheus" }

# Cumulus
cumulus-client-consensus-common = { path = "../common" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn fully_verifying_import_queue<P, Client, Block: BlockT, I, CIDP>(
block_import: I,
create_inherent_data_providers: CIDP,
spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>,
registry: Option<&prometheus_endpoint::Registry>,
telemetry: Option<TelemetryHandle>,
) -> BasicQueue<Block>
where
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/consensus/aura/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use codec::Codec;
use cumulus_client_consensus_common::ParachainBlockImportMarker;
use prometheus_endpoint::Registry;
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
use sc_consensus_aura::{AuraVerifier, CompatibilityMode};
Expand All @@ -32,7 +33,6 @@ use sp_core::crypto::Pair;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::traits::Block as BlockT;
use std::{fmt::Debug, sync::Arc};
use substrate_prometheus_endpoint::Registry;

/// Parameters for [`import_queue`].
pub struct ImportQueueParams<'a, I, C, CIDP, S> {
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sp-core = { path = "../../../../substrate/primitives/core" }
sp-runtime = { path = "../../../../substrate/primitives/runtime" }
sp-timestamp = { path = "../../../../substrate/primitives/timestamp" }
sp-trie = { path = "../../../../substrate/primitives/trie" }
substrate-prometheus-endpoint = { path = "../../../../substrate/utils/prometheus" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../../substrate/utils/prometheus" }

# Polkadot
polkadot-primitives = { path = "../../../../polkadot/primitives" }
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/consensus/common/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<Block: BlockT> Verifier<Block> for VerifyNothing {
pub fn verify_nothing_import_queue<Block: BlockT, I>(
block_import: I,
spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>,
registry: Option<&prometheus_endpoint::Registry>,
) -> BasicQueue<Block>
where
I: BlockImport<Block, Error = ConsensusError>
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/consensus/relay-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sp-consensus = { path = "../../../../substrate/primitives/consensus/common" }
sp-core = { path = "../../../../substrate/primitives/core" }
sp-inherents = { path = "../../../../substrate/primitives/inherents" }
sp-runtime = { path = "../../../../substrate/primitives/runtime" }
substrate-prometheus-endpoint = { path = "../../../../substrate/utils/prometheus" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../../substrate/utils/prometheus" }

# Cumulus
cumulus-client-consensus-common = { path = "../common" }
Expand Down
Loading

0 comments on commit ddb6b22

Please sign in to comment.