Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/actions/install-protobuf-compiler/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

name: "Install protobuf compiler"
description: "Install compiler for protobuf compilation"

runs:
using: "composite"
steps:
- name: Install protobuf compiler
shell: bash
run: |
set -eux
sudo apt-get update
sudo apt-get install -y protobuf-compiler
33 changes: 5 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:

env:
# Shared prefix key for the rust cache.
#
#
# This provides a convenient way to evict old or corrupted cache.
RUST_CACHE_KEY: rust-cache-2026.02.02
# Reduce cache usage by removing debug information.
Expand All @@ -47,8 +47,8 @@ jobs:
- uses: actions/checkout@v6
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
fi
done
echo "Static linkage check passed for all of ${bin_targets[@]}"

clippy:
name: lint - clippy
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -152,29 +152,6 @@ jobs:
- name: Build docs
run: cargo doc --no-deps --workspace --all-features --locked

# Ensures our checked-in protobuf generated code is aligned to the protobuf schema.
#
# We do this by rebuilding the generated code and ensuring there is no diff.
proto:
name: gRPC codegen
needs: [build]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Rustup
run: rustup update --no-self-update
- name: Install protobuf
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: false
- name: Rebuild protos
run: BUILD_PROTO=1 cargo check --all-features --all-targets --locked --workspace
- name: Diff check
run: git diff --exit-code

# Ensure the stress-test still functions by running some cheap benchmarks.
stress-test:
name: stress test
Expand Down Expand Up @@ -204,7 +181,7 @@ jobs:
cargo run --bin miden-node-stress-test seed-store \
--data-directory ${{ env.DATA_DIR }} \
--num-accounts 500 --public-accounts-percentage 50
# TODO re-introduce
# TODO re-introduce
# - name: Benchmark state sync
# run: |
# cargo run --bin miden-node-stress-test benchmark-store \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
ref: "next"
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Rustup
run: rustup install beta && rustup default beta
- uses: taiki-e/install-action@v2
Expand All @@ -45,8 +45,8 @@ jobs:
ref: "next"
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Install rust
run: rustup update --no-self-update
- name: Install cargo-hack
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-debian-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Build and Publish Node
uses: ./.github/actions/debian
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ jobs:
with:
fetch-depth: 0

- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler

- name: Build and Publish Packages
uses: ./.github/actions/debian
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
with:
fetch-depth: 0
ref: main
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
# Ensure the release tag refers to the latest commit on main.
# Compare the commit SHA that triggered the workflow with the HEAD of the branch we just
# checked out (main).
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ help:
# -- variables ------------------------------------------------------------------------------------

WARNINGS=RUSTDOCFLAGS="-D warnings"
BUILD_PROTO=BUILD_PROTO=1
CONTAINER_RUNTIME ?= docker
STRESS_TEST_DATA_DIR ?= stress-test-store-$(shell date +%Y%m%d-%H%M%S)

Expand Down Expand Up @@ -86,7 +85,7 @@ test: ## Runs all tests

.PHONY: check
check: ## Check all targets and features for errors without code generation
${BUILD_PROTO} cargo check --all-features --all-targets --locked --workspace
cargo check --all-features --all-targets --locked --workspace

.PHONY: check-features
check-features: ## Checks all feature combinations compile without warnings using cargo-hack
Expand All @@ -96,22 +95,22 @@ check-features: ## Checks all feature combinations compile without warnings usin

.PHONY: build
build: ## Builds all crates and re-builds protobuf bindings for proto crates
${BUILD_PROTO} cargo build --locked --workspace
${BUILD_PROTO} cargo build --locked -p miden-remote-prover-client --target wasm32-unknown-unknown --no-default-features --features batch-prover,block-prover,tx-prover # no-std compatible build
cargo build --locked --workspace
cargo build --locked -p miden-remote-prover-client --target wasm32-unknown-unknown --no-default-features --features batch-prover,block-prover,tx-prover # no-std compatible build

# --- installing ----------------------------------------------------------------------------------

.PHONY: install-node
install-node: ## Installs node
${BUILD_PROTO} cargo install --path bin/node --locked
cargo install --path bin/node --locked

