Compare commits

..

3 Commits

Author SHA1 Message Date
colinlyguo
f5fbe8a5c1 fix a bug 2024-08-23 22:55:18 +08:00
colinlyguo
29ff90f3ba remove if 2024-08-23 22:37:10 +08:00
colinlyguo
d75e2e286e fix: bad block 2024-08-23 22:07:36 +08:00
5 changed files with 17 additions and 16 deletions

View File

@@ -2,7 +2,7 @@ mod darwin;
mod darwin_v2;
use anyhow::{bail, Result};
// use darwin::DarwinVerifier;
use darwin::DarwinVerifier;
use darwin_v2::DarwinV2Verifier;
use serde::{Deserialize, Serialize};
use std::{cell::OnceCell, rc::Rc};
@@ -36,20 +36,20 @@ type HardForkName = String;
struct VerifierPair(HardForkName, Rc<Box<dyn ProofVerifier>>);
static mut VERIFIER_HIGH: OnceCell<VerifierPair> = OnceCell::new();
// static mut VERIFIER_LOW: 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 {
@@ -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_HIGH.get() {
if let Some(verifier) = VERIFIER_LOW.get() {
if verifier.0 == fork_name {
return Ok(verifier.1.clone());
}

View File

@@ -14,7 +14,6 @@ pub struct DarwinVerifier {
}
impl DarwinVerifier {
#[allow(dead_code)]
pub fn new(params_dir: &str, assets_dir: &str) -> Self {
env::set_var("SCROLL_PROVER_ASSETS_DIR", assets_dir);
let verifier = Verifier::from_dirs(params_dir, assets_dir);

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.4.48"
var tag = "v4.4.47"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -72,8 +72,10 @@ 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)

View File

@@ -127,7 +127,7 @@ func (w *L2WatcherClient) getAndStoreBlocks(ctx context.Context, from, to uint64
return fmt.Errorf("failed to GetBlockByNumberOrHash: %v. number: %v", err, number)
}
if block.RowConsumption == nil {
return fmt.Errorf("fetched block does not contain RowConsumption. number: %v", number)
block.RowConsumption = &gethTypes.RowConsumption{}
}
log.Info("retrieved block", "height", block.Header().Number, "hash", block.Header().Hash().String())