Skip to content

Commit

Permalink
Oxidize prove_rpc.sh (#796)
Browse files Browse the repository at this point in the history
* Move outdated code to separate module

* Begin prove_rpc.rs impl

* Add initial envs and block input logic

* Add most of prove_rpc.rs logic

* Split runner module and add verify path

* Update CI and docs

* Test flow functional

* Refactor cmd logic and fix zkproof file name

* Verify output file

* Fix import

* RM superfluous check

* Rename runner to process

* Required flags to args

* Fix spacing in actions yaml

* Lint fix

* Fix comments and readme and remove old script

* Coalesce commands fns

* Initial PR fixes before arg and process refactor

* Remove process.rs and use Command directly

* Inherit stdout/err

* Undo whitespace rm in yamls

* Fix readme
  • Loading branch information
sergerad authored Nov 21, 2024
1 parent b63c8e2 commit c79ef67
Show file tree
Hide file tree
Showing 9 changed files with 350 additions and 258 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/jerigon-native.yml
Original file line number Diff line number Diff line change
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 "$ETH_RPC_URL" native test 1 -e 15 -c 0 -b 3000 -r 100
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 "$ETH_RPC_URL" native verify 4 -e 7 -c 3 -b 3000 -r 100
echo "Proving blocks in real mode finished"
- name: Shut down network
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jerigon-zero.yml
Original file line number Diff line number Diff line change
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 "$ETH_RPC_URL" jerigon test 1 -e 15 -c 0 -b 3000 -r 100
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 "$ETH_RPC_URL" jerigon verify 2 -e 5 -c 1 -b 3000 -r 100
echo "Proving blocks in real mode finished"
- name: Shut down network
Expand Down
82 changes: 80 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions scripts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ categories.workspace = true
publish = false

[dependencies]
alloy.workspace = true
anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
sysinfo = "0.32.0"

[lints]
workspace = true
Expand Down
54 changes: 54 additions & 0 deletions scripts/outdated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
use std::process::{Command, Stdio};

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

#[derive(Deserialize)]
struct Outdated<'a> {
crate_name: &'a str,
dependencies: Vec<Dependency<'a>>,
}

#[derive(Deserialize)]
struct Dependency<'a> {
name: &'a str,
project: &'a str,
latest: &'a str,
}

pub fn list_outdated_deps() -> Result<()> {
let output = Command::new("cargo")
.args(["outdated", "--root-deps-only", "--format=json"])
.stderr(Stdio::inherit())
.stdout(Stdio::piped())
.output()
.context("couldn't exec `cargo`")?;
ensure!(
output.status.success(),
"command failed with {}",
output.status
);

let outdated_items = serde_json::Deserializer::from_slice(&output.stdout)
.into_iter::<Outdated<'_>>()
.collect::<Result<Vec<_>, _>>()
.context("failed to parse output from `cargo outdated`")?;
for Outdated {
crate_name,
dependencies,
} in outdated_items
{
for Dependency {
name,
project,
latest,
} in dependencies
{
// https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-warning-message
println!("::warning title=outdated-dependency::dependency {name} of crate {crate_name} is at version {project}, but the latest is {latest}")
}
}

Ok(())
}
Loading

0 comments on commit c79ef67

Please sign in to comment.