-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing docs/test to the Risc0 adapter (#920)
* Document risc0 adapter * add test for adapter * Update adapters/risc0/README.md Co-authored-by: Nikolai Golub <[email protected]> * Code review feedback --------- Co-authored-by: Blazej Kolad <[email protected]> Co-authored-by: Nikolai Golub <[email protected]>
- Loading branch information
1 parent
41a3408
commit 2ce4d78
Showing
7 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use sov_risc0_adapter::host::Risc0Host; | ||
use sov_rollup_interface::zk::{ZkvmGuest, ZkvmHost}; | ||
|
||
#[derive(Serialize, Deserialize, Debug, PartialEq)] | ||
struct TestStruct { | ||
ints: Vec<i32>, | ||
string: String, | ||
} | ||
|
||
#[test] | ||
fn test_hints_roundtrip() { | ||
let hint = TestStruct { | ||
ints: vec![1, 2, 3, 4, 5], | ||
string: "hello".to_string(), | ||
}; | ||
let mut host = Risc0Host::new(&[]); | ||
|
||
host.add_hint(&hint); | ||
|
||
let guest = host.simulate_with_hints(); | ||
let received = guest.read_from_host(); | ||
assert_eq!(hint, received); | ||
} |