Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into bko-bridges-backpor…
Browse files Browse the repository at this point in the history
…ts-and-nits
  • Loading branch information
bkontur committed Jun 7, 2024
2 parents 9d1a5df + 426956f commit 5b19f7c
Show file tree
Hide file tree
Showing 468 changed files with 2,099 additions and 2,211 deletions.
24 changes: 0 additions & 24 deletions .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,6 @@ check-try-runtime:
# experimental code may rely on try-runtime and vice-versa
- time cargo check --locked --all --features try-runtime,experimental

# FIXME
.cargo-deny-licenses:
stage: check
extends:
- .docker-env
- .test-pr-refs
variables:
CARGO_DENY_CMD: "cargo deny --all-features check licenses -c ./substrate/scripts/ci/deny.toml"
script:
- $CARGO_DENY_CMD --hide-inclusion-graph
after_script:
- echo "___The complete log is in the artifacts___"
- $CARGO_DENY_CMD 2> deny.log
- if [ $CI_JOB_STATUS != 'success' ]; then
echo 'Please check license of your crate or add an exception to scripts/ci/deny.toml';
fi
allow_failure: true
artifacts:
name: $CI_COMMIT_SHORT_SHA
expire_in: 3 days
when: always
paths:
- deny.log

# from substrate
# not sure if it's needed in monorepo
check-dependency-rules:
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ fellowship, this separation, the RFC process
This repository is the amalgamation of 3 separate repositories that used to make up Polkadot SDK,
namely Substrate, Polkadot and Cumulus. Read more about the merge and its history
[here](https://polkadot-public.notion.site/Polkadot-SDK-FAQ-fbc4cecc2c46443fb37b9eeec2f0d85f).

## Other useful resources and tooling

* A simple tool to manage and update the Polkadot SDK dependencies (https://github.com/paritytech/psvm)
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 <hello@snowfork.com>
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 <hello@snowfork.com>
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
2 changes: 1 addition & 1 deletion cumulus/client/consensus/relay-chain/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn import_queue<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>,
) -> ClientResult<BasicQueue<Block>>
where
I: BlockImport<Block, Error = ConsensusError>
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ futures = "0.3.28"
async-trait = "0.1.79"
thiserror = { workspace = true }
jsonrpsee-core = "0.22"
parity-scale-codec = "3.6.12"
codec = { package = "parity-scale-codec", version = "3.6.12" }
2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use sc_client_api::StorageProof;
use futures::Stream;

use async_trait::async_trait;
use codec::Error as CodecError;
use jsonrpsee_core::ClientError as JsonRpcError;
use parity_scale_codec::Error as CodecError;
use sp_api::ApiError;

use cumulus_primitives_core::relay_chain::BlockId;
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-minimal-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sc-network = { path = "../../../substrate/client/network" }
sc-network-common = { path = "../../../substrate/client/network/common" }
sc-service = { path = "../../../substrate/client/service" }
sc-client-api = { path = "../../../substrate/client/api" }
substrate-prometheus-endpoint = { path = "../../../substrate/utils/prometheus" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../substrate/utils/prometheus" }
sc-tracing = { path = "../../../substrate/client/tracing" }
sc-utils = { path = "../../../substrate/client/utils" }
sp-api = { path = "../../../substrate/primitives/api" }
Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-minimal-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async fn new_minimal_relay_chain<Block: BlockT, Network: NetworkBackend<RelayBlo
task_manager.spawn_handle().spawn(
"prometheus-endpoint",
None,
substrate_prometheus_endpoint::init_prometheus(port, registry).map(drop),
prometheus_endpoint::init_prometheus(port, registry).map(drop),
);
}

Expand Down
2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-rpc-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tokio-util = { version = "0.7.8", features = ["compat"] }

futures = "0.3.28"
futures-timer = "3.0.2"
parity-scale-codec = "3.6.12"
codec = { package = "parity-scale-codec", version = "3.6.12" }
jsonrpsee = { version = "0.22", features = ["ws-client"] }
tracing = "0.1.37"
async-trait = "0.1.79"
Expand Down
Loading

0 comments on commit 5b19f7c

Please sign in to comment.