Companion: Substrate#13869 (#7119)

* Companion: Substrate#13869

https://github.com/paritytech/substrate/pull/13869

* update lockfile for {"substrate"}

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Bastian Köcher
2023-05-25 00:36:56 +02:00
committed by GitHub
parent c74737e395
commit 28de4f1337
25 changed files with 262 additions and 265 deletions
+184 -184
View File
File diff suppressed because it is too large Load Diff
@@ -214,62 +214,61 @@ impl Initialized {
gum::trace!(target: LOG_TARGET, "Waiting for message"); gum::trace!(target: LOG_TARGET, "Waiting for message");
let mut overlay_db = OverlayedBackend::new(backend); let mut overlay_db = OverlayedBackend::new(backend);
let default_confirm = Box::new(|| Ok(())); let default_confirm = Box::new(|| Ok(()));
let confirm_write = match MuxedMessage::receive(ctx, &mut self.participation_receiver) let confirm_write =
.await? match MuxedMessage::receive(ctx, &mut self.participation_receiver).await? {
{ MuxedMessage::Participation(msg) => {
MuxedMessage::Participation(msg) => { gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation");
gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation"); let ParticipationStatement {
let ParticipationStatement { session,
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,
candidate_hash, candidate_hash,
candidate_receipt, candidate_receipt,
session, outcome,
valid, } = self.participation.get_participation_result(ctx, msg).await?;
clock.now(), if let Some(valid) = outcome.validity() {
) gum::trace!(
.await?; target: LOG_TARGET,
} else { ?session,
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed"); ?candidate_hash,
} ?valid,
default_confirm "Issuing local statement based on participation outcome."
}, );
MuxedMessage::Subsystem(msg) => match msg { self.issue_local_statement(
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()), ctx,
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => { &mut overlay_db,
gum::trace!(target: LOG_TARGET, "OverseerSignal::ActiveLeaves"); candidate_hash,
self.process_active_leaves_update( candidate_receipt,
ctx, session,
&mut overlay_db, valid,
update, clock.now(),
clock.now(), )
) .await?;
.await?; } else {
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed");
}
default_confirm default_confirm
}, },
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => { MuxedMessage::Subsystem(msg) => match msg {
gum::trace!(target: LOG_TARGET, "OverseerSignal::BlockFinalized"); FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
self.scraper.process_finalized_block(&n); FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
default_confirm 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() { if !overlay_db.is_empty() {
let ops = overlay_db.into_write_ops(); let ops = overlay_db.into_write_ops();
@@ -631,7 +631,7 @@ mod tests {
type MaxLocks = (); type MaxLocks = ();
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -748,7 +748,7 @@ mod tests {
type MaxLocks = (); type MaxLocks = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -787,7 +787,7 @@ mod tests {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -945,7 +945,7 @@ mod tests {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -186,7 +186,7 @@ mod tests {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
@@ -183,7 +183,7 @@ impl pallet_balances::Config for Test {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -755,7 +755,7 @@ mod tests {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -553,7 +553,7 @@ mod tests {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+1 -1
View File
@@ -568,7 +568,7 @@ mod tests {
type MaxLocks = (); type MaxLocks = ();
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
+3 -4
View File
@@ -306,7 +306,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxFreezes = (); type MaxFreezes = ();
type HoldIdentifier = RuntimeHoldReason; type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
} }
@@ -1284,7 +1284,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxReserves = ConstU32<4>; type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>;
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -1299,7 +1299,6 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5); pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub storage NisTarget: Perquintill = Perquintill::zero(); pub storage NisTarget: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis "); pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt);
} }
impl pallet_nis::Config for Runtime { impl pallet_nis::Config for Runtime {
@@ -1323,7 +1322,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod; type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight; type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle; type ThawThrottle = ThawThrottle;
type HoldReason = NisHoldReason; type RuntimeHoldReason = RuntimeHoldReason;
} }
parameter_types! { parameter_types! {
+1 -1
View File
@@ -27,7 +27,7 @@ use sp_runtime::FixedPointNumber;
#[test] #[test]
fn nis_hold_reason_encoding_is_correct() { 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] #[test]
+1 -1
View File
@@ -134,7 +134,7 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
+1 -1
View File
@@ -299,7 +299,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
+4 -5
View File
@@ -287,7 +287,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>; type MaxFreezes = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason; type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<1>; type MaxHolds = ConstU32<1>;
} }
@@ -1225,7 +1225,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxReserves = ConstU32<4>; type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>;
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -1240,7 +1240,6 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5); pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub storage NisTarget: Perquintill = Perquintill::zero(); pub storage NisTarget: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis "); pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt);
} }
impl pallet_nis::Config for Runtime { impl pallet_nis::Config for Runtime {
@@ -1264,7 +1263,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod; type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight; type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle; type ThawThrottle = ThawThrottle;
type HoldReason = NisHoldReason; type RuntimeHoldReason = RuntimeHoldReason;
} }
parameter_types! { parameter_types! {
@@ -2301,7 +2300,7 @@ mod encoding_tests {
#[test] #[test]
fn nis_hold_reason_encoding_is_correct() { 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]);
} }
} }
+1 -1
View File
@@ -218,7 +218,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
+1 -1
View File
@@ -264,7 +264,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -93,7 +93,7 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type WeightInfo = (); type WeightInfo = ();
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
+1 -1
View File
@@ -243,7 +243,7 @@ impl pallet_balances::Config for Test {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
+1 -1
View File
@@ -117,7 +117,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -106,7 +106,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -92,7 +92,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -96,7 +96,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
@@ -91,7 +91,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = MaxReserves; type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type HoldIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;