Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemka374 committed Dec 20, 2024
1 parent e4ab244 commit 2db5063
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 28 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci-prover-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
--ignore-prerequisites \
--evm-emulator false \
--update-submodules=${{matrix.compressor-mode == 'plonk'}}
ci_run zkstack ecosystem init --dev --update-submodules=${{matrix.compressor-mode == 'plonk'}} --verbose
ci_run zkstack prover init --dev --verbose
Expand All @@ -76,8 +76,8 @@ jobs:
working-directory: ./chains/proving_chain/configs
if: matrix.compressor-mode == 'fflonk'
run: |
sudo sed -i 's/verifier_pre_fflonk: true/verifier_pre_fflonk: false/' general.yaml
grep "verifier_pre_fflonk" general.yaml | awk '{ print $2 }'
sudo sed -i 's/is_verifier_pre_fflonk: true/is_verifier_pre_fflonk: false/' general.yaml
grep "is_verifier_pre_fflonk" general.yaml | awk '{ print $2 }'
- name: Prepare prover subsystem
run: |
Expand All @@ -93,6 +93,7 @@ jobs:
- name: Run Prover Job Monitor
run: |
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs_${{matrix.compressor-mode}}/prover-job-monitor.log &
# Sleeping until the server, gateway and prover job monitor are up
ci_run sleep 150
- name: Wait for batch to be passed through gateway
env:
Expand Down
4 changes: 2 additions & 2 deletions core/lib/config/src/configs/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl EthConfig {
tx_aggregation_only_prove_and_execute: false,
priority_tree_start_index: Some(0),
time_in_mempool_in_l1_blocks_cap: 1800,
verifier_pre_fflonk: true,
is_verifier_pre_fflonk: true,
}),
gas_adjuster: Some(GasAdjusterConfig {
default_priority_fee_per_gas: 1000000000,
Expand Down Expand Up @@ -124,7 +124,7 @@ pub struct SenderConfig {
/// Cap of time in mempool for price calculations
#[serde(default = "SenderConfig::default_time_in_mempool_in_l1_blocks_cap")]
pub time_in_mempool_in_l1_blocks_cap: u32,
pub verifier_pre_fflonk: bool,
pub is_verifier_pre_fflonk: bool,
}

impl SenderConfig {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl Distribution<configs::eth_sender::SenderConfig> for EncodeDist {
tx_aggregation_only_prove_and_execute: false,
priority_tree_start_index: self.sample(rng),
time_in_mempool_in_l1_blocks_cap: self.sample(rng),
verifier_pre_fflonk: self.sample(rng),
is_verifier_pre_fflonk: self.sample(rng),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/lib/env_config/src/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
tx_aggregation_paused: false,
time_in_mempool_in_l1_blocks_cap: 2000,
priority_tree_start_index: None,
verifier_pre_fflonk: true,
is_verifier_pre_fflonk: true,
}),
gas_adjuster: Some(GasAdjusterConfig {
default_priority_fee_per_gas: 20000000000,
Expand Down Expand Up @@ -141,7 +141,7 @@ mod tests {
ETH_SENDER_SENDER_L1_BATCH_MIN_AGE_BEFORE_EXECUTE_SECONDS="1000"
ETH_SENDER_SENDER_MAX_ACCEPTABLE_PRIORITY_FEE_IN_GWEI="100000000000"
ETH_SENDER_SENDER_PUBDATA_SENDING_MODE="Calldata"
ETH_SENDER_SENDER_VERIFIER_PRE_FFLONK="true"
ETH_SENDER_SENDER_is_verifier_pre_fflonk="true"
ETH_WATCH_CONFIRMATIONS_FOR_ETH_EVENT="0"
ETH_WATCH_ETH_NODE_POLL_INTERVAL="300"
ETH_CLIENT_WEB3_URL="http://127.0.0.1:8545"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct ProveBatches {
}

impl ProveBatches {
pub fn conditional_into_tokens(&self, verifier_pre_fflonk: bool) -> Vec<Token> {
pub fn conditional_into_tokens(&self, is_verifier_pre_fflonk: bool) -> Vec<Token> {
let prev_l1_batch_info = StoredBatchInfo::from(&self.prev_l1_batch).into_token();
let batches_arg = self
.l1_batches
Expand Down Expand Up @@ -59,7 +59,7 @@ impl ProveBatches {
};

if protocol_version.is_pre_gateway() {
let proof_input = if !verifier_pre_fflonk || !protocol_version.is_pre_fflonk() {
let proof_input = if !is_verifier_pre_fflonk || !protocol_version.is_pre_fflonk() {
Token::Tuple(vec![
Token::Array(vec![verifier_type.into_token()]),
Token::Array(proof.into_iter().map(Token::Uint).collect()),
Expand Down
4 changes: 2 additions & 2 deletions core/lib/protobuf_config/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl ProtoRepr for proto::Sender {
time_in_mempool_in_l1_blocks_cap: self
.time_in_mempool_in_l1_blocks_cap
.unwrap_or(Self::Type::default_time_in_mempool_in_l1_blocks_cap()),
verifier_pre_fflonk: self.verifier_pre_fflonk.unwrap_or(true),
is_verifier_pre_fflonk: self.is_verifier_pre_fflonk.unwrap_or(true),
})
}

Expand Down Expand Up @@ -159,7 +159,7 @@ impl ProtoRepr for proto::Sender {
tx_aggregation_paused: Some(this.tx_aggregation_paused),
priority_op_start_index: this.priority_tree_start_index.map(|x| x as u64),
time_in_mempool_in_l1_blocks_cap: Some(this.time_in_mempool_in_l1_blocks_cap),
verifier_pre_fflonk: Some(this.verifier_pre_fflonk),
is_verifier_pre_fflonk: Some(this.is_verifier_pre_fflonk),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/protobuf_config/src/proto/config/eth_sender.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message Sender {
optional bool tx_aggregation_only_prove_and_execute = 21; // required
optional uint32 time_in_mempool_in_l1_blocks_cap = 22; // optional
optional uint64 priority_op_start_index = 23; // optional
optional bool verifier_pre_fflonk = 24; // optional
optional bool is_verifier_pre_fflonk = 24; // optional
}

message GasAdjuster {
Expand Down
4 changes: 2 additions & 2 deletions core/node/eth_sender/src/eth_tx_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl EthTxAggregator {

tracing::info!(
"Initialized eth_tx_aggregator with is_pre_fflonk_verifier: {:?}",
self.config.verifier_pre_fflonk
self.config.is_verifier_pre_fflonk
);

let pool = self.pool.clone();
Expand Down Expand Up @@ -550,7 +550,7 @@ impl EthTxAggregator {
Self::encode_commit_data(encoding_fn, &commit_data, l1_batch_for_sidecar)
}
AggregatedOperation::PublishProofOnchain(op) => {
args.extend(op.conditional_into_tokens(self.config.verifier_pre_fflonk));
args.extend(op.conditional_into_tokens(self.config.is_verifier_pre_fflonk));
let encoding_fn = if is_op_pre_gateway {
&self.functions.post_shared_bridge_prove
} else {
Expand Down
2 changes: 1 addition & 1 deletion etc/env/base/eth_sender.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ max_acceptable_priority_fee_in_gwei = 100000000000

pubdata_sending_mode = "Blobs"

verifier_pre_fflonk = true
is_verifier_pre_fflonk = true

[eth_sender.gas_adjuster]
# Priority fee to be used by GasAdjuster (in wei).
Expand Down
2 changes: 1 addition & 1 deletion etc/env/file_based/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ eth:
max_aggregated_tx_gas: 15000000
max_acceptable_priority_fee_in_gwei: 100000000000 # typo: value is in wei (100 gwei)
pubdata_sending_mode: BLOBS
verifier_pre_fflonk: true
is_verifier_pre_fflonk: true
gas_adjuster:
default_priority_fee_per_gas: 1000000000
max_base_fee_samples: 100
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion prover/crates/bin/proof_fri_compressor/src/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl ProofCompressor {
Ok(final_proof)
}

#[tracing::instrument(skip(proof, compression_mode))]
#[tracing::instrument(skip(proof, compression_mode, keystore))]
pub fn generate_fflonk_proof(
proof: ZkSyncRecursionLayerProof,
compression_mode: u8,
Expand Down
9 changes: 4 additions & 5 deletions prover/crates/bin/witness_generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct Opt {
/// This function recalculates the commitment in order to check the exact code that
/// will run, instead of loading `commitments.json` (which also may correct misaligned
/// information).
#[allow(dead_code)] // todo: remove after VK issue is resolved
async fn ensure_protocol_alignment(
prover_pool: &ConnectionPool<Prover>,
protocol_version: ProtocolSemanticVersion,
Expand Down Expand Up @@ -141,10 +140,10 @@ async fn main() -> anyhow::Result<()> {
let (stop_sender, stop_receiver) = watch::channel(false);

let protocol_version = PROVER_PROTOCOL_SEMANTIC_VERSION;
// TODO: enable when VK issue is resolved
// ensure_protocol_alignment(&connection_pool, protocol_version, &keystore)
// .await
// .unwrap_or_else(|err| panic!("Protocol alignment check failed: {:?}", err));

ensure_protocol_alignment(&connection_pool, protocol_version, &keystore)
.await
.unwrap_or_else(|err| panic!("Protocol alignment check failed: {:?}", err));

let rounds = match (opt.round, opt.all_rounds) {
(Some(round), false) => vec![round],
Expand Down
4 changes: 3 additions & 1 deletion prover/crates/lib/circuit_prover_service/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![allow(incomplete_features)] // Crypto code uses generic const exprs
#![allow(incomplete_features)]
// Crypto code uses generic const exprs, allocator_api is needed to use global allocators
#![feature(generic_const_exprs, allocator_api)]

mod gpu_circuit_prover;
pub mod job_runner;
mod metrics;
Expand Down
4 changes: 1 addition & 3 deletions prover/crates/lib/keystore/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![feature(allocator_api)]
#![feature(generic_const_exprs)]
#![feature(allocator_api, generic_const_exprs)]
#![allow(incomplete_features)]
#![allow(unused_imports)] //todo: remove after setup is generated

use serde::{Deserialize, Serialize};
#[cfg(any(feature = "gpu", feature = "gpu-light"))]
Expand Down
2 changes: 1 addition & 1 deletion prover/crates/lib/keystore/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use circuit_definitions::{
},
};
#[cfg(feature = "gpu")]
use fflonk_gpu::{bellman::bn256::Fq2, FflonkSnarkVerifierCircuitVK};
use fflonk_gpu::FflonkSnarkVerifierCircuitVK;
use sha3::Digest;
use zkevm_test_harness::{
franklin_crypto::bellman::{CurveAffine, PrimeField, PrimeFieldRepr},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub enum CompressorType {
Fflonk,
#[default]
Plonk,
All,
}

impl CompressorKeysArgs {
Expand Down
22 changes: 22 additions & 0 deletions zkstack_cli/crates/zkstack/src/commands/prover/compressor_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ pub(crate) async fn run(shell: &Shell, args: CompressorKeysArgs) -> anyhow::Resu
&format!("{}{}", path, PLONK_CRS_KEY),
)?;
}
CompressorType::All => {
let path = args.clone().path.context(MSG_SETUP_KEY_PATH_ERROR)?;

download_compressor_key(
shell,
&mut general_config,
FFLONK_CRS_KEY,
&format!("{}{}", path, FFLONK_CRS_KEY),
)?;
download_compressor_key(
shell,
&mut general_config,
FFLONK_COMPACT_CRS_KEY,
&format!("{}{}", path, FFLONK_COMPACT_CRS_KEY),
)?;
download_compressor_key(
shell,
&mut general_config,
PLONK_CRS_KEY,
&format!("{}{}", path, PLONK_CRS_KEY),
)?;
}
}

chain_config.save_general_config(&general_config)?;
Expand Down

0 comments on commit 2db5063

Please sign in to comment.