Skip to content

Commit

Permalink
Merge branch 'master' into test-benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianbarbu authored Jan 24, 2025
2 parents 5f2cdaa + e9393a9 commit f87272f
Show file tree
Hide file tree
Showing 157 changed files with 2,462 additions and 1,121 deletions.
432 changes: 242 additions & 190 deletions .github/workflows/cmd.yml

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion .github/workflows/release-reusable-rc-buid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,24 @@ jobs:
ref: ${{ inputs.release_tag }}
fetch-depth: 0

- name: Download artifacts
- name: Download polkadot_x86_64-unknown-linux-gnu artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: polkadot_x86_64-unknown-linux-gnu
path: target/production
merge-multiple: true

- name: Download polkadot-execute-worker_x86_64-unknown-linux-gnu artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: polkadot-execute-worker_x86_64-unknown-linux-gnu
path: target/production
merge-multiple: true

- name: Download polkadot-prepare-worker_x86_64-unknown-linux-gnu artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: polkadot-prepare-worker_x86_64-unknown-linux-gnu
path: target/production
merge-multiple: true

Expand Down
9 changes: 1 addition & 8 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 bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bp-parachains = { workspace = true }
bp-polkadot-core = { workspace = true }
bp-relayers = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge-hub = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
pallet-bridge-messages = { workspace = true }
pallet-bridge-parachains = { workspace = true }
Expand Down Expand Up @@ -63,7 +62,6 @@ std = [
"bp-relayers/std",
"bp-runtime/std",
"bp-test-utils/std",
"bp-xcm-bridge-hub/std",
"codec/std",
"frame-support/std",
"frame-system/std",
Expand Down
9 changes: 5 additions & 4 deletions bridges/bin/runtime-common/src/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use pallet_bridge_messages::{ThisChainOf, WeightInfoExt as _};
// Re-export to avoid include all dependencies everywhere.
#[doc(hidden)]
pub mod __private {
pub use bp_xcm_bridge_hub;
pub use static_assertions;
}

Expand Down Expand Up @@ -66,9 +65,9 @@ macro_rules! assert_bridge_messages_pallet_types(
with_bridged_chain_messages_instance: $i:path,
this_chain: $this:path,
bridged_chain: $bridged:path,
expected_payload_type: $payload:path,
) => {
{
use $crate::integrity::__private::bp_xcm_bridge_hub::XcmAsPlainPayload;
use $crate::integrity::__private::static_assertions::assert_type_eq_all;
use bp_messages::ChainWithMessages;
use bp_runtime::Chain;
Expand All @@ -81,8 +80,8 @@ macro_rules! assert_bridge_messages_pallet_types(
assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::ThisChain, $this);
assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::BridgedChain, $bridged);

assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::OutboundPayload, XcmAsPlainPayload);
assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::InboundPayload, XcmAsPlainPayload);
assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::OutboundPayload, $payload);
assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::InboundPayload, $payload);
}
}
);
Expand All @@ -97,13 +96,15 @@ macro_rules! assert_complete_bridge_types(
with_bridged_chain_messages_instance: $mi:path,
this_chain: $this:path,
bridged_chain: $bridged:path,
expected_payload_type: $payload:path,
) => {
$crate::assert_chain_types!(runtime: $r, this_chain: $this);
$crate::assert_bridge_messages_pallet_types!(
runtime: $r,
with_bridged_chain_messages_instance: $mi,
this_chain: $this,
bridged_chain: $bridged,
expected_payload_type: $payload,
);
}
);
Expand Down
9 changes: 6 additions & 3 deletions bridges/modules/messages/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,12 @@ pub fn inbound_unrewarded_relayers_state(lane: TestLaneIdType) -> UnrewardedRela
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
pallet_balances::GenesisConfig::<TestRuntime> { balances: vec![(ENDOWED_ACCOUNT, 1_000_000)] }
.assimilate_storage(&mut t)
.unwrap();
pallet_balances::GenesisConfig::<TestRuntime> {
balances: vec![(ENDOWED_ACCOUNT, 1_000_000)],
..Default::default()
}
.assimilate_storage(&mut t)
.unwrap();
sp_io::TestExternalities::new(t)
}

