mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 13:41:08 +00:00
av-store: clean up StoreAvailableData message (#3984)
* av-store: clean up StoreAvailableData message * fmt * use named fields
This commit is contained in:
@@ -294,20 +294,18 @@ fn table_attested_to_backed(
|
||||
|
||||
async fn store_available_data(
|
||||
sender: &mut JobSender<impl SubsystemSender>,
|
||||
id: Option<ValidatorIndex>,
|
||||
n_validators: u32,
|
||||
candidate_hash: CandidateHash,
|
||||
available_data: AvailableData,
|
||||
) -> Result<(), Error> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send_message(AvailabilityStoreMessage::StoreAvailableData(
|
||||
.send_message(AvailabilityStoreMessage::StoreAvailableData {
|
||||
candidate_hash,
|
||||
id,
|
||||
n_validators,
|
||||
available_data,
|
||||
tx,
|
||||
))
|
||||
})
|
||||
.await;
|
||||
|
||||
let _ = rx.await.map_err(Error::StoreAvailableData)?;
|
||||
@@ -321,7 +319,6 @@ async fn store_available_data(
|
||||
// This returns `Err()` iff there is an internal error. Otherwise, it returns either `Ok(Ok(()))` or `Ok(Err(_))`.
|
||||
async fn make_pov_available(
|
||||
sender: &mut JobSender<impl SubsystemSender>,
|
||||
validator_index: Option<ValidatorIndex>,
|
||||
n_validators: usize,
|
||||
pov: Arc<PoV>,
|
||||
candidate_hash: CandidateHash,
|
||||
@@ -347,14 +344,7 @@ async fn make_pov_available(
|
||||
{
|
||||
let _span = span.as_ref().map(|s| s.child("store-data").with_candidate(candidate_hash));
|
||||
|
||||
store_available_data(
|
||||
sender,
|
||||
validator_index,
|
||||
n_validators as u32,
|
||||
candidate_hash,
|
||||
available_data,
|
||||
)
|
||||
.await?;
|
||||
store_available_data(sender, n_validators as u32, candidate_hash, available_data).await?;
|
||||
}
|
||||
|
||||
Ok(Ok(()))
|
||||
@@ -409,7 +399,6 @@ struct BackgroundValidationParams<S: overseer::SubsystemSender<AllMessages>, F>
|
||||
candidate: CandidateReceipt,
|
||||
relay_parent: Hash,
|
||||
pov: PoVData,
|
||||
validator_index: Option<ValidatorIndex>,
|
||||
n_validators: usize,
|
||||
span: Option<jaeger::Span>,
|
||||
make_command: F,
|
||||
@@ -427,7 +416,6 @@ async fn validate_and_make_available(
|
||||
candidate,
|
||||
relay_parent,
|
||||
pov,
|
||||
validator_index,
|
||||
n_validators,
|
||||
span,
|
||||
make_command,
|
||||
@@ -484,7 +472,6 @@ async fn validate_and_make_available(
|
||||
} else {
|
||||
let erasure_valid = make_pov_available(
|
||||
&mut sender,
|
||||
validator_index,
|
||||
n_validators,
|
||||
pov.clone(),
|
||||
candidate.hash(),
|
||||
@@ -719,7 +706,6 @@ impl CandidateBackingJob {
|
||||
candidate: candidate.clone(),
|
||||
relay_parent: self.parent,
|
||||
pov: PoVData::Ready(pov),
|
||||
validator_index: self.table_context.validator.as_ref().map(|v| v.index()),
|
||||
n_validators: self.table_context.validators.len(),
|
||||
span,
|
||||
make_command: ValidatedCandidateCommand::Second,
|
||||
@@ -1033,7 +1019,6 @@ impl CandidateBackingJob {
|
||||
candidate: attesting.candidate,
|
||||
relay_parent: self.parent,
|
||||
pov,
|
||||
validator_index: self.table_context.validator.as_ref().map(|v| v.index()),
|
||||
n_validators: self.table_context.validators.len(),
|
||||
span,
|
||||
make_command: ValidatedCandidateCommand::Attest,
|
||||
|
||||
@@ -336,7 +336,7 @@ fn backing_second_works() {
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::AvailabilityStore(
|
||||
AvailabilityStoreMessage::StoreAvailableData(candidate_hash, _, _, _, tx)
|
||||
AvailabilityStoreMessage::StoreAvailableData { candidate_hash, tx, .. }
|
||||
) if candidate_hash == candidate.hash() => {
|
||||
tx.send(Ok(())).unwrap();
|
||||
}
|
||||
@@ -495,7 +495,7 @@ fn backing_works() {
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::AvailabilityStore(
|
||||
AvailabilityStoreMessage::StoreAvailableData(candidate_hash, _, _, _, tx)
|
||||
AvailabilityStoreMessage::StoreAvailableData { candidate_hash, tx, .. }
|
||||
) if candidate_hash == candidate_a.hash() => {
|
||||
tx.send(Ok(())).unwrap();
|
||||
}
|
||||
@@ -853,7 +853,7 @@ fn backing_misbehavior_works() {
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::AvailabilityStore(
|
||||
AvailabilityStoreMessage::StoreAvailableData(candidate_hash, _, _, _, tx)
|
||||
AvailabilityStoreMessage::StoreAvailableData { candidate_hash, tx, .. }
|
||||
) if candidate_hash == candidate_a.hash() => {
|
||||
tx.send(Ok(())).unwrap();
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ fn backing_dont_second_invalid() {
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::AvailabilityStore(
|
||||
AvailabilityStoreMessage::StoreAvailableData(candidate_hash, _, _, _, tx)
|
||||
AvailabilityStoreMessage::StoreAvailableData { candidate_hash, tx, .. }
|
||||
) if candidate_hash == candidate_b.hash() => {
|
||||
tx.send(Ok(())).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user