mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
feat: add artifacts of program_methods and remove no_docker feature
This commit is contained in:
parent
d425d70d4c
commit
dc38b8ea2d
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
@ -93,7 +93,7 @@ jobs:
|
|||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
env:
|
env:
|
||||||
RISC0_DEV_MODE: "1"
|
RISC0_DEV_MODE: "1"
|
||||||
run: cargo test --workspace --features no_docker
|
run: cargo test --workspace
|
||||||
|
|
||||||
- name: Test valid proof
|
- name: Test valid proof
|
||||||
env:
|
env:
|
||||||
@ -108,3 +108,27 @@ jobs:
|
|||||||
RISC0_DEV_MODE: "1"
|
RISC0_DEV_MODE: "1"
|
||||||
run: cargo run --bin integration-tests -- ./integration-tests/configs/debug/ all
|
run: cargo run --bin integration-tests -- ./integration-tests/configs/debug/ all
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
|
||||||
|
name: artifacts
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- uses: ./.github/actions/install-risc0
|
||||||
|
|
||||||
|
- name: Install just
|
||||||
|
run: cargo install just
|
||||||
|
|
||||||
|
- name: Build artifacts
|
||||||
|
run: just build-artifacts
|
||||||
|
|
||||||
|
- name: Check if artifacts match repository
|
||||||
|
run: |
|
||||||
|
if ! git diff --exit-code artifacts/; then
|
||||||
|
echo "❌ Artifacts in the repository are out of date!"
|
||||||
|
echo "Please run 'just build-artifacts' and commit the changes."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Artifacts are up to date"
|
||||||
|
|||||||
@ -33,7 +33,6 @@ sequencer_core = { path = "sequencer_core" }
|
|||||||
sequencer_rpc = { path = "sequencer_rpc" }
|
sequencer_rpc = { path = "sequencer_rpc" }
|
||||||
sequencer_runner = { path = "sequencer_runner" }
|
sequencer_runner = { path = "sequencer_runner" }
|
||||||
wallet = { path = "wallet" }
|
wallet = { path = "wallet" }
|
||||||
program_methods = { path = "program_methods" }
|
|
||||||
test_program_methods = { path = "test_program_methods" }
|
test_program_methods = { path = "test_program_methods" }
|
||||||
|
|
||||||
tokio = { version = "1.28.2", features = [
|
tokio = { version = "1.28.2", features = [
|
||||||
|
|||||||
19
Justfile
Normal file
19
Justfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
default:
|
||||||
|
@just --list
|
||||||
|
|
||||||
|
# ---- Configuration ----
|
||||||
|
METHODS_PATH := "program_methods"
|
||||||
|
TEST_METHODS_PATH := "test_program_methods"
|
||||||
|
ARTIFACTS := "artifacts"
|
||||||
|
|
||||||
|
# ---- Artifacts build ----
|
||||||
|
build-artifacts:
|
||||||
|
@echo "🔨 Building artifacts"
|
||||||
|
@for methods_path in {{METHODS_PATH}} {{TEST_METHODS_PATH}}; do \
|
||||||
|
echo "Building artifacts for $methods_path"; \
|
||||||
|
cargo risczero build --manifest-path $methods_path/guest/Cargo.toml; \
|
||||||
|
mkdir -p {{ARTIFACTS}}/$methods_path; \
|
||||||
|
cp target/riscv32im-risc0-zkvm-elf/docker/*.bin {{ARTIFACTS}}/$methods_path; \
|
||||||
|
done
|
||||||
BIN
artifacts/program_methods/authenticated_transfer.bin
Normal file
BIN
artifacts/program_methods/authenticated_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/burner.bin
Normal file
BIN
artifacts/program_methods/burner.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/chain_caller.bin
Normal file
BIN
artifacts/program_methods/chain_caller.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/claimer.bin
Normal file
BIN
artifacts/program_methods/claimer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/data_changer.bin
Normal file
BIN
artifacts/program_methods/data_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/extra_output.bin
Normal file
BIN
artifacts/program_methods/extra_output.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/minter.bin
Normal file
BIN
artifacts/program_methods/minter.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/missing_output.bin
Normal file
BIN
artifacts/program_methods/missing_output.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/modified_transfer.bin
Normal file
BIN
artifacts/program_methods/modified_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/nonce_changer.bin
Normal file
BIN
artifacts/program_methods/nonce_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/pinata.bin
Normal file
BIN
artifacts/program_methods/pinata.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/pinata_token.bin
Normal file
BIN
artifacts/program_methods/pinata_token.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/privacy_preserving_circuit.bin
Normal file
BIN
artifacts/program_methods/privacy_preserving_circuit.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/program_owner_changer.bin
Normal file
BIN
artifacts/program_methods/program_owner_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/simple_balance_transfer.bin
Normal file
BIN
artifacts/program_methods/simple_balance_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/program_methods/token.bin
Normal file
BIN
artifacts/program_methods/token.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/authenticated_transfer.bin
Normal file
BIN
artifacts/test_program_methods/authenticated_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/burner.bin
Normal file
BIN
artifacts/test_program_methods/burner.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/chain_caller.bin
Normal file
BIN
artifacts/test_program_methods/chain_caller.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/claimer.bin
Normal file
BIN
artifacts/test_program_methods/claimer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/data_changer.bin
Normal file
BIN
artifacts/test_program_methods/data_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/extra_output.bin
Normal file
BIN
artifacts/test_program_methods/extra_output.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/minter.bin
Normal file
BIN
artifacts/test_program_methods/minter.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/missing_output.bin
Normal file
BIN
artifacts/test_program_methods/missing_output.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/modified_transfer.bin
Normal file
BIN
artifacts/test_program_methods/modified_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/nonce_changer.bin
Normal file
BIN
artifacts/test_program_methods/nonce_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/pinata.bin
Normal file
BIN
artifacts/test_program_methods/pinata.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/pinata_token.bin
Normal file
BIN
artifacts/test_program_methods/pinata_token.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/privacy_preserving_circuit.bin
Normal file
BIN
artifacts/test_program_methods/privacy_preserving_circuit.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/program_owner_changer.bin
Normal file
BIN
artifacts/test_program_methods/program_owner_changer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/simple_balance_transfer.bin
Normal file
BIN
artifacts/test_program_methods/simple_balance_transfer.bin
Normal file
Binary file not shown.
BIN
artifacts/test_program_methods/token.bin
Normal file
BIN
artifacts/test_program_methods/token.bin
Normal file
Binary file not shown.
@ -5,7 +5,7 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nssa_core = { workspace = true, features = ["host"] }
|
nssa_core = { workspace = true, features = ["host"] }
|
||||||
nssa = { workspace = true, features = ["no_docker"] }
|
nssa.workspace = true
|
||||||
sequencer_core = { workspace = true, features = ["testnet"] }
|
sequencer_core = { workspace = true, features = ["testnet"] }
|
||||||
sequencer_runner.workspace = true
|
sequencer_runner.workspace = true
|
||||||
wallet.workspace = true
|
wallet.workspace = true
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1596,7 +1596,10 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
|
|||||||
pub async fn test_program_deployment() {
|
pub async fn test_program_deployment() {
|
||||||
info!("########## test program deployment ##########");
|
info!("########## test program deployment ##########");
|
||||||
|
|
||||||
let binary_filepath: PathBuf = NSSA_PROGRAM_FOR_TEST_DATA_CHANGER.parse().unwrap();
|
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
||||||
|
let binary_filepath: PathBuf = PathBuf::from(manifest_dir)
|
||||||
|
.join("../artifacts/test_program_methods")
|
||||||
|
.join(NSSA_PROGRAM_FOR_TEST_DATA_CHANGER);
|
||||||
|
|
||||||
let command = Command::DeployProgram {
|
let command = Command::DeployProgram {
|
||||||
binary_filepath: binary_filepath.clone(),
|
binary_filepath: binary_filepath.clone(),
|
||||||
|
|||||||
@ -8,7 +8,6 @@ nssa_core = { workspace = true, features = ["host"] }
|
|||||||
|
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
risc0-zkvm.workspace = true
|
risc0-zkvm.workspace = true
|
||||||
program_methods = { workspace = true, optional = true }
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
sha2.workspace = true
|
sha2.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
@ -27,4 +26,3 @@ hex-literal = "1.0.0"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
no_docker = ["program_methods"]
|
|
||||||
|
|||||||
@ -1,44 +1,21 @@
|
|||||||
fn main() {
|
use std::{env, fs, path::PathBuf};
|
||||||
if cfg!(feature = "no_docker") {
|
|
||||||
println!("cargo:warning=NO_DOCKER feature enabled – deterministic build skipped");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
build_deterministic().expect("Deterministic build failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_deterministic() -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
use std::{env, fs, path::PathBuf, process::Command};
|
|
||||||
|
|
||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
|
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
|
||||||
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
|
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
|
||||||
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");
|
||||||
|
let program_methods_dir = manifest_dir.join("../artifacts/program_methods/");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=../program_methods/guest/src");
|
println!("cargo:rerun-if-changed={}", program_methods_dir.display());
|
||||||
println!("cargo:rerun-if-changed=../program_methods/guest/Cargo.toml");
|
|
||||||
|
|
||||||
let build_cur_dir = manifest_dir.join("..").canonicalize()?;
|
let bins = fs::read_dir(&program_methods_dir)?
|
||||||
let guest_manifest = build_cur_dir.join("program_methods/guest/Cargo.toml");
|
|
||||||
let status = Command::new("cargo")
|
|
||||||
.current_dir(build_cur_dir)
|
|
||||||
.args(["risczero", "build", "--manifest-path"])
|
|
||||||
.arg(&guest_manifest)
|
|
||||||
.status()?;
|
|
||||||
if !status.success() {
|
|
||||||
return Err("Risc0 deterministic build failed".into());
|
|
||||||
}
|
|
||||||
|
|
||||||
let target_dir =
|
|
||||||
manifest_dir.join("../program_methods/guest/target/riscv32im-risc0-zkvm-elf/docker/");
|
|
||||||
|
|
||||||
let bins = fs::read_dir(&target_dir)?
|
|
||||||
.filter_map(Result::ok)
|
.filter_map(Result::ok)
|
||||||
.filter(|e| e.path().extension().is_some_and(|ext| ext == "bin"))
|
.filter(|e| e.path().extension().is_some_and(|ext| ext == "bin"))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if bins.is_empty() {
|
if bins.is_empty() {
|
||||||
return Err(format!("No .bin files found in {:?}", target_dir).into());
|
return Err(format!("No .bin files found in {:?}", program_methods_dir).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::create_dir_all(&mod_dir)?;
|
fs::create_dir_all(&mod_dir)?;
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
#[cfg(not(feature = "no_docker"))]
|
|
||||||
pub mod program_methods {
|
pub mod program_methods {
|
||||||
include!(concat!(env!("OUT_DIR"), "/program_methods/mod.rs"));
|
include!(concat!(env!("OUT_DIR"), "/program_methods/mod.rs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "no_docker")]
|
|
||||||
#[allow(clippy::single_component_path_imports)]
|
|
||||||
use program_methods;
|
|
||||||
|
|
||||||
pub mod encoding;
|
pub mod encoding;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
mod merkle_tree;
|
mod merkle_tree;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user