-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: run tests across zkVM using mocked guest programs #438
Draft
keroro520
wants to merge
4
commits into
taikoxyz:main
Choose a base branch
from
keroro520:zkvm-mock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ca7b2c1
feat(provers/risc0/guest): add guest-mock.rs,aggregation-mock.rs
keroro520 3433e9b
feat(provers/risc0/driver): add --feature "test-mock-guest"
keroro520 224926b
WIP: add -moc.k.rs
keroro520 289def0
test(host): run zkvm test with --feature test-mock-guest
keroro520 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,44 @@ | ||
pub mod risc0_aggregation; | ||
pub mod risc0_guest; | ||
//! RISC0 prover method definitions and configurations | ||
//! This module handles both production and test mock implementations. | ||
|
||
// Production implementations | ||
#[cfg(not(feature = "test-mock-guest"))] | ||
mod risc0_aggregation; | ||
#[cfg(not(feature = "test-mock-guest"))] | ||
mod risc0_guest; | ||
|
||
// Test mock implementations | ||
#[cfg(feature = "test-mock-guest")] | ||
mod risc0_aggregation_mock; | ||
#[cfg(feature = "test-mock-guest")] | ||
mod risc0_guest_mock; | ||
|
||
// Re-exports for production environment | ||
#[cfg(not(feature = "test-mock-guest"))] | ||
pub use risc0_aggregation::{RISC0_AGGREGATION_ELF, RISC0_AGGREGATION_ID}; | ||
#[cfg(not(feature = "test-mock-guest"))] | ||
pub use risc0_guest::{RISC0_GUEST_ELF, RISC0_GUEST_ID}; | ||
|
||
// Re-exports for test environment with mock implementations | ||
#[cfg(feature = "test-mock-guest")] | ||
pub use risc0_aggregation_mock::{ | ||
RISC0_AGGREGATION_MOCK_ELF as RISC0_AGGREGATION_ELF, | ||
RISC0_AGGREGATION_MOCK_ID as RISC0_AGGREGATION_ID, | ||
}; | ||
#[cfg(feature = "test-mock-guest")] | ||
pub use risc0_guest_mock::{ | ||
RISC0_GUEST_MOCK_ELF as RISC0_GUEST_ELF, RISC0_GUEST_MOCK_ID as RISC0_GUEST_ID, | ||
}; | ||
|
||
// To build the following `$ cargo run --features test,bench --bin risc0-builder` | ||
// or `$ $TARGET=risc0 make test` | ||
|
||
// Benchmark-specific modules | ||
#[cfg(feature = "bench")] | ||
pub mod ecdsa; | ||
#[cfg(feature = "bench")] | ||
pub mod sha256; | ||
|
||
// Test-specific modules | ||
#[cfg(test)] | ||
pub mod test_risc0_guest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
pub const RISC0_AGGREGATION_MOCK_ELF: &[u8] = include_bytes!("../../../guest/target/riscv32im-risc0-zkvm-elf/release/risc0-aggregation-mock"); | ||
pub const RISC0_AGGREGATION_MOCK_ID: [u32; 8] = [2792947449, 3119244021, 3706268267, 3522578639, 2979241120, 39440854, 3999921328, 3748768206]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
pub const RISC0_GUEST_MOCK_ELF: &[u8] = include_bytes!("../../../guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest-mock"); | ||
pub const RISC0_GUEST_MOCK_ID: [u32; 8] = [3661074503, 456244050, 2356448233, 3555754962, 3799155047, 1867550507, 1560708289, 2016241489]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better to use feature to separate build.
please also check if the image id output in compile log is clear or not as we need give that id to client to config the contract.