Skip to content

Commit

Permalink
Merge branch 'master' into remove-networkids
Browse files Browse the repository at this point in the history
  • Loading branch information
programskillforverification committed Aug 17, 2024
2 parents 1cfe2ca + fd522b8 commit b0868ab
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 123 deletions.
13 changes: 0 additions & 13 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ members = [
"substrate/utils/prometheus",
"substrate/utils/substrate-bip39",
"substrate/utils/wasm-builder",
"templates/minimal",
"templates/minimal/node",
"templates/minimal/pallets/template",
"templates/minimal/runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ case "$1" in
"//Alice" \
1000 \
"ws://127.0.0.1:9910" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Westend" } } }')" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Westend" }] } }')" \
"$GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT" \
10000000000 \
true
Expand Down Expand Up @@ -329,7 +329,7 @@ case "$1" in
"//Alice" \
1000 \
"ws://127.0.0.1:9010" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Rococo" } } }')" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Rococo" }] } }')" \
"$GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT" \
10000000000 \
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function run(nodeName, networkInfo, args) {
const bridgedNetworkName = args[2];
while (true) {
const foreignAssetAccount = await api.query.foreignAssets.account(
{ parents: 2, interior: { X1: { GlobalConsensus: bridgedNetworkName } } },
{ parents: 2, interior: { X1: [{ GlobalConsensus: bridgedNetworkName }] } },
accountAddress
);
if (foreignAssetAccount.isSome) {
Expand Down
13 changes: 13 additions & 0 deletions polkadot/node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,12 @@ impl Initialized {
}
}
for validator_index in new_state.votes().invalid.keys() {
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?validator_index,
"Disabled offchain for voting invalid against a valid candidate",
);
self.offchain_disabled_validators
.insert_against_valid(session, *validator_index);
}
Expand All @@ -1375,6 +1381,13 @@ impl Initialized {
}
for (validator_index, (kind, _sig)) in new_state.votes().valid.raw() {
let is_backer = kind.is_backing();
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?validator_index,
?is_backer,
"Disabled offchain for voting valid for an invalid candidate",
);
self.offchain_disabled_validators.insert_for_invalid(
session,
*validator_index,
Expand Down
12 changes: 12 additions & 0 deletions polkadot/node/core/dispute-coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,18 @@ pub fn is_potential_spam(
let all_invalid_votes_disabled = vote_state.invalid_votes_all_disabled(is_disabled);
let ignore_disabled = !is_confirmed && all_invalid_votes_disabled;

gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?is_disputed,
?is_included,
?is_backed,
?is_confirmed,
?all_invalid_votes_disabled,
?ignore_disabled,
"Checking for potential spam"
);

(is_disputed && !is_included && !is_backed && !is_confirmed) || ignore_disabled
}

Expand Down
11 changes: 8 additions & 3 deletions polkadot/node/network/approval-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2508,14 +2508,18 @@ impl ApprovalDistribution {
};


self.handle_from_orchestra(message, &mut approval_voting_sender, &mut network_sender, state, rng).await;
if self.handle_from_orchestra(message, &mut approval_voting_sender, &mut network_sender, state, rng).await {
return;
}

},
}
}
}

/// Handles a from orchestra message received by approval distribution subystem.
///
/// Returns `true` if the subsystem should be stopped.
pub async fn handle_from_orchestra<
N: overseer::SubsystemSender<NetworkBridgeTxMessage>,
A: overseer::SubsystemSender<ApprovalVotingMessage>,
Expand All @@ -2526,7 +2530,7 @@ impl ApprovalDistribution {
network_sender: &mut N,
state: &mut State,
rng: &mut (impl CryptoRng + Rng),
) {
) -> bool {
match message {
FromOrchestra::Communication { msg } =>
Self::handle_incoming(
Expand Down Expand Up @@ -2555,8 +2559,9 @@ impl ApprovalDistribution {
gum::trace!(target: LOG_TARGET, number = %number, "finalized signal");
state.handle_block_finalized(network_sender, &self.metrics, number).await;
},
FromOrchestra::Signal(OverseerSignal::Conclude) => return,
FromOrchestra::Signal(OverseerSignal::Conclude) => return true,
}
false
}

async fn handle_incoming<
Expand Down
12 changes: 9 additions & 3 deletions polkadot/node/network/approval-distribution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
let subsystem = ApprovalDistribution::new(Default::default());
{
let mut rng = rand_chacha::ChaCha12Rng::seed_from_u64(12345);

let subsystem =
subsystem.run_inner(context, &mut state, REPUTATION_CHANGE_TEST_INTERVAL, &mut rng);
let (tx, rx) = oneshot::channel();
let subsystem = async {
subsystem
.run_inner(context, &mut state, REPUTATION_CHANGE_TEST_INTERVAL, &mut rng)
.await;
tx.send(()).expect("Fail to notify subystem is done");
};

let test_fut = test_fn(virtual_overseer);

Expand All @@ -76,6 +80,8 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
.timeout(TIMEOUT)
.await
.expect("Conclude send timeout");
let _ =
rx.timeout(Duration::from_secs(2)).await.expect("Subsystem did not conclude");
},
subsystem,
));
Expand Down
13 changes: 13 additions & 0 deletions prdoc/pr_5204.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: "Pallet assets: fix doc: start_destroy never required asset to be frozen"

doc:
- audience: Runtime Dev
description: |
In pallet assets calling `start_destroy` doesn't require the asset to be frozen. Doc is fixed.


crates:
- name: pallet-assets
bump: patch
- name: frame-support
bump: patch
11 changes: 11 additions & 0 deletions prdoc/pr_5252.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Additional logging in `dispute-coordinator` subsystem

doc:
- audience: Node Dev
description: |
Additional logging in `dispute-coordinator` subsystem tracing the list of offchain disabled
validators and the reason why an import statement is considered spam.

crates:
- name: polkadot-node-core-dispute-coordinator
bump: patch
2 changes: 0 additions & 2 deletions substrate/frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,8 +801,6 @@ pub mod pallet {
///
/// - `id`: The identifier of the asset to be destroyed. This must identify an existing
/// asset.
///
/// The asset class must be frozen before calling `start_destroy`.
#[pallet::call_index(2)]
pub fn start_destroy(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let maybe_check_owner = match T::ForceOrigin::try_origin(origin) {
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/support/src/traits/tokens/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub enum WithdrawConsequence<Balance> {
/// There has been an overflow in the system. This is indicative of a corrupt state and
/// likely unrecoverable.
Overflow,
/// Not enough of the funds in the account are unavailable for withdrawal.
/// Not enough of the funds in the account are available for withdrawal.
Frozen,
/// Account balance would reduce to zero, potentially destroying it. The parameter is the
/// amount of balance which is destroyed.
Expand Down
22 changes: 0 additions & 22 deletions templates/minimal/Cargo.toml

This file was deleted.

75 changes: 0 additions & 75 deletions templates/minimal/src/lib.rs

This file was deleted.

0 comments on commit b0868ab

Please sign in to comment.