Skip to content
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
elf/
elf/

# code generated files
src/git_info.rs
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"rust-analyzer.linkedProjects": [
"./crates/share_exchange_prove/Cargo.toml",
"./crates/bad_share_exchange_prove/Cargo.toml",
"./crates/finalization_prove/Cargo.toml",
"./crates/dvt_abi_host/Cargo.toml",
"./crates/dvt_abi/Cargo.toml",
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ members = [
[dependencies]
hex = "0.4.3"
sp1-sdk = "3.4.0"

text_io = "0.1.12"
bls12_381 = "0.8.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
clap = { version = "4", features = ["derive"] }
dvt_abi = { path = "crates/dvt_abi" }
dvt_abi_host = { path = "crates/dvt_abi_host" }
jsonschema = "0.16"
anyhow = "1.0.96"
colored = "3.0.0"
strip-ansi-escapes = "0.2.1"

[build-dependencies]
sp1-build = "4.0.0"
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
# Variables
SHELL := /usr/bin/env bash
REPO_ROOT := $(shell git rev-parse --show-toplevel)
TEST_SCRIPT := $(REPO_ROOT)/scripts/run.sh
TEST_SCRIPT := $(REPO_ROOT)/script/run.sh

help:
@echo "Makefile targets:"
@echo " test Run all tests using the run_tests.sh script"
@echo " help Show this help message"

install-git-hooks:
@ls -R ./.git/hooks > before.txt
@cp -r ./script/hooks/ ./.git/
@chmod +x ./.git/hooks/pre-commit
@ls -R ./.git/hooks > after.txt
@diff before.txt after.txt || true
@rm before.txt after.txt
@echo "Hooks installed successfully."

test:
@if [ ! -f "$(TEST_SCRIPT)" ]; then \
echo "Error: run_tests.sh not found in repository root."; \
Expand Down
56 changes: 55 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
use std::fs;
use std::path::Path;
use std::process::Command;

fn main() {
sp1_build::build_program("crates/share_exchange_prove");
let commit_hash = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
.unwrap_or_else(|_| "unknown".to_string());

let uncommitted_output = Command::new("git")
.args(["status", "--porcelain"])
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
.unwrap_or_else(|_| "".to_string());

let uncommitted_files: Vec<String> = uncommitted_output
.lines()
.filter_map(|line| {
let file_path = line[3..].to_string(); // Remove git status prefixes (e.g., " M filename.txt")
if file_path.starts_with("crates/") {
Some(file_path)
} else {
None
}
})
.collect();

let uncommitted_flag = !uncommitted_files.is_empty();

// Convert the file list into a Rust array representation
let uncommitted_files_array = format!(
"[{}]",
uncommitted_files
.iter()
.map(|file| format!(r#""{}""#, file))
.collect::<Vec<String>>()
.join(", ")
);

let git_info_content = format!(
r#"#[rustfmt::skip]
pub const COMMIT_HASH: &str = "{commit_hash}";
pub const UNCOMMITTED_CHANGES: bool = {uncommitted_flag};
pub const UNCOMMITTED_FILES: &[&str] = &{uncommitted_files_array};
"#
);

let dest_path = Path::new("./src/git_info.rs");

fs::write(dest_path, git_info_content).expect("Failed to write git_info.rs");

sp1_build::build_program("crates/bad_share_exchange_prove");
sp1_build::build_program("crates/finalization_prove");
sp1_build::build_program("crates/bad_parial_key_prove");
sp1_build::build_program("crates/bad_encrypted_share_prove");
}
20 changes: 20 additions & 0 deletions crates/bad_encrypted_share_prove/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "bad_encrypted_share_prove"
version = "1.1.0"
edition = "2021"
publish = false

[dependencies]
sp1-zkvm = "3.4.0"
ff = "0.13.0"
rand = "0.8.5"
group = "0.13.0"
serde = "1.0.216"
dvt_abi = { path = "../dvt_abi" }
bls_utils = { path = "../bls_utils" }
bls12_381 = { git = "https://github.com/NDobrev/bls12_381", branch="fp-to-bytes", features = ["experimental"]}
hex = "0.4"
chacha20 = "0.9.1"
sha2 = "0.9"

hex-literal = "0.4.1"
Loading