Skip to content

Commit

Permalink
Update CI and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed Nov 16, 2024
1 parent 4abfbc0 commit 34db292
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/jerigon-native.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- # Run and populate blockchain with transactions and generate proofs using native tracer
--- # Run and populate blockchain with transactions and generate proofs using native tracer

Check warning on line 1 in .github/workflows/jerigon-native.yml

View workflow job for this annotation

GitHub Actions / yamllint-check

1:5 [comments] too few spaces before comment

name: Jerigon Integration

Expand Down Expand Up @@ -76,14 +76,14 @@ jobs:
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
ulimit -n 8192
OUTPUT_TO_TERMINAL=true ./scripts/prove_rpc.sh 1 15 $ETH_RPC_URL native 0 3000 100 test_only
cargo xtask prove-rpc -u $ETH_RPC_URL -s 1 -e 15 -t native -c 0 -b 3000 -r 100 -m test
echo "Proving blocks in test_only mode finished"
- name: Run prove blocks with native tracer in real mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
rm -rf proofs/* circuits/* ./proofs.json test.out verify.out leader.out
OUTPUT_TO_TERMINAL=true RUN_VERIFICATION=true ./scripts/prove_rpc.sh 4 7 $ETH_RPC_URL native 3 3000 100
cargo xtask prove-rpc -u $ETH_RPC_URL -s 4 -e 7 -t native -c 3 -b 3000 -r 100 -m verify
echo "Proving blocks in real mode finished"
- name: Shut down network
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/jerigon-zero.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- # Run and populate blockchain with transactions and generate proofs using zero tracer
--- # Run and populate blockchain with transactions and generate proofs using zero tracer

Check warning on line 1 in .github/workflows/jerigon-zero.yml

View workflow job for this annotation

GitHub Actions / yamllint-check

1:5 [comments] too few spaces before comment

name: Jerigon Integration

Expand Down Expand Up @@ -76,14 +76,14 @@ jobs:
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
ulimit -n 8192
OUTPUT_TO_TERMINAL=true ./scripts/prove_rpc.sh 1 15 $ETH_RPC_URL jerigon 0 3000 100 test_only
cargo xtask prove-rpc -u $ETH_RPC_URL -s 1 -e 15 -t jerigon -c 0 -b 3000 -r 100 -m test
echo "Proving blocks in test_only mode finished"
- name: Run prove blocks with zero tracer in real mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
rm -rf proofs/* circuits/* ./proofs.json test.out verify.out leader.out
OUTPUT_TO_TERMINAL=true RUN_VERIFICATION=true ./scripts/prove_rpc.sh 2 5 $ETH_RPC_URL jerigon 1 3000 100
cargo xtask prove-rpc -u $ETH_RPC_URL -s 2 -e 5 -t jerigon -c 1 -b 3000 -r 100 -m verify
echo "Proving blocks in real mode finished"
- name: Shut down network
Expand Down
10 changes: 5 additions & 5 deletions scripts/prove_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ pub struct ProveRpcArgs {
/// The end of the block range to prove (inclusive).
#[arg(short = 'e', long)]
end_block: Option<BlockId>,
/// Backoff in milliseconds for retry requests
/// Backoff in milliseconds for retry requests.
#[arg(short = 'b', long, default_value_t = 0)]
backoff: u64,
/// The maximum number of retries
#[arg(short = 'r', long, default_value_t = 0)]
/// The maximum number of retries.
#[arg(short = 'r', long, default_value_t = 7)]
max_retries: u32,
/// Whether to generate a proof and verify it or not.
#[arg(short = 'm', long)]
Expand Down Expand Up @@ -140,7 +140,7 @@ pub fn prove_via_rpc(args: ProveRpcArgs) -> Result<()> {
"--max-retries",
&args.max_retries.to_string(),
])
.out(log_output_filepath)?;
.pipe(log_output_filepath)?;
match args.mode {
RunMode::Test => {
set_var("ARITHMETIC_CIRCUIT_SIZE", "16..21");
Expand Down Expand Up @@ -172,7 +172,7 @@ pub fn prove_via_rpc(args: ProveRpcArgs) -> Result<()> {
"-f",
proof_filepath.to_str().unwrap(),
])
.out(verify_output_filepath)?;
.pipe(verify_output_filepath)?;
verify_runner.run()
}
}
Expand Down
12 changes: 9 additions & 3 deletions scripts/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use std::{
process::{Command, Stdio},
};

use anyhow::{Context as _, Result};
use anyhow::{ensure, Context as _, Result};

/// A means of running a command as a subprocess.
pub struct Runner {
cmd: String,
args: Vec<String>,
Expand All @@ -32,7 +33,7 @@ impl Runner {

/// Create the file specified by `output_filepath` and set it as the stdout
/// and stderr of the command.
pub fn out(mut self, output_filepath: impl Into<PathBuf>) -> Result<Self> {
pub fn pipe(mut self, output_filepath: impl Into<PathBuf>) -> Result<Self> {
let out = File::create(output_filepath.into())?;
let err = out.try_clone()?;
self.stdout = Stdio::from(out);
Expand All @@ -48,6 +49,11 @@ impl Runner {
.stderr(self.stderr)
.output()
.context(format!("couldn't exec `{}`", &self.cmd))?;
todo!()
ensure!(
output.status.success(),
"command failed with {}",
output.status
);
Ok(())
}
}
16 changes: 5 additions & 11 deletions zero/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,16 @@ For testing proof generation for blocks, the `testing` branch should be used.

### Proving Blocks

If you want to generate a full block proof, you can use `tools/prove_rpc.sh`:
If you want to generate a full block proof, you can use `cargo xtask prove-rpc`:

```sh
./prove_rpc.sh <BLOCK_START> <BLOCK_END> <FULL_NODE_ENDPOINT> <RPC_TYPE> <CHECKPOINT_BLOCK>
cargo xtask prove-rpc -s <BLOCK_START> -e <BLOCK_END> -u <FULL_NODE_ENDPOINT> -t <RPC_TYPE> -c <CHECKPOINT_BLOCK> -m <MODE>
```

Which may look like this:

```sh
./prove_rpc.sh 17 18 http://127.0.0.1:8545 jerigon
cargo xtask prove-rpc -u "$ETH_RPC_URL" -s 17 -e 18 -t jerigon -c 16 -b 3000 -r 100 -m verify
```

Which will attempt to generate proofs for blocks `17` & `18` consecutively and incorporate the previous block proof during generation.
Expand All @@ -444,16 +444,10 @@ A few other notes:

### Generating Witnesses Only

If you want to test a block without the high CPU & memory requirements that come with creating a full proof, you can instead generate only the witness using `tools/prove_rpc.sh` in the `test_only` mode:
If you want to test a block without the high CPU & memory requirements that come with creating a full proof, you can instead generate only the witness using `cargo xtask prove-rpc` in the `test` mode:

```sh
./prove_rpc.sh <START_BLOCK> <END_BLOCK> <FULL_NODE_ENDPOINT> <RPC_TYPE> <CHECKPOINT_BLOCK> <BACKOFF> <RETRIES> test_only
```

Filled in:

```sh
./prove_rpc.sh 18299898 18299899 http://34.89.57.138:8545 jerigon 18299897 0 0 test_only
cargo xtask prove-rpc -u "$ETH_RPC_URL" -s 17 -e 18 -t jerigon -c 16 -b 3000 -r 100 -m test
```

Finally, note that both of these testing scripts force proof generation to be sequential by allowing only one worker. Because of this, this is not a realistic representation of performance but makes the debugging logs much easier to follow.
Expand Down

0 comments on commit 34db292

Please sign in to comment.