Skip to content

Commit c884fc9

Browse files
committed
Add debug code
1 parent d574fce commit c884fc9

File tree

2 files changed

+18
-90
lines changed

2 files changed

+18
-90
lines changed

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

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

1515
jobs:
16-
build:
17-
runs-on: aligned-runner
18-
env:
19-
CARGO_INCREMENTAL: 0
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
24-
- name: Set up Rust
25-
uses: actions-rs/toolchain@v1
26-
with:
27-
toolchain: 1.86.0
28-
components: rustfmt, clippy
29-
override: true
30-
31-
- name: Install sp1 toolchain
32-
run: |
33-
curl -L https://sp1.succinct.xyz | bash
34-
source /home/runner/.bashrc
35-
~/.sp1/bin/sp1up
36-
37-
- name: Install risc0 toolchain
38-
run: |
39-
curl -L https://risczero.com/install | bash
40-
source ~/.bashrc
41-
~/.risc0/bin/rzup install
42-
43-
- name: Cache Rust dependencies
44-
uses: actions/cache@v3
45-
with:
46-
path: |
47-
~/.cargo/registry
48-
~/.cargo/git
49-
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
50-
restore-keys: |
51-
${{ runner.os }}-rust-
52-
53-
- name: Clean build dir
54-
run: rm -rf crates/target
55-
56-
- name: Check formatting
57-
run: |
58-
cd crates
59-
cargo fmt --all -- --check
60-
61-
- name: Run Clippy
62-
run: |
63-
cd crates
64-
cargo clippy --all -- -D warnings
65-
66-
- name: Build Batcher
67-
run: |
68-
cd crates
69-
cargo build --all -vv
70-
71-
- name: Check formatting of AggregationMode
72-
run: |
73-
cd aggregation_mode
74-
cargo fmt --all -- --check
75-
76-
- name: Build AggregationMode
77-
run: |
78-
cd aggregation_mode
79-
cargo build --all -vv
80-
81-
- name: Run Clippy on AggregationMode
82-
run: |
83-
cd aggregation_mode
84-
RISC0_SKIP_BUILD=1 cargo clippy --all -- -D warnings
8516

8617
test:
8718
runs-on: aligned-runner
8819
needs: build
89-
env:
90-
CARGO_INCREMENTAL: 0
91-
9220
steps:
93-
- uses: actions/checkout@v4
21+
- name: Checkout code
22+
uses: actions/checkout@v4
9423

9524
- name: foundry-toolchain
9625
uses: foundry-rs/[email protected]
9726

98-
- name: Install sp1 toolchain
99-
run: |
100-
curl -L https://sp1.succinct.xyz | bash
101-
source /home/runner/.bashrc
102-
~/.sp1/bin/sp1up
103-
104-
- name: Install risc0 toolchain
105-
run: |
106-
curl -L https://risczero.com/install | bash
107-
source ~/.bashrc
108-
~/.risc0/bin/rzup install
109-
11027
- name: Cache Rust dependencies
11128
uses: actions/cache@v3
11229
with:
11330
path: |
11431
~/.cargo/registry
11532
~/.cargo/git
33+
crates/target
11634
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
11735
restore-keys: |
11836
${{ runner.os }}-rust-
11937
120-
- name: Clean build dir
121-
run: rm -rf crates/target
38+
- name: Debug — dump expanded lib with #[cfg(test)]
39+
working-directory: crates
40+
env:
41+
RUSTFLAGS: --cfg test
42+
run: |
43+
cargo rustc -p aligned-batcher --lib -- -Zunstable-options --pretty=expanded > expanded.rs
44+
echo "=== searching for try_build_batch in expanded.rs ==="
45+
rg -n 'fn\s+try_build_batch' expanded.rs || true
46+
rg -n '__exposed_try_build_batch_for_tests' expanded.rs || true
12247
12348
- name: Run Batcher tests
12449
run: |
12550
cd crates
126-
cargo test --all -vv
51+
cargo test --all
12752
12853
- name: Run AggregationMode tests
12954
run: |
13055
cd aggregation_mode
131-
cargo test --all -vv
56+
cargo test --all

crates/batcher/src/types/batch_queue.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ pub(crate) fn try_build_batch(
191191
Ok(finalized_batch.clone().into_sorted_vec())
192192
}
193193

194+
pub(crate) use try_build_batch as __exposed_try_build_batch_for_tests;
195+
194196
fn calculate_fee_per_proof(batch_len: usize, gas_price: U256, constant_gas_cost: u128) -> U256 {
195197
let gas_per_proof = (constant_gas_cost
196198
+ crate::ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * batch_len as u128)
@@ -207,7 +209,8 @@ mod test {
207209
use aligned_sdk::common::types::VerificationData;
208210
use ethers::types::Address;
209211

210-
use super::try_build_batch;
212+
use super::__exposed_try_build_batch_for_tests as try_build_batch;
213+
211214
use super::*;
212215

213216
#[test]

0 commit comments

Comments
 (0)