.PHONY: install-remote-prover
install-remote-prover: ## Install remote prover's CLI
$(BUILD_PROTO) cargo install --path bin/remote-prover --bin miden-remote-prover --locked
cargo install --path bin/remote-prover --bin miden-remote-prover --locked

.PHONY: stress-test-smoke
stress-test: ## Runs stress-test benchmarks
${BUILD_PROTO} cargo build --release --locked -p miden-node-stress-test
cargo build --release --locked -p miden-node-stress-test
@mkdir -p $(STRESS_TEST_DATA_DIR)
./target/release/miden-node-stress-test seed-store --data-directory $(STRESS_TEST_DATA_DIR) --num-accounts 500 --public-accounts-percentage 50
./target/release/miden-node-stress-test benchmark-store --data-directory $(STRESS_TEST_DATA_DIR) --iterations 10 --concurrency 1 sync-state
Expand Down
8 changes: 8 additions & 0 deletions bin/remote-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ miden-testing = { workspace = true }
miden-tx = { features = ["testing"], workspace = true }

[build-dependencies]
fs-err = { workspace = true }
miden-node-proto-build = { features = ["internal"], workspace = true }
miden-node-rocksdb-cxx-linkage-fix = { workspace = true }
miette = { features = ["fancy"], version = "7.5" }
tonic-prost-build = { workspace = true }

[package.metadata.cargo-machete]
ignored = [
"http",
"prost",
"tonic-prost", # used in generated OUT_DIR code
]
35 changes: 19 additions & 16 deletions bin/remote-prover/build.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
use std::path::{Path, PathBuf};

use fs_err as fs;
use miden_node_proto_build::remote_prover_api_descriptor;
use miette::IntoDiagnostic;
use miette::{IntoDiagnostic, WrapErr};
use tonic_prost_build::FileDescriptorSet;

/// Defines whether the build script should generate files in `/src`.
///
/// The docs.rs build pipeline has a read-only filesystem, so we have to avoid writing to `src`,
/// otherwise the docs will fail to build there. Note that writing to `OUT_DIR` is fine.
const BUILD_GENERATED_FILES_IN_SRC: bool = option_env!("BUILD_PROTO").is_some();

const GENERATED_OUT_DIR: &str = "src/generated";

/// Generates Rust protobuf bindings.
fn main() -> miette::Result<()> {
miden_node_rocksdb_cxx_linkage_fix::configure();
println!("cargo:rerun-if-env-changed=BUILD_PROTO");
if !BUILD_GENERATED_FILES_IN_SRC {
return Ok(());
}

let dst_dir =
PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR should be set")).join("generated");

// Remove all existing files.
let _ = fs::remove_dir_all(&dst_dir);
fs::create_dir(&dst_dir)
.into_diagnostic()
.wrap_err("creating destination folder")?;

// Get the file descriptor set
let remote_prover_descriptor = remote_prover_api_descriptor();

// Build tonic code
build_tonic_from_descriptor(remote_prover_descriptor)?;
build_tonic_from_descriptor(remote_prover_descriptor, &dst_dir)?;

Ok(())
}
Expand All @@ -31,9 +31,12 @@ fn main() -> miette::Result<()> {
// ================================================================================================

/// Builds tonic code from a `FileDescriptorSet`
fn build_tonic_from_descriptor(descriptor: FileDescriptorSet) -> miette::Result<()> {
fn build_tonic_from_descriptor(
descriptor: FileDescriptorSet,
dst_dir: &Path,
) -> miette::Result<()> {
tonic_prost_build::configure()
.out_dir(GENERATED_OUT_DIR)
.out_dir(dst_dir)
.build_server(true)
.build_transport(true)
.compile_fds_with_config(descriptor, tonic_prost_build::Config::new())
Expand Down
4 changes: 3 additions & 1 deletion bin/remote-prover/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
#![allow(clippy::allow_attributes, reason = "generated by build.rs and tonic")]

#[rustfmt::skip]
mod remote_prover;
pub mod remote_prover {
include!(concat!(env!("OUT_DIR"), "/generated/remote_prover.rs"));
}
pub use remote_prover::*;
Loading
Loading