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
1,004 changes: 590 additions & 414 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1399,9 +1399,9 @@ substrate-test-runtime-client = { path = "substrate/test-utils/runtime/client" }
substrate-test-runtime-transaction-pool = { path = "substrate/test-utils/runtime/transaction-pool" }
substrate-test-utils = { path = "substrate/test-utils" }
substrate-wasm-builder = { path = "substrate/utils/wasm-builder", default-features = false }
subxt = { version = "0.41", default-features = false }
subxt-metadata = { version = "0.41", default-features = false }
subxt-signer = { version = "0.41" }
subxt = { version = "0.43", default-features = false }
subxt-metadata = { version = "0.43", default-features = false }
subxt-signer = { version = "0.43" }
syn = { version = "2.0.87" }
sysinfo = { version = "0.30" }
tar = { version = "0.4" }
Expand Down Expand Up @@ -1473,9 +1473,9 @@ xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features =
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
yet-another-parachain-runtime = { path = "cumulus/parachains/runtimes/testing/yet-another-parachain" }
zeroize = { version = "1.7.0", default-features = false }
zombienet-configuration = { version = "0.3.8" }
zombienet-orchestrator = { version = "0.3.8" }
zombienet-sdk = { version = "0.3.8" }
zombienet-configuration = { version = "0.3.12" }
zombienet-orchestrator = { version = "0.3.12" }
zombienet-sdk = { version = "0.3.12" }
zstd = { version = "0.12.4", default-features = false }

