mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-17 21:49:35 +00:00
refactor: move program_methods to the root of repo
This commit is contained in:
parent
7d12502542
commit
90a1ee994f
@ -7,7 +7,7 @@ edition = "2024"
|
|||||||
thiserror = "2.0.12"
|
thiserror = "2.0.12"
|
||||||
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
||||||
nssa-core = { path = "core", features = ["host"] }
|
nssa-core = { path = "core", features = ["host"] }
|
||||||
program-methods = { path = "program_methods", optional = true }
|
program-methods = { path = "../program_methods", optional = true }
|
||||||
serde = "1.0.219"
|
serde = "1.0.219"
|
||||||
sha2 = "0.10.9"
|
sha2 = "0.10.9"
|
||||||
secp256k1 = "0.31.1"
|
secp256k1 = "0.31.1"
|
||||||
@ -21,7 +21,7 @@ risc0-build = "3.0.3"
|
|||||||
risc0-binfmt = "3.0.2"
|
risc0-binfmt = "3.0.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
test-program-methods = { path = "test_program_methods" }
|
test-program-methods = { path = "../test_program_methods" }
|
||||||
hex-literal = "1.0.0"
|
hex-literal = "1.0.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@ -15,12 +15,13 @@ fn build_deterministic() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let mod_dir = out_dir.join("program_methods");
|
let mod_dir = out_dir.join("program_methods");
|
||||||
let mod_file = mod_dir.join("mod.rs");
|
let mod_file = mod_dir.join("mod.rs");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=program_methods/guest/src");
|
println!("cargo:rerun-if-changed=../program_methods/guest/src");
|
||||||
println!("cargo:rerun-if-changed=program_methods/guest/Cargo.toml");
|
println!("cargo:rerun-if-changed=../program_methods/guest/Cargo.toml");
|
||||||
|
|
||||||
let guest_manifest = manifest_dir.join("program_methods/guest/Cargo.toml");
|
|
||||||
|
|
||||||
|
let build_cur_dir = manifest_dir.join("..").canonicalize()?;
|
||||||
|
let guest_manifest = build_cur_dir.join("program_methods/guest/Cargo.toml");
|
||||||
let status = Command::new("cargo")
|
let status = Command::new("cargo")
|
||||||
|
.current_dir(build_cur_dir)
|
||||||
.args(["risczero", "build", "--manifest-path"])
|
.args(["risczero", "build", "--manifest-path"])
|
||||||
.arg(&guest_manifest)
|
.arg(&guest_manifest)
|
||||||
.status()?;
|
.status()?;
|
||||||
@ -29,7 +30,7 @@ fn build_deterministic() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let target_dir =
|
let target_dir =
|
||||||
manifest_dir.join("program_methods/guest/target/riscv32im-risc0-zkvm-elf/docker/");
|
manifest_dir.join("../program_methods/guest/target/riscv32im-risc0-zkvm-elf/docker/");
|
||||||
|
|
||||||
let bins = fs::read_dir(&target_dir)?
|
let bins = fs::read_dir(&target_dir)?
|
||||||
.filter_map(Result::ok)
|
.filter_map(Result::ok)
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
use nssa_core::program::{read_nssa_inputs, write_nssa_outputs, ProgramInput, AccountPostState};
|
|
||||||
|
|
||||||
type Instruction = ();
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
|
|
||||||
|
|
||||||
let post_states = pre_states.iter().map(|account| {
|
|
||||||
AccountPostState::new(account.account.clone())
|
|
||||||
}).collect();
|
|
||||||
write_nssa_outputs(instruction_words, pre_states, post_states);
|
|
||||||
}
|
|
||||||
@ -7,5 +7,5 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
||||||
nssa-core = { path = "../../core" }
|
nssa-core = { path = "../../nssa/core" }
|
||||||
serde = { version = "1.0.219", default-features = false }
|
serde = { version = "1.0.219", default-features = false }
|
||||||
@ -7,5 +7,5 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
risc0-zkvm = { version = "3.0.3", features = ['std'] }
|
||||||
nssa-core = { path = "../../core" }
|
nssa-core = { path = "../../nssa/core" }
|
||||||
serde = { version = "1.0.219", default-features = false }
|
serde = { version = "1.0.219", default-features = false }
|
||||||
13
test_program_methods/guest/src/bin/noop.rs
Normal file
13
test_program_methods/guest/src/bin/noop.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs};
|
||||||
|
|
||||||
|
type Instruction = ();
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
|
||||||
|
|
||||||
|
let post_states = pre_states
|
||||||
|
.iter()
|
||||||
|
.map(|account| AccountPostState::new(account.account.clone()))
|
||||||
|
.collect();
|
||||||
|
write_nssa_outputs(instruction_words, pre_states, post_states);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user