Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion: Substrate#13869 #7119

Merged
merged 5 commits into from
May 24, 2023
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
368 changes: 184 additions & 184 deletions Cargo.lock

Large diffs are not rendered by default.

101 changes: 50 additions & 51 deletions node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,62 +214,61 @@ impl Initialized {
gum::trace!(target: LOG_TARGET, "Waiting for message");
let mut overlay_db = OverlayedBackend::new(backend);
let default_confirm = Box::new(|| Ok(()));
let confirm_write = match MuxedMessage::receive(ctx, &mut self.participation_receiver)
.await?
{
MuxedMessage::Participation(msg) => {
gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation");
let ParticipationStatement {
session,
candidate_hash,
candidate_receipt,
outcome,
} = self.participation.get_participation_result(ctx, msg).await?;
if let Some(valid) = outcome.validity() {
gum::trace!(
target: LOG_TARGET,
?session,
?candidate_hash,
?valid,
"Issuing local statement based on participation outcome."
);
self.issue_local_statement(
ctx,
&mut overlay_db,
let confirm_write =
match MuxedMessage::receive(ctx, &mut self.participation_receiver).await? {
MuxedMessage::Participation(msg) => {
gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation");
let ParticipationStatement {
session,
candidate_hash,
candidate_receipt,
session,
valid,
clock.now(),
)
.await?;
} else {
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed");
}
default_confirm
},
MuxedMessage::Subsystem(msg) => match msg {
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::ActiveLeaves");
self.process_active_leaves_update(
ctx,
&mut overlay_db,
update,
clock.now(),
)
.await?;
outcome,
} = self.participation.get_participation_result(ctx, msg).await?;
if let Some(valid) = outcome.validity() {
gum::trace!(
target: LOG_TARGET,
?session,
?candidate_hash,
?valid,
"Issuing local statement based on participation outcome."
);
self.issue_local_statement(
ctx,
&mut overlay_db,
candidate_hash,
candidate_receipt,
session,
valid,
clock.now(),
)
.await?;
} else {
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed");
}
default_confirm
},
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::BlockFinalized");
self.scraper.process_finalized_block(&n);
default_confirm
MuxedMessage::Subsystem(msg) => match msg {
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::ActiveLeaves");
self.process_active_leaves_update(
ctx,
&mut overlay_db,
update,
clock.now(),
)
.await?;
default_confirm
},
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::BlockFinalized");
self.scraper.process_finalized_block(&n);
default_confirm
},
FromOrchestra::Communication { msg } =>
self.handle_incoming(ctx, &mut overlay_db, msg, clock.now()).await?,
},
FromOrchestra::Communication { msg } =>
self.handle_incoming(ctx, &mut overlay_db, msg, clock.now()).await?,
},
};
};

if !overlay_db.is_empty() {
let ops = overlay_db.into_write_ops();
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/assigned_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ mod tests {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/auctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ mod tests {
type MaxLocks = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/crowdloan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/paras_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/slots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ mod tests {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
Expand Down
7 changes: 3 additions & 4 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<1>;
}

Expand Down Expand Up @@ -1284,7 +1284,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>;
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand All @@ -1299,7 +1299,6 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub storage NisTarget: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt);
}

impl pallet_nis::Config for Runtime {
Expand All @@ -1323,7 +1322,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle;
type HoldReason = NisHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sp_runtime::FixedPointNumber;

#[test]
fn nis_hold_reason_encoding_is_correct() {
assert_eq!(NisHoldReason::get().encode(), [38, 0]);
assert_eq!(RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt).encode(), [38, 0]);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion runtime/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
9 changes: 4 additions & 5 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<1>;
}

Expand Down Expand Up @@ -1225,7 +1225,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>;
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand All @@ -1240,7 +1240,6 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub storage NisTarget: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt);
}

impl pallet_nis::Config for Runtime {
Expand All @@ -1264,7 +1263,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle;
type HoldReason = NisHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

parameter_types! {
Expand Down Expand Up @@ -2301,7 +2300,7 @@ mod encoding_tests {

#[test]
fn nis_hold_reason_encoding_is_correct() {
assert_eq!(NisHoldReason::get().encode(), [38, 0]);
assert_eq!(RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt).encode(), [38, 0]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-builder/tests/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-simulator/example/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-simulator/example/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-simulator/fuzzer/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-simulator/fuzzer/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
Expand Down