diff --git a/common/libzkp/impl/src/chunk.rs b/common/libzkp/impl/src/chunk.rs index 3d06f34755..21a9d47f6e 100644 --- a/common/libzkp/impl/src/chunk.rs +++ b/common/libzkp/impl/src/chunk.rs @@ -42,16 +42,18 @@ pub unsafe extern "C" fn init_chunk_prover(params_dir: *const c_char, assets_dir /// # Safety #[no_mangle] -pub unsafe extern "C" fn init_chunk_verifier(params_dir: *const c_char, assets_dir: *const c_char) { +pub unsafe extern "C" fn init_chunk_verifier(params_dir: *const c_char, v3_assets_dir: *const c_char, v4_assets_dir: *const c_char) { init_env_and_log("ffi_chunk_verify"); let params_dir = c_char_to_str(params_dir); - let assets_dir = c_char_to_str(assets_dir); + let v3_assets_dir = c_char_to_str(v3_assets_dir); + let v4_assets_dir = c_char_to_str(v4_assets_dir); // TODO: add a settings in scroll-prover. - env::set_var("SCROLL_PROVER_ASSETS_DIR", assets_dir); - let verifier_v3 = VerifierV3::from_dirs(params_dir, assets_dir); - let verifier_v4 = VerifierV4::from_dirs(params_dir, assets_dir); + env::set_var("SCROLL_PROVER_ASSETS_DIR", v3_assets_dir); + let verifier_v3 = VerifierV3::from_dirs(params_dir, v3_assets_dir); + env::set_var("SCROLL_PROVER_ASSETS_DIR", v4_assets_dir); + let verifier_v4 = VerifierV4::from_dirs(params_dir, v4_assets_dir); VERIFIER_V3.set(verifier_v3).unwrap(); VERIFIER_V4.set(verifier_v4).unwrap(); diff --git a/common/libzkp/interface/libzkp.h b/common/libzkp/interface/libzkp.h index 99cb8f3a3a..1c661a7509 100644 --- a/common/libzkp/interface/libzkp.h +++ b/common/libzkp/interface/libzkp.h @@ -17,7 +17,7 @@ char* gen_bundle_proof(char* batch_proofs); char verify_bundle_proof(char* proof); void init_chunk_prover(char* params_dir, char* assets_dir); -void init_chunk_verifier(char* params_dir, char* assets_dir); +void init_chunk_verifier(char* params_dir, char* v3_assets_dir, char* v4_assets_dir); char* get_chunk_vk(); char* gen_chunk_proof(char* block_traces); char verify_chunk_proof(char* proof, char* fork_name); diff --git a/coordinator/conf/config.json b/coordinator/conf/config.json index 2e2ca9d383..7e6c4694a1 100644 --- a/coordinator/conf/config.json +++ b/coordinator/conf/config.json @@ -9,7 +9,8 @@ "fork_name": "bernoulli", "mock_mode": true, "params_path": "", - "assets_path": "" + "assets_path_v3": "", + "assets_path_v4": "" }, "max_verifier_workers": 4, "min_prover_version": "v1.0.0" diff --git a/coordinator/internal/config/config.go b/coordinator/internal/config/config.go index 78c85f5887..5e6a4c567d 100644 --- a/coordinator/internal/config/config.go +++ b/coordinator/internal/config/config.go @@ -52,10 +52,11 @@ type Config struct { // VerifierConfig load zk verifier config. type VerifierConfig struct { - ForkName string `json:"fork_name"` - MockMode bool `json:"mock_mode"` - ParamsPath string `json:"params_path"` - AssetsPath string `json:"assets_path"` + ForkName string `json:"fork_name"` + MockMode bool `json:"mock_mode"` + ParamsPath string `json:"params_path"` + AssetsPathV3 string `json:"assets_path_v3"` + AssetsPathV4 string `json:"assets_path_v4"` } // NewConfig returns a new instance of Config. diff --git a/coordinator/internal/logic/verifier/verifier.go b/coordinator/internal/logic/verifier/verifier.go index baecfc965d..9bccbedb20 100644 --- a/coordinator/internal/logic/verifier/verifier.go +++ b/coordinator/internal/logic/verifier/verifier.go @@ -36,14 +36,16 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) { return &Verifier{cfg: cfg, ChunkVKMap: chunkVKMap, BatchVKMap: batchVKMap, BundleVkMap: bundleVKMap}, nil } paramsPathStr := C.CString(cfg.ParamsPath) - assetsPathStr := C.CString(cfg.AssetsPath) + assetsPathV3Str := C.CString(cfg.AssetsPathV3) + assetsPathV4Str := C.CString(cfg.AssetsPathV4) defer func() { C.free(unsafe.Pointer(paramsPathStr)) - C.free(unsafe.Pointer(assetsPathStr)) + C.free(unsafe.Pointer(assetsPathV3Str)) + C.free(unsafe.Pointer(assetsPathV4Str)) }() - C.init_batch_verifier(paramsPathStr, assetsPathStr) - C.init_chunk_verifier(paramsPathStr, assetsPathStr) + C.init_batch_verifier(paramsPathStr, assetsPathV4Str) + C.init_chunk_verifier(paramsPathStr, assetsPathV3Str, assetsPathV4Str) v := &Verifier{ cfg: cfg, @@ -52,15 +54,15 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) { BundleVkMap: make(map[string]string), } - bundleVK, err := v.readVK(path.Join(cfg.AssetsPath, "vk_bundle.vkey")) + bundleVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_bundle.vkey")) if err != nil { return nil, err } - batchVK, err := v.readVK(path.Join(cfg.AssetsPath, "vk_batch.vkey")) + batchVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_batch.vkey")) if err != nil { return nil, err } - chunkVK, err := v.readVK(path.Join(cfg.AssetsPath, "vk_chunk.vkey")) + chunkVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_chunk.vkey")) if err != nil { return nil, err }