Expand Down
31 changes: 30 additions & 1 deletion cumulus/client/consensus/aura/src/equivocation_import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,43 @@ impl NaiveEquivocationDefender {
}
}

struct Verifier<P, Client, Block, CIDP> {
/// A parachain block import verifier that checks for equivocation limits within each slot.
pub struct Verifier<P, Client, Block, CIDP> {
client: Arc<Client>,
create_inherent_data_providers: CIDP,
defender: Mutex<NaiveEquivocationDefender>,
telemetry: Option<TelemetryHandle>,
_phantom: std::marker::PhantomData<fn() -> (Block, P)>,
}

impl<P, Client, Block, CIDP> Verifier<P, Client, Block, CIDP>
where
P: Pair,
P::Signature: Codec,
P::Public: Codec + Debug,
Block: BlockT,
Client: ProvideRuntimeApi<Block> + Send + Sync,
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public>,

CIDP: CreateInherentDataProviders<Block, ()>,
{
/// Creates a new Verifier instance for handling parachain block import verification in Aura
/// consensus.
pub fn new(
client: Arc<Client>,
inherent_data_provider: CIDP,
telemetry: Option<TelemetryHandle>,
) -> Self {
Self {
client,
create_inherent_data_providers: inherent_data_provider,
defender: Mutex::new(NaiveEquivocationDefender::default()),
telemetry,
_phantom: std::marker::PhantomData,
}
}
}

#[async_trait::async_trait]
impl<P, Client, Block, CIDP> VerifierT<Block> for Verifier<P, Client, Block, CIDP>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use futures::{Stream, StreamExt};
use polkadot_core_primitives::{Block, BlockNumber, Hash, Header};
use polkadot_overseer::{ChainApiBackend, RuntimeApiSubsystemClient};
use polkadot_primitives::{
async_backing::AsyncBackingParams, slashing, vstaging::async_backing::BackingState,
async_backing::AsyncBackingParams,
slashing,
vstaging::async_backing::{BackingState, Constraints},
ApprovalVotingParams, CoreIndex, NodeFeatures,
};
use sc_authority_discovery::{AuthorityDiscovery, Error as AuthorityDiscoveryError};
Expand Down Expand Up @@ -454,6 +456,14 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
.parachain_host_candidates_pending_availability(at, para_id)
.await?)
}

async fn backing_constraints(
&self,
at: Hash,
para_id: ParaId,
) -> Result<Option<Constraints>, ApiError> {
Ok(self.rpc_client.parachain_host_backing_constraints(at, para_id).await?)
}
}

