Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_state_witness_parts cannot fail #12645

Merged
merged 3 commits into from
Jan 2, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,11 @@ impl PartialWitnessActor {
witness_bytes,
&chunk_validators,
&signer,
)?;
);

if !contract_deploys.is_empty() {
self.send_chunk_contract_deploys_parts(key, contract_deploys)?;
}

Ok(())
}

Expand All @@ -256,7 +255,7 @@ impl PartialWitnessActor {
witness_bytes: EncodedChunkStateWitness,
chunk_validators: &[AccountId],
signer: &ValidatorSigner,
) -> Result<Vec<(AccountId, PartialEncodedStateWitness)>, Error> {
) -> Vec<(AccountId, PartialEncodedStateWitness)> {
tracing::debug!(
target: "client",
chunk_hash=?chunk_header.chunk_hash(),
Expand All @@ -268,7 +267,7 @@ impl PartialWitnessActor {
let encoder = self.witness_encoders.entry(chunk_validators.len());
let (parts, encoded_length) = encoder.encode(&witness_bytes);

Ok(chunk_validators
chunk_validators
.iter()
.zip_eq(parts)
.enumerate()
Expand All @@ -285,7 +284,7 @@ impl PartialWitnessActor {
);
(chunk_validator.clone(), partial_witness)
})
.collect_vec())
.collect_vec()
}

fn generate_contract_deploys_parts(
Expand Down Expand Up @@ -333,7 +332,7 @@ impl PartialWitnessActor {
witness_bytes: EncodedChunkStateWitness,
chunk_validators: &[AccountId],
signer: &ValidatorSigner,
) -> Result<(), Error> {
) {
// Capture these values first, as the sources are consumed before calling record_witness_sent.
let chunk_hash = chunk_header.chunk_hash();
let witness_size_in_bytes = witness_bytes.size_bytes();
Expand All @@ -349,7 +348,7 @@ impl PartialWitnessActor {
witness_bytes,
chunk_validators,
signer,
)?;
);
encode_timer.observe_duration();

// Record the witness in order to match the incoming acks for measuring round-trip times.
Expand All @@ -364,7 +363,6 @@ impl PartialWitnessActor {
self.network_adapter.send(PeerManagerMessageRequest::NetworkRequests(
NetworkRequests::PartialEncodedStateWitness(validator_witness_tuple),
));
Ok(())
}

/// Sends the witness part to the chunk validators, except the chunk producer that generated the witness part.
Expand Down
Loading