Skip to content

Commit

Permalink
feat(coordinator): hide low version circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
amoylan2 committed Aug 26, 2024
1 parent fa80b3e commit 647c099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 11 additions & 11 deletions common/libzkp/impl/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ static mut VERIFIER_HIGH: OnceCell<VerifierPair> = OnceCell::new();
static mut VERIFIER_LOW: OnceCell<VerifierPair> = OnceCell::new();

pub fn init(config: VerifierConfig) {
let low_conf = config.low_version_circuit;
let verifier = DarwinVerifier::new(&low_conf.params_path, &low_conf.assets_path);
// let low_conf = config.low_version_circuit;
// let verifier = DarwinVerifier::new(&low_conf.params_path, &low_conf.assets_path);

unsafe {
VERIFIER_LOW
.set(VerifierPair(
low_conf.fork_name,
Rc::new(Box::new(verifier)),
))
.unwrap_unchecked();
}
// unsafe {
// VERIFIER_LOW
// .set(VerifierPair(
// low_conf.fork_name,
// Rc::new(Box::new(verifier)),
// ))
// .unwrap_unchecked();
// }
let high_conf = config.high_version_circuit;
let verifier = DarwinV2Verifier::new(&high_conf.params_path, &high_conf.assets_path);
unsafe {
Expand All @@ -64,7 +64,7 @@ pub fn init(config: VerifierConfig) {

pub fn get_verifier(fork_name: &str) -> Result<Rc<Box<dyn ProofVerifier>>> {
unsafe {
if let Some(verifier) = VERIFIER_LOW.get() {
if let Some(verifier) = VERIFIER_HIGH.get() {
if verifier.0 == fork_name {
return Ok(verifier.1.clone());
}
Expand Down
2 changes: 0 additions & 2 deletions coordinator/internal/logic/verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
}

configStr := C.CString(string(configBytes))
assetsPathHiStr := C.CString(cfg.HighVersionCircuit.AssetsPath)
defer func() {
C.free(unsafe.Pointer(configStr))
C.free(unsafe.Pointer(assetsPathHiStr))
}()

C.init(configStr)
Expand Down

0 comments on commit 647c099

Please sign in to comment.