#[async_trait::async_trait]
Expand Down
13 changes: 11 additions & 2 deletions cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use cumulus_primitives_core::{
async_backing::AsyncBackingParams,
slashing,
vstaging::{
async_backing::BackingState, CandidateEvent,
CommittedCandidateReceiptV2 as CommittedCandidateReceipt, CoreState,
async_backing::{BackingState, Constraints},
CandidateEvent, CommittedCandidateReceiptV2 as CommittedCandidateReceipt, CoreState,
ScrapedOnChainVotes,
},
ApprovalVotingParams, BlockNumber, CandidateCommitments, CandidateHash, CoreIndex,
Expand Down Expand Up @@ -720,6 +720,15 @@ impl RelayChainRpcClient {
.await
}

pub async fn parachain_host_backing_constraints(
&self,
at: RelayHash,
para_id: ParaId,
) -> Result<Option<Constraints>, RelayChainError> {
self.call_remote_runtime_function("ParachainHost_backing_constraints", at, Some(para_id))
.await
}

fn send_register_message_to_worker(
&self,
message: RpcDispatcherMessage,
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
invulnerables,
};
let session = pallet_session::GenesisConfig::<Test> { keys, ..Default::default() };
pallet_balances::GenesisConfig::<Test> { balances }
pallet_balances::GenesisConfig::<Test> { balances, ..Default::default() }
.assimilate_storage(&mut t)
.unwrap();
// collator selection must be initialized before session.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn genesis() -> Storage {
.cloned()
.map(|k| (k, ED * 4096 * 4096))
.collect(),
..Default::default()
},
parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub fn genesis() -> Storage {
system: asset_hub_westend_runtime::SystemConfig::default(),
balances: asset_hub_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: asset_hub_westend_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn genesis() -> Storage {
system: bridge_hub_rococo_runtime::SystemConfig::default(),
balances: bridge_hub_rococo_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: bridge_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn genesis() -> Storage {
system: bridge_hub_westend_runtime::SystemConfig::default(),
balances: bridge_hub_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: bridge_hub_westend_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn genesis() -> Storage {
system: collectives_westend_runtime::SystemConfig::default(),
balances: collectives_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: collectives_westend_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn genesis() -> Storage {
system: coretime_rococo_runtime::SystemConfig::default(),
balances: coretime_rococo_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: coretime_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn genesis() -> Storage {
system: coretime_westend_runtime::SystemConfig::default(),
balances: coretime_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: coretime_westend_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn genesis() -> Storage {
system: people_rococo_runtime::SystemConfig::default(),
balances: people_rococo_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: people_rococo_runtime::ParachainInfoConfig {
parachain_id: ParaId::from(PARA_ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn genesis() -> Storage {
system: people_westend_runtime::SystemConfig::default(),
balances: people_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: people_westend_runtime::ParachainInfoConfig {
parachain_id: ParaId::from(PARA_ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub fn genesis(para_id: u32) -> Storage {
system: penpal_runtime::SystemConfig::default(),
balances: penpal_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
..Default::default()
},
parachain_info: penpal_runtime::ParachainInfoConfig {
parachain_id: para_id.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub fn genesis() -> Storage {
system: rococo_runtime::SystemConfig::default(),
balances: rococo_runtime::BalancesConfig {
balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
..Default::default()
},
session: rococo_runtime::SessionConfig {
keys: validators::initial_authorities()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use emulated_integration_tests_common::{

// Rococo declaration
decl_test_relay_chains! {
#[api_version(11)]
#[api_version(12)]
pub struct Rococo {
genesis = genesis::genesis(),
on_init = (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub fn genesis() -> Storage {
system: westend_runtime::SystemConfig::default(),
balances: westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ENDOWMENT)).collect(),
..Default::default()
},
session: westend_runtime::SessionConfig {
keys: validators::initial_authorities()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use emulated_integration_tests_common::{

// Westend declaration
decl_test_relay_chains! {
#[api_version(11)]
#[api_version(12)]
pub struct Westend {
genesis = genesis::genesis(),
on_init = (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ xcm-emulator = { workspace = true, default-features = true }
# Bridges
bp-messages = { workspace = true, default-features = true }
bp-xcm-bridge-hub = { workspace = true, default-features = true }
bridge-runtime-common = { workspace = true, default-features = true }
pallet-bridge-messages = { workspace = true, default-features = true }
pallet-xcm-bridge-hub = { workspace = true, default-features = true }
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("westmint"),
impl_name: alloc::borrow::Cow::Borrowed("westmint"),
authoring_version: 1,
spec_version: 1_017_005,
spec_version: 1_017_006,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 16,
Expand Down Expand Up @@ -2189,6 +2189,10 @@ impl_runtime_apis! {
Revive::evm_balance(&address)
}

fn block_gas_limit() -> U256 {
Revive::evm_block_gas_limit()
}

fn nonce(address: H160) -> Nonce {
let account = <Runtime as pallet_revive::Config>::AddressMapper::to_account_id(&address);
System::account_nonce(account)
Expand Down
Loading

0 comments on commit f87272f

Please sign in to comment.