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
7 changes: 5 additions & 2 deletions crates/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,12 @@ pub trait ProverTester {

/// Load the axiom program prover
fn load_axiom_prover() -> eyre::Result<AxiomProver> {
let mut prover = Self::load_prover(false)?;
let vk = prover.get_app_commitment();
let vk = hex::encode(serialize_vk::serialize(&vk));
let program_id = AXIOM_PROGRAM_IDS
.get(Self::NAME)
.ok_or_else(|| eyre::eyre!("missing axiom program id for {}", Self::NAME))?
.get(&vk)
.ok_or_else(|| eyre::eyre!("missing axiom program id for {}: {}", Self::NAME, vk))?
.to_string();
let prover = AxiomProver::from_env(
Self::NAME.to_string(),
Expand Down
35 changes: 35 additions & 0 deletions crates/tools/upload-axiom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::collections::HashMap;
use std::fs::File;
use std::io::{IsTerminal, stderr, stdout};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs};

#[derive(Parser)]
Expand All @@ -31,6 +32,14 @@ use std::{env, fs};
.multiple(false)
)
)]
#[command(
group(
ArgGroup::new("program_ids")
.args(&["no_write_ids", "upload_s3"])
.required(false)
.multiple(false)
)
)]
struct Cli {
/// Guest program version
///
Expand All @@ -51,6 +60,9 @@ struct Cli {
/// Don't write program ids json
#[arg(long)]
no_write_ids: bool,
/// Uploads program ids json to s3 if available
#[arg(long)]
upload_s3: bool,

/// The directory containing the manifest of the crate to run this command in.
#[arg(long, env = "CARGO_MANIFEST_DIR")]
Expand Down Expand Up @@ -250,6 +262,29 @@ fn main() -> eyre::Result<()> {
"{LOG_PREFIX} {OK} Wrote Axiom program IDs to {}",
output_path.display()
);

// "s3://circuit-release/scroll-zkvm/releases/$GUEST_VERSION/axiom_program_ids.json"
// aws --profile default s3 cp
if cli.upload_s3 {
let s3_path = format!(
"s3://circuit-release/scroll-zkvm/releases/{guest_version}/axiom_program_ids.json"
);
let status = Command::new("aws")
.arg("--profile")
.arg("default")
.arg("s3")
.arg("cp")
.arg(output_path)
.arg(&s3_path)
.status()?;
if status.success() {
println!("{LOG_PREFIX} {OK} Uploaded axiom_program_ids.json to {s3_path}");
} else {
println!(
"{LOG_PREFIX} {WARN} Failed to upload axiom_program_ids.json to {s3_path}"
);
}
}
}

Ok(())
Expand Down
67 changes: 48 additions & 19 deletions download-release.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,61 @@
#!/bin/bash
set -xeu
set -eu

# release version
SCROLL_ZKVM_VERSION=0.5.2
if [ -z "${SCROLL_ZKVM_VERSION}" ]; then
echo "SCROLL_ZKVM_VERSION not set"
# Color settings
if [[ -t 1 && -z "${NO_COLOR:-}" ]]; then
RED="\033[31m"
GREEN_BOLD="\033[1;32m"
YELLOW_BOLD="\033[1;33m"
RED_BOLD="\033[1;31m"
NC="\033[0m"
else
RED=""
GREEN_BOLD=""
YELLOW_BOLD=""
RED_BOLD=""
NC=""
fi
INFO_PREFIX="${GREEN_BOLD}[+]${NC}"
WARN_PREFIX="${YELLOW_BOLD}[!]${NC}"

# select release version
GUEST_VERSION="${GUEST_VERSION:-}"
if [ -n "$1" ]; then
GUEST_VERSION="$1"
fi
if [ -z "$GUEST_VERSION" ]; then
echo -e "$RED_BOLD[x]$NC ${RED}GUEST_VERSION not set$NC"
exit 1
fi

function can_access_s3() {
aws --profile default s3 ls "s3://circuit-release/scroll-zkvm/releases/$GUEST_VERSION" >/dev/null 2>&1
}
function download_by_s3() {
aws --profile default s3 cp s3://circuit-release/scroll-zkvm/releases/$SCROLL_ZKVM_VERSION releases/$SCROLL_ZKVM_VERSION --recursive
echo -e "$INFO_PREFIX download via s3"
aws --profile default s3 cp s3://circuit-release/scroll-zkvm/releases/$GUEST_VERSION releases/$GUEST_VERSION --recursive
}

function download_by_http() {
for f in chunk/app.vmexe \
chunk/openvm.toml \
verifier/openVmVk.json \
verifier/verifier.bin \
bundle/digest_1.hex \
bundle/app.vmexe \
bundle/digest_2.hex \
bundle/openvm.toml \
batch/app.vmexe \
batch/openvm.toml; do
output_path="releases/$SCROLL_ZKVM_VERSION/$f"
echo -e "$INFO_PREFIX download via http"
for f in {chunk,bundle,batch}/{app.{vmexe,elf},openvm.toml} \
verifier/{openVmVk.json,verifier.bin} \
bundle/{digest_1.hex,digest_2.hex}; do
output_path="releases/$GUEST_VERSION/$f"
mkdir -p "$(dirname "$output_path")"
wget https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/$SCROLL_ZKVM_VERSION/$f -O "$output_path"
if ! wget --quiet --show-progress -O "$output_path" https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/$GUEST_VERSION/$f; then
rm -f "$output_path"
echo -e "$WARN_PREFIX failed to download $f"
continue
fi
echo -e "$INFO_PREFIX downloaded $f"
done
}

download_by_http $SCROLL_ZKVM_VERSION
if can_access_s3; then
download_by_s3
else
download_by_http
fi
echo -e "$INFO_PREFIX done"
tree "releases/$GUEST_VERSION"