Skip to content

Commit

Permalink
chore(prover): remove legacy AggregationWrapper struct (#2617)
Browse files Browse the repository at this point in the history
Legacy structure handling was added to avoid problems when deploying
update.
  • Loading branch information
0xVolosnikov authored Aug 16, 2024
1 parent 6243399 commit cd6d648
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 49 deletions.
31 changes: 8 additions & 23 deletions prover/crates/bin/witness_generator/src/node_aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use zkevm_test_harness::witness::recursive_aggregation::{
compute_node_vk_commitment, create_node_witness,
};
use zksync_config::configs::FriWitnessGeneratorConfig;
use zksync_object_store::{ObjectStore, ObjectStoreError};
use zksync_object_store::ObjectStore;
use zksync_prover_dal::{ConnectionPool, Prover, ProverDal};
use zksync_prover_fri_types::{
circuit_definitions::{
Expand All @@ -34,7 +34,7 @@ use crate::{
metrics::WITNESS_GENERATOR_METRICS,
utils::{
load_proofs_for_job_ids, save_node_aggregations_artifacts,
save_recursive_layer_prover_input_artifacts, AggregationWrapper, AggregationWrapperLegacy,
save_recursive_layer_prover_input_artifacts, AggregationWrapper,
},
};

Expand Down Expand Up @@ -449,27 +449,12 @@ async fn get_artifacts(
circuit_id: metadata.circuit_id,
depth: metadata.depth,
};
let result = object_store.get(key).await;

// TODO: remove after transition
return match result {
Ok(aggregation_wrapper) => aggregation_wrapper,
Err(error) => {
// probably legacy struct is saved in GCS
if let ObjectStoreError::Serialization(serialization_error) = error {
let legacy_wrapper: AggregationWrapperLegacy =
object_store.get(key).await.unwrap_or_else(|inner_error| {
panic!(
"node aggregation job artifacts getting error. Key: {:?}, errors: {:?} {:?}",
key, serialization_error, inner_error
)
});
AggregationWrapper(legacy_wrapper.0.into_iter().map(|x| (x.0, x.1)).collect())
} else {
panic!("node aggregation job artifacts missing: {:?}", key)
}
}
};
object_store.get(key).await.unwrap_or_else(|error| {
panic!(
"node aggregation job artifacts getting error. Key: {:?}, error: {:?}",
key, error
)
})
}

#[tracing::instrument(
Expand Down
26 changes: 0 additions & 26 deletions prover/crates/bin/witness_generator/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,32 +97,6 @@ impl StoredObject for AggregationWrapper {
serialize_using_bincode!();
}

/// TODO: remove after transition
#[derive(serde::Serialize, serde::Deserialize)]
pub struct AggregationWrapperLegacy(
pub Vec<(
u64,
RecursionQueueSimulator<GoldilocksField>,
ZkSyncRecursiveLayerCircuit,
)>,
);

impl StoredObject for AggregationWrapperLegacy {
const BUCKET: Bucket = Bucket::NodeAggregationWitnessJobsFri;
type Key<'a> = AggregationsKey;

fn encode_key(key: Self::Key<'_>) -> String {
let AggregationsKey {
block_number,
circuit_id,
depth,
} = key;
format!("aggregations_{block_number}_{circuit_id}_{depth}.bin")
}

serialize_using_bincode!();
}

#[derive(serde::Serialize, serde::Deserialize)]
pub struct SchedulerPartialInputWrapper(
pub SchedulerCircuitInstanceWitness<
Expand Down

0 comments on commit cd6d648

Please sign in to comment.