Skip to content

Commit

Permalink
fix(ci): building provers for tests (#360)
Browse files Browse the repository at this point in the history
* fix CI

* fix ci

Signed-off-by: smtmfft <[email protected]>

* fix ci

Signed-off-by: smtmfft <[email protected]>

* fix ci

* fix ci

Signed-off-by: smtmfft <[email protected]>

* fix ci

Signed-off-by: smtmfft <[email protected]>

* fix ci

Signed-off-by: smtmfft <[email protected]>

* chore(host): add more descriptive asserts

* fix(host): use blob proof type other than none

* fix(host): add `to_string` call

* revert install.sh

Signed-off-by: smtmfft <[email protected]>

* chore(ci): remove integration from CI until cwd fix

* revert ci changes

Signed-off-by: smtmfft <[email protected]>

---------

Signed-off-by: smtmfft <[email protected]>
Co-authored-by: Petar Vujovic <[email protected]>
  • Loading branch information
smtmfft and petarvujovic98 authored Sep 9, 2024
1 parent f1a773d commit 4f9204a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 50 deletions.
48 changes: 23 additions & 25 deletions .github/workflows/ci-integration-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,26 @@ jobs:
CI: 1
MOCK: 1

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ inputs.version_toolchain }}
profile: minimal

- name: Install cargo-binstall
uses: cargo-bins/[email protected]

- name: Setup sccache
if: ${{ inputs.version_name }} == risc0
uses: risc0/risc0/.github/actions/[email protected]

- name: Install ${{ inputs.version_name }}
run: make install

- name: Build ${{ inputs.version_name }} prover
run: make build

- name: Run integration test for ${{ inputs.version_name }} prover
run: make integration
# TODO:(petar) re add to CI after fixing sgx directory setup
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ inputs.version_toolchain }}
# profile: minimal
#
# - name: Setup sccache
# if: ${{ inputs.version_name }} == risc0
# uses: risc0/risc0/.github/actions/[email protected]
#
# - name: Install ${{ inputs.version_name }}
# run: make install
#
# - name: Build ${{ inputs.version_name }} prover
# run: make build
#
# - name: Run integration test for ${{ inputs.version_name }} prover
# run: make integration
2 changes: 1 addition & 1 deletion host/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub async fn make_request() -> anyhow::Result<ProofRequestOpt> {
),
prover: Some("0x70997970C51812dc3A010C7d01b50e0d17dc79C8".to_owned()),
proof_type: Some(proof_type.to_string()),
blob_proof_type: Some("kzg_versioned_hash".to_string()),
blob_proof_type: Some("proof_of_equivalence".to_string()),
prover_args: ProverSpecificOpts {
native: None,
sgx: None,
Expand Down
18 changes: 9 additions & 9 deletions host/tests/common/scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn test_v1_api_format() -> anyhow::Result<()> {
data: v1::ProofResponse { .. }
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

token.cancel();
Expand Down Expand Up @@ -53,7 +53,7 @@ pub async fn test_v2_api_response() -> anyhow::Result<()> {
data: v2::ProofResponse::Proof { .. }
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

// Wait a second to allow the server to process the request.
Expand All @@ -76,7 +76,7 @@ pub async fn test_v2_api_response() -> anyhow::Result<()> {
data: v2::ProofResponse::Proof { .. }
}
),
"Got incorrect response from server"
"Got incorrect response from server {response:?}"
);

token.cancel();
Expand Down Expand Up @@ -108,7 +108,7 @@ pub async fn test_v2_cancellation() -> anyhow::Result<()> {
data: v2::ProofResponse::Proof { .. }
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

// Cancel the proof request.
Expand All @@ -119,7 +119,7 @@ pub async fn test_v2_cancellation() -> anyhow::Result<()> {

assert!(
matches!(response, v2::CancelStatus::Ok),
"Got error response from server"
"Got error response from server {response:?}"
);

// Check that we can restart the proof request.
Expand All @@ -137,7 +137,7 @@ pub async fn test_v2_cancellation() -> anyhow::Result<()> {
}
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

token.cancel();
Expand Down Expand Up @@ -170,7 +170,7 @@ pub async fn test_v2_report() -> anyhow::Result<()> {
}
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

let response = client.report_proof().await?;
Expand Down Expand Up @@ -210,7 +210,7 @@ pub async fn test_v2_prune() -> anyhow::Result<()> {
}
}
),
"Got error response from server"
"Got error response from server {response:?}"
);

let response = client.report_proof().await?;
Expand All @@ -224,7 +224,7 @@ pub async fn test_v2_prune() -> anyhow::Result<()> {

assert!(
matches!(response, v2::PruneStatus::Ok),
"Got error response from server"
"Got error response from server {response:?}"
);

let response = client.report_proof().await?;
Expand Down
36 changes: 22 additions & 14 deletions pipeline/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,30 @@ pub struct CommandBuilder {

impl CommandBuilder {
fn get_path_buf(tool: &str, toolchain: &str) -> Option<PathBuf> {
let std::io::Result::Ok(std::process::Output { stdout, .. }) = sanitized_cmd("rustup")
match sanitized_cmd("rustup")
.args([&format!("+{toolchain}"), "which", tool])
.output()
else {
return None;
};

let Ok(out) = String::from_utf8(stdout) else {
return None;
};

let out = out.trim();

println!("Using {tool}: {out}");

Some(PathBuf::from(out))
{
Ok(output) => {
if output.status.success() {
println!("Command succeeded with output: {:?}", output.stdout);
if let Ok(out) = String::from_utf8(output.stdout) {
let out = out.trim();
println!("Using {tool}: {out}");
Some(PathBuf::from(out))
} else {
None
}
} else {
eprintln!("Command failed with status: {}", output.status);
None
}
}
Err(e) => {
eprintln!("Failed to execute command: {}", e);
None
}
}
}

pub fn new(meta: &Metadata, target: &str, toolchain: &str) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion provers/risc0/driver/src/methods/risc0_guest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub const RISC0_GUEST_ELF: &[u8] =
include_bytes!("../../../guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest");
pub const RISC0_GUEST_ID: [u32; 8] = [
572111947, 771021978, 3238057507, 2574084743, 2728391593, 45804239, 3180160159, 786246815,
480687899, 2174307554, 3476860359, 3243974848, 2470546824, 868279999, 2732634741, 2619104561,
];

0 comments on commit 4f9204a

Please sign in to comment.