Skip to content

Commit deab06b

Browse files
fix(ci): run build and test in the same step to avoid recompilation (#2230)
Co-authored-by: Maximo Palopoli <96491141+maximopalopoli@users.noreply.github.com>
1 parent 168d391 commit deab06b

File tree

8 files changed

+53
-83
lines changed

8 files changed

+53
-83
lines changed

.github/workflows/build-and-test-rust.yml

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
- ".github/workflows/build-and-test-rust.yml"
1414

1515
jobs:
16-
build:
16+
build-and-test:
1717
runs-on: aligned-runner
1818

1919
steps:
@@ -26,6 +26,9 @@ jobs:
2626
components: rustfmt, clippy
2727
override: true
2828

29+
- name: foundry-toolchain
30+
uses: foundry-rs/foundry-toolchain@v1.2.0
31+
2932
# Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
3033
- name: Install sp1 toolchain
3134
run: |
@@ -82,54 +85,13 @@ jobs:
8285
# We need to skip the build as clippy does not support the riscv32im-risc0-zkvm-elf target
8386
RISC0_SKIP_BUILD=1 cargo clippy --all -- -D warnings
8487
85-
test:
86-
runs-on: aligned-runner
87-
needs: build
88-
steps:
89-
- name: Checkout code
90-
uses: actions/checkout@v4
91-
92-
- name: Set up Rust
93-
uses: actions-rs/toolchain@v1
94-
with:
95-
toolchain: 1.88.0
96-
components: rustfmt, clippy
97-
override: true
98-
99-
- name: foundry-toolchain
100-
uses: foundry-rs/foundry-toolchain@v1.2.0
101-
102-
# Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
103-
- name: Install sp1 toolchain
104-
run: |
105-
curl -L https://sp1.succinct.xyz | bash
106-
source /home/runner/.bashrc
107-
~/.sp1/bin/sp1up
108-
109-
- name: Install risc0 toolchain
110-
run: |
111-
curl -L https://risczero.com/install | bash
112-
source ~/.bashrc
113-
~/.risc0/bin/rzup install
114-
115-
- name: Cache Rust dependencies
116-
uses: actions/cache@v3
117-
with:
118-
path: |
119-
~/.cargo/registry
120-
~/.cargo/git
121-
crates/target
122-
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
123-
restore-keys: |
124-
${{ runner.os }}-rust-
125-
12688
- name: Run Batcher tests
12789
run: |
12890
cd crates
12991
cargo test --all
13092
13193
- name: Run AggregationMode tests
13294
run: |
133-
cd aggregation_mode/proof_aggregator && cargo test
95+
cd aggregation_mode/proof_aggregator && SKIP_AGG_PROGRAMS_BUILD=1 cargo test
13496
cd ../gateway && cargo test
13597
cd ../payments_poller && cargo test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ verify_aggregated_proof_sp1:
288288
--public-inputs ../../scripts/test_files/sp1/sp1_fibonacci_5_0_0.pub
289289

290290
proof_aggregator_install: ## Install the aggregation mode with proving enabled
291-
cargo install --path aggregation_mode --features prove,gpu --bin proof_aggregator_gpu --locked
291+
cargo install --path aggregation_mode/proof_aggregator --features prove,gpu --bin proof_aggregator_gpu --locked
292292

293293
proof_aggregator_write_program_ids: ## Write proof aggregator zkvm programs ids
294294
@cd aggregation_mode/proof_aggregator && ./scripts/build_programs.sh

aggregation_mode/proof_aggregator/Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,24 @@ risc0-build = { version = "3.0.3" }
3838
# Tell risc0 build to find method in ./aggregation_programs/risc0 package
3939
methods = ["./aggregation_programs/risc0"]
4040

41-
[profile.release]
42-
opt-level = 3
43-
4441
[features]
4542
default = []
4643
prove = []
4744
gpu = ["risc0-zkvm/cuda"]
4845

4946
[[bin]]
5047
name = "proof_aggregator_cpu"
51-
path = "./src/main.rs"
48+
path = "./src/bin/proof_aggregator_cpu.rs"
5249
required-features = ["prove"]
5350

5451
[[bin]]
5552
name = "proof_aggregator_gpu"
56-
path = "./src/main.rs"
53+
path = "./src/bin/proof_aggregator_gpu.rs"
5754
required-features = ["prove", "gpu"]
5855

5956
[[bin]]
6057
name = "proof_aggregator_dev"
61-
path = "./src/main.rs"
58+
path = "./src/bin/proof_aggregator_dev.rs"
6259

6360
[[bin]]
6461
name = "write_program_image_id_vk_hash"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[tokio::main]
2+
async fn main() {
3+
proof_aggregator::run().await;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[tokio::main]
2+
async fn main() {
3+
proof_aggregator::run().await;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[tokio::main]
2+
async fn main() {
3+
proof_aggregator::run().await;
4+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
11
pub mod aggregators;
22
pub mod backend;
3+
4+
use backend::{config::Config, ProofAggregator};
5+
use std::env;
6+
use tracing_subscriber::{EnvFilter, FmtSubscriber};
7+
8+
fn read_config_filepath_from_args() -> String {
9+
let args: Vec<String> = env::args().collect();
10+
if args.len() < 2 {
11+
panic!(
12+
"You must provide a config file. Usage: {} <config-file-path>",
13+
args[0]
14+
);
15+
}
16+
17+
args[1].clone()
18+
}
19+
20+
pub async fn run() {
21+
// ignore sp1_cuda info logs
22+
let filter = EnvFilter::new("info,sp1_cuda=warn");
23+
let subscriber = FmtSubscriber::builder().with_env_filter(filter).finish();
24+
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
25+
26+
// load config
27+
let config_file_path = read_config_filepath_from_args();
28+
tracing::info!("Loading config from {}...", config_file_path);
29+
let config = Config::from_file(&config_file_path).expect("Config is valid");
30+
tracing::info!("Config loaded");
31+
32+
let mut proof_aggregator = ProofAggregator::new(config).await;
33+
proof_aggregator.start().await;
34+
}

aggregation_mode/proof_aggregator/src/main.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)