Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a mechanism to flush slice #284

Merged
merged 7 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 109 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ rayon = "1.8.0"
regex = "1.10.2"
static_assertions = "1.1.0"
wasmi = { path = "third-party/wasmi" }
zkwasm-host-circuits = { git = "https://github.com/DelphinusLab/zkWasm-host-circuits.git" }
circuits-batcher = { git = "https://github.com/DelphinusLab/continuation-batcher.git" }
zkwasm-host-circuits = { git = "https://github.com/DelphinusLab/zkWasm-host-circuits.git", branch="host-op-1.8" }
circuits-batcher = { git = "https://github.com/DelphinusLab/continuation-batcher.git", tag="on-prove-pairing-2.2" }
poseidon = { git = "https://github.com/DelphinusLab/poseidon" }

[profile.dev]
opt-level = 3

11 changes: 8 additions & 3 deletions crates/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,14 @@ impl SetupArg {
}
};

let env = env_builder.create_env_without_value(self.k);
let mut monitor =
TableMonitor::new(self.k, &self.phantom_functions, TraceBackend::Memory, &env);
let env = env_builder.create_env_without_value();
let mut monitor = TableMonitor::new(
self.k,
env_builder.create_flush_strategy(),
&self.phantom_functions,
TraceBackend::Memory,
&env,
);

let loader = ZkWasmLoader::new(self.k, env)?;

Expand Down
12 changes: 9 additions & 3 deletions crates/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl Config {
) -> Result<()> {
let module = self.read_wasm_image(wasm_image)?;

let env = env_builder.create_env(self.k, arg);
let env = env_builder.create_env(arg);

let mut monitor = StatisticMonitor::new(&self.phantom_functions, &env, instruction_limit);

Expand Down Expand Up @@ -256,9 +256,15 @@ impl Config {
println!("{} Load params...", style("[2/8]").bold().dim(),);
let params = self.read_params(params_dir)?;

let env = env_builder.create_env(self.k, arg);
let env = env_builder.create_env(arg);

let mut monitor = TableMonitor::new(self.k, &self.phantom_functions, table_backend, &env);
let mut monitor = TableMonitor::new(
self.k,
env_builder.create_flush_strategy(),
&self.phantom_functions,
table_backend,
&env,
);

let (result, tables) = {
println!("{} Executing...", style("[3/8]").bold().dim(),);
Expand Down
12 changes: 6 additions & 6 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fn main() -> Result<()> {
match cli.subcommand {
Subcommands::Setup(arg) => {
let env_builder: Box<dyn HostEnvBuilder> = match arg.host_mode {
HostMode::Default => Box::new(DefaultHostEnvBuilder),
HostMode::Standard => Box::<StandardHostEnvBuilder>::default(),
HostMode::Default => Box::new(DefaultHostEnvBuilder::new(arg.k)),
HostMode::Standard => Box::new(StandardHostEnvBuilder::new(arg.k)),
};

arg.setup(&*env_builder, &cli.name, &cli.params_dir)?;
Expand All @@ -73,8 +73,8 @@ fn main() -> Result<()> {
let context_inputs = parse_args(&arg.running_arg.context_inputs);

let env_builder: Box<dyn HostEnvBuilder> = match config.host_mode {
HostMode::Default => Box::new(DefaultHostEnvBuilder),
HostMode::Standard => Box::<StandardHostEnvBuilder>::default(),
HostMode::Default => Box::new(DefaultHostEnvBuilder::new(config.k)),
HostMode::Standard => Box::new(StandardHostEnvBuilder::new(config.k)),
};

config.dry_run(
Expand Down Expand Up @@ -144,8 +144,8 @@ fn main() -> Result<()> {
};

let env_builder: Box<dyn HostEnvBuilder> = match config.host_mode {
HostMode::Default => Box::new(DefaultHostEnvBuilder),
HostMode::Standard => Box::<StandardHostEnvBuilder>::default(),
HostMode::Default => Box::new(DefaultHostEnvBuilder::new(config.k)),
HostMode::Standard => Box::new(StandardHostEnvBuilder::new(config.k)),
};

config.prove(
Expand Down
2 changes: 1 addition & 1 deletion crates/host/src/host/merkle_helper/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use zkwasm_host_circuits::host::ForeignInst::MerkleSetRoot;
use zkwasm_host_circuits::host::Reduce;
use zkwasm_host_circuits::host::ReduceRule;

const MERKLE_TREE_HEIGHT: usize = 32;
use crate::MERKLE_TREE_HEIGHT;

pub struct MerkleContext {
pub k: u32,
Expand Down
Loading
Loading