[profile.release]
Expand Down
10 changes: 3 additions & 7 deletions cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use tokio::{
use zombienet_sdk::subxt::{
self,
blocks::Block,
config::{signed_extensions::CheckMortalityParams, substrate::DigestItem, ExtrinsicParams},
config::{polkadot::PolkadotExtrinsicParamsBuilder, substrate::DigestItem},
dynamic::Value,
events::Events,
ext::scale_value::value,
tx::{signer::Signer, DynamicPayload, TxStatus},
utils::H256,
Config, OnlineClient, PolkadotConfig,
OnlineClient, PolkadotConfig,
};

// Maximum number of blocks to wait for a session change.
Expand Down Expand Up @@ -303,11 +303,7 @@ pub async fn submit_extrinsic_and_wait_for_finalization_success<S: Signer<Polkad
call: &DynamicPayload,
signer: &S,
) -> Result<(), anyhow::Error> {
let mut extensions: <<PolkadotConfig as Config>::ExtrinsicParams as ExtrinsicParams<
PolkadotConfig,
>>::Params = Default::default();

extensions.4 = CheckMortalityParams::<PolkadotConfig>::immortal();
let extensions = PolkadotExtrinsicParamsBuilder::new().immortal().build();

let mut tx = client
.tx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use anyhow::anyhow;
use sp_core::{Bytes, Encode};
use zombienet_sdk::{
subxt::{
backend::rpc::RpcClient, rpc_params, utils::url_is_secure, OnlineClient, PolkadotConfig,
backend::rpc::RpcClient, ext::subxt_rpcs::rpc_params, utils::url_is_secure, OnlineClient,
PolkadotConfig,
},
NetworkConfigBuilder,
};
Expand Down
2 changes: 1 addition & 1 deletion polkadot/zombienet-sdk-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ log = { workspace = true }
polkadot-primitives = { workspace = true, default-features = true }
serde = { workspace = true }
serde_json = { workspace = true }
subxt = { version = "0.38.1", default-features = false }
subxt = { workspace = true, default-features = false }
tokio = { workspace = true, features = ["rt-multi-thread"] }
tokio-util = { workspace = true, features = ["time"] }
zombienet-orchestrator = { workspace = true }
Expand Down
16 changes: 8 additions & 8 deletions polkadot/zombienet-sdk-tests/tests/disabling/slashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! making some of the honest nodes go offline.

use anyhow::anyhow;
use codec::Decode;
use cumulus_zombienet_sdk_helpers::{
assert_blocks_are_being_finalized, assert_para_throughput, wait_for_first_session_change,
};
Expand Down Expand Up @@ -106,14 +107,13 @@ async fn dispute_past_session_slashing() -> Result<(), anyhow::Error> {
while let Some(block) = best_blocks.next().await {
// NOTE: we can't use `at_latest` here, because it will utilize latest *finalized* block
// and finality is stalled...
let disputes = relay_client
.runtime_api()
.at(block?.hash())
.call_raw::<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>>(
"ParachainHost_disputes",
None,
)
.await?;
let disputes = Vec::<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>::decode(
&mut &relay_client
.runtime_api()
.at(block?.hash())
.call_raw("ParachainHost_disputes", None)
.await?[..],
)?;
if let Some((session, _, _)) = disputes.first() {
dispute_session = *session;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// itself if ElasticScalingMVP feature is enabled in genesis.

use anyhow::anyhow;
use codec::Decode;
use cumulus_zombienet_sdk_helpers::{
assert_finality_lag, assert_para_throughput, create_assign_core_call,
};
Expand Down Expand Up @@ -93,12 +94,14 @@ async fn doesnt_break_parachains_test() -> Result<(), anyhow::Error> {
assert_finality_lag(&para_client, 6).await?;

// Sanity check that indeed the parachain has two assigned cores.
let cq = relay_client
.runtime_api()
.at_latest()
.await?
.call_raw::<BTreeMap<CoreIndex, VecDeque<ParaId>>>("ParachainHost_claim_queue", None)
.await?;
let cq = BTreeMap::<CoreIndex, VecDeque<ParaId>>::decode(
&mut &relay_client
.runtime_api()
.at_latest()
.await?
.call_raw("ParachainHost_claim_queue", None)
.await?[..],
)?;

assert_eq!(
cq,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Test checks that misbehaving validators disabled.
use anyhow::anyhow;
use codec::Decode;
use cumulus_zombienet_sdk_helpers::assert_para_throughput;
use polkadot_primitives::{
BlockNumber, CandidateHash, DisputeState, SessionIndex, ValidatorId, ValidatorIndex,
Expand Down Expand Up @@ -100,14 +101,13 @@ async fn validator_disabling_test() -> Result<(), anyhow::Error> {
// Check next new block from the current best fork
while let Some(block) = best_blocks.next().await {
let current_hash = block?.hash();
let disputes = relay_client
.runtime_api()
.at(current_hash)
.call_raw::<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>>(
"ParachainHost_disputes",
None,
)
.await?;
let disputes = Vec::<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>::decode(
&mut &relay_client
.runtime_api()
.at(current_hash)
.call_raw("ParachainHost_disputes", None)
.await?[..],
)?;
if let Some((session, _, _)) = disputes.first() {
block_hash = Some(current_hash);
dispute_session = *session;
Expand All @@ -129,19 +129,23 @@ async fn validator_disabling_test() -> Result<(), anyhow::Error> {
.wait_metric_with_timeout(concluded_dispute_metric, |d| d >= 1.0, 200_u64)
.await?;

let disabled_validators = relay_client
.runtime_api()
.at(block_hash.unwrap())
.call_raw::<Vec<ValidatorIndex>>("ParachainHost_disabled_validators", None)
.await?;
let disabled_validators = Vec::<ValidatorIndex>::decode(
&mut &relay_client
.runtime_api()
.at(block_hash.unwrap())
.call_raw("ParachainHost_disabled_validators", None)
.await?[..],
)?;
// We should have at least one disable validator.
assert!(!disabled_validators.is_empty());

let session_validators = relay_client
.runtime_api()
.at(block_hash.unwrap())
.call_raw::<Vec<ValidatorId>>("ParachainHost_validators", None)
.await?;
let session_validators = Vec::<ValidatorId>::decode(
&mut &relay_client
.runtime_api()
.at(block_hash.unwrap())
.call_raw("ParachainHost_validators", None)
.await?[..],
)?;
// We have a single malicious node, hence the index of the malus-node is the first
// entry in the disabled validators list.
let disabled_node_public_address = &session_validators[(disabled_validators[0].0) as usize];
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/migrations/src/mock_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ impl SteppedMigrations for MockedMigrations {

Some(match kind {
SucceedAfter => {
log::debug!("MockedMigration: Succeeded after {} steps", count);
log::debug!("MockedMigration: Succeeded after {count} steps");
Ok(None)
},
HighWeightAfter(required) => {
log::debug!("MockedMigration: Not enough weight after {} steps", count);
log::debug!("MockedMigration: Not enough weight after {count} steps");
Err(SteppedMigrationError::InsufficientWeight { required })
},
FailAfter => {
log::debug!("MockedMigration: Failed after {} steps", count);
log::debug!("MockedMigration: Failed after {count} steps");
Err(SteppedMigrationError::Failed)
},
TimeoutAfter => unreachable!(),
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/revive/rpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use subxt::{
RpcClient,
},
},
config::Header,
config::{HashFor, Header},
Config, OnlineClient,
};
use thiserror::Error;
Expand All @@ -67,7 +67,7 @@ pub type SubstrateBlockHeader = <SrcChainConfig as Config>::Header;
pub type SubstrateBlockNumber = <SubstrateBlockHeader as Header>::Number;

/// The substrate block hash type.
pub type SubstrateBlockHash = <SrcChainConfig as Config>::Hash;
pub type SubstrateBlockHash = HashFor<SrcChainConfig>;

/// The runtime balance type.
pub type Balance = u128;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
// limitations under the License.

use crate::extrinsic::ExtrinsicBuilder;
use codec::Decode;
use codec::{Decode, Encode};
use sc_client_api::UsageProvider;
use sp_api::{ApiExt, Core, Metadata, ProvideRuntimeApi};
use sp_runtime::{traits::Block as BlockT, OpaqueExtrinsic};
use std::sync::Arc;
use subxt::{
client::RuntimeVersion as SubxtRuntimeVersion,
config::substrate::SubstrateExtrinsicParamsBuilder, Config, OfflineClient, SubstrateConfig,
config::{substrate::SubstrateExtrinsicParamsBuilder, HashFor},
Config, OfflineClient, SubstrateConfig,
};

pub type SubstrateRemarkBuilder = DynamicRemarkBuilder<SubstrateConfig>;
Expand All @@ -34,14 +35,14 @@ pub struct DynamicRemarkBuilder<C: Config> {
offline_client: OfflineClient<C>,
}

impl<C: Config<Hash = subxt::utils::H256>> DynamicRemarkBuilder<C> {
impl<C: Config> DynamicRemarkBuilder<C> {
/// Initializes a new remark builder from a client.
///
/// This will first fetch metadata and runtime version from the runtime and then
/// construct an offline client that provides the extrinsics.
pub fn new_from_client<Client, Block>(client: Arc<Client>) -> sc_cli::Result<Self>
where
Block: BlockT<Hash = sp_core::H256>,
Block: BlockT,
Client: UsageProvider<Block> + ProvideRuntimeApi<Block>,
Client::Api: Metadata<Block> + Core<Block>,
{
Expand All @@ -60,9 +61,6 @@ impl<C: Config<Hash = subxt::utils::H256>> DynamicRemarkBuilder<C> {

let latest = supported_metadata_versions
.into_iter()
// TODO: Subxt doesn't support V16 metadata until v0.42.0, so don't try
// to fetch it here until we update to that version.
.filter(|v| *v != u32::MAX && *v < 16)
.max()
.ok_or("No stable metadata versions supported".to_string())?;

Expand All @@ -81,7 +79,8 @@ impl<C: Config<Hash = subxt::utils::H256>> DynamicRemarkBuilder<C> {
transaction_version: version.transaction_version,
};
let metadata = subxt::Metadata::decode(&mut (*opaque_metadata).as_slice())?;
let genesis = subxt::utils::H256::from(genesis.to_fixed_bytes());
let genesis = HashFor::<C>::decode(&mut &genesis.encode()[..])
.map_err(|_| "Incompatible hash types?")?;

Ok(Self { offline_client: OfflineClient::new(genesis, runtime_version, metadata) })
}
Expand All @@ -91,7 +90,7 @@ impl<C: Config> DynamicRemarkBuilder<C> {
/// Constructs a new remark builder.
pub fn new(
metadata: subxt::Metadata,
genesis_hash: C::Hash,
genesis_hash: HashFor<C>,
runtime_version: SubxtRuntimeVersion,
) -> Self {
Self { offline_client: OfflineClient::new(genesis_hash, runtime_version, metadata) }
Expand Down
Loading