Skip to content

Commit f36b128

Browse files
authored
chore: Remove legacy prover code (#4357)
## What ❔ Remove bincode encoding for prover-related types(ones involved in both prover and core) Remove API mode config option. So, after this PR it will be not possible to: * Run proof data handler in server mode * Run prover gateway in client mode * Save/get files(like witness inputs/final proofs) from Object store which are encoded with bincode ## Why ❔ This code was left in codebase for the sake of backwards compatibility. Now, since these changes were introduced in protocol version 27, it is "safe" to remove them in version 29. ## Is this a breaking change? - [x] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
1 parent 9ea3c37 commit f36b128

File tree

25 files changed

+93
-1064
lines changed

25 files changed

+93
-1064
lines changed

core/bin/zksync_server/src/node_builder.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,10 @@ impl MainNodeBuilder {
334334
}
335335

336336
fn add_proof_data_handler_layer(mut self) -> anyhow::Result<Self> {
337-
let gateway_config = try_load_config!(self.configs.prover_gateway);
338-
let eth_proof_manager_config = self.configs.eth_proof_manager.clone();
339-
let l2_chain_id = self.genesis_config.l2_chain_id;
340-
341337
self.node.add_layer(ProofDataHandlerLayer::new(
342338
try_load_config!(self.configs.proof_data_handler_config),
343-
eth_proof_manager_config,
344-
l2_chain_id,
345-
gateway_config.api_mode,
339+
self.configs.eth_proof_manager.clone(),
340+
self.genesis_config.l2_chain_id,
346341
));
347342
Ok(self)
348343
}

core/lib/config/src/configs/fri_prover_gateway.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
11
use std::time::Duration;
22

3-
use serde::{Deserialize, Serialize};
4-
use smart_config::{
5-
de::{Serde, WellKnown},
6-
DescribeConfig, DeserializeConfig,
7-
};
3+
use smart_config::{DescribeConfig, DeserializeConfig};
84

95
#[derive(Debug, Clone, PartialEq, DescribeConfig, DeserializeConfig)]
106
pub struct FriProverGatewayConfig {
117
pub api_url: String,
128
#[config(default_t = Duration::from_secs(1000))]
139
pub api_poll_duration: Duration,
14-
#[config(default)]
15-
pub api_mode: ApiMode,
1610
pub port: Option<u16>,
1711
// Configurations for prometheus
1812
pub prometheus_listener_port: Option<u16>,
1913
}
2014

21-
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
22-
pub enum ApiMode {
23-
/// The legacy API mode, which is compatible with the old prover API.
24-
#[default]
25-
Legacy,
26-
/// The new API mode, which is compatible with the prover cluster API.
27-
ProverCluster,
28-
}
29-
30-
impl WellKnown for ApiMode {
31-
type Deserializer = Serde![str];
32-
const DE: Self::Deserializer = Serde![str];
33-
}
34-
3515
#[cfg(test)]
3616
mod tests {
3717
use smart_config::{testing::test_complete, Environment, Yaml};
@@ -42,7 +22,6 @@ mod tests {
4222
FriProverGatewayConfig {
4323
api_url: "http://private-dns-for-server".to_string(),
4424
api_poll_duration: Duration::from_secs(100),
45-
api_mode: ApiMode::ProverCluster,
4625
port: Some(8080),
4726
prometheus_listener_port: Some(3316),
4827
}
@@ -53,7 +32,6 @@ mod tests {
5332
let env = r#"
5433
FRI_PROVER_GATEWAY_API_URL="http://private-dns-for-server"
5534
FRI_PROVER_GATEWAY_API_POLL_DURATION_SECS="100"
56-
FRI_PROVER_GATEWAY_API_MODE=ProverCluster
5735
FRI_PROVER_GATEWAY_PORT=8080
5836
FRI_PROVER_GATEWAY_PROMETHEUS_LISTENER_PORT=3316
5937
"#;
@@ -70,7 +48,6 @@ mod tests {
7048
let yaml = r#"
7149
api_url: http://private-dns-for-server
7250
api_poll_duration_secs: 100
73-
api_mode: ProverCluster
7451
port: 8080
7552
prometheus_listener_port: 3316
7653
"#;

core/lib/prover_interface/src/inputs.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ use zksync_types::{
77
basic_fri_types::Eip4844Blobs, witness_block_state::WitnessStorageState, L1BatchId,
88
L1BatchNumber, ProtocolVersionId, H256, U256,
99
};
10-
11-
use crate::{FormatMarker, CBOR};
12-
1310
const HASH_LEN: usize = H256::len_bytes();
1411

1512
/// Metadata emitted by a Merkle tree after processing single storage log.
@@ -64,13 +61,10 @@ impl StorageLogMetadata {
6461
/// Merkle paths; if this is the case, the starting hashes are skipped and are the same
6562
/// as in the first path.
6663
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
67-
pub struct WitnessInputMerklePaths<FM: FormatMarker = CBOR> {
64+
pub struct WitnessInputMerklePaths {
6865
// Merkle paths and some auxiliary information for each read / write operation in a block.
6966
pub merkle_paths: Vec<StorageLogMetadata>,
7067
pub(crate) next_enumeration_index: u64,
71-
72-
#[serde(skip)]
73-
pub(crate) _marker: std::marker::PhantomData<FM>,
7468
}
7569

7670
impl StoredObject for WitnessInputMerklePaths {
@@ -106,7 +100,6 @@ impl WitnessInputMerklePaths {
106100
Self {
107101
merkle_paths: vec![],
108102
next_enumeration_index,
109-
_marker: std::marker::PhantomData,
110103
}
111104
}
112105

@@ -158,7 +151,7 @@ impl WitnessInputMerklePaths {
158151
}
159152

160153
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
161-
pub struct VMRunWitnessInputData<FM: FormatMarker = CBOR> {
154+
pub struct VMRunWitnessInputData {
162155
pub l1_batch_number: L1BatchNumber,
163156
pub used_bytecodes: HashMap<U256, Vec<[u8; 32]>>,
164157
pub initial_heap_content: Vec<(usize, U256)>,
@@ -170,12 +163,9 @@ pub struct VMRunWitnessInputData<FM: FormatMarker = CBOR> {
170163
pub storage_refunds: Vec<u32>,
171164
pub pubdata_costs: Vec<i32>,
172165
pub witness_block_state: WitnessStorageState,
173-
174-
#[serde(skip)]
175-
pub _marker: std::marker::PhantomData<FM>,
176166
}
177167

178-
impl StoredObject for VMRunWitnessInputData<CBOR> {
168+
impl StoredObject for VMRunWitnessInputData {
179169
const BUCKET: Bucket = Bucket::WitnessInput;
180170

181171
type Key<'a> = L1BatchNumber;
@@ -203,9 +193,9 @@ impl StoredObject for VMRunWitnessInputData<CBOR> {
203193
}
204194

205195
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
206-
pub struct WitnessInputData<FM: FormatMarker = CBOR> {
207-
pub vm_run_data: VMRunWitnessInputData<FM>,
208-
pub merkle_paths: WitnessInputMerklePaths<FM>,
196+
pub struct WitnessInputData {
197+
pub vm_run_data: VMRunWitnessInputData,
198+
pub merkle_paths: WitnessInputMerklePaths,
209199
pub previous_batch_metadata: L1BatchMetadataHashes,
210200
pub eip_4844_blobs: Eip4844Blobs,
211201
}
@@ -258,7 +248,7 @@ impl StoredObject for PublicWitnessInputData {
258248
type Key<'a> = L1BatchId;
259249

260250
fn encode_key(key: Self::Key<'_>) -> String {
261-
WitnessInputData::<CBOR>::encode_key(key)
251+
WitnessInputData::encode_key(key)
262252
}
263253

264254
fn serialize(&self) -> Result<Vec<u8>, BoxedError> {

0 commit comments

Comments
 (0)