-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
51 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
use anyhow::Result; | ||
use sp1_eval::evaluate_performance; | ||
use sp1_prover::components::DefaultProverComponents; | ||
use sp1_stark::SP1ProverOpts; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
evaluate_performance::<DefaultProverComponents>().await | ||
let opts = SP1ProverOpts::default(); | ||
evaluate_performance::<DefaultProverComponents>(opts).await | ||
} |
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,37 +1,37 @@ | ||
use sp1_sdk::SP1Stdin; | ||
use std::fs::File; | ||
use std::io::Read; | ||
|
||
#[derive(Clone)] | ||
pub struct TesterProgram { | ||
pub name: &'static str, | ||
pub elf: &'static str, | ||
pub input: &'static str, | ||
pub elf: &'static [u8], | ||
pub input: &'static [u8], | ||
} | ||
|
||
impl TesterProgram { | ||
const fn new(name: &'static str, elf: &'static str, input: &'static str) -> Self { | ||
const fn new(name: &'static str, elf: &'static [u8], input: &'static [u8]) -> Self { | ||
Self { name, elf, input } | ||
} | ||
} | ||
|
||
pub const PROGRAMS: &[TesterProgram] = &[ | ||
TesterProgram::new("fibonacci", "fibonacci/elf", "fibonacci/input.bin"), | ||
TesterProgram::new("ssz-withdrawals", "ssz-withdrawals/elf", "ssz-withdrawals/input.bin"), | ||
TesterProgram::new("tendermint", "tendermint/elf", "tendermint/input.bin"), | ||
TesterProgram::new( | ||
"fibonacci", | ||
include_bytes!("../programs/fibonacci/elf"), | ||
include_bytes!("../programs/fibonacci/input.bin"), | ||
), | ||
TesterProgram::new( | ||
"ssz-withdrawals", | ||
include_bytes!("../programs/ssz-withdrawals/elf"), | ||
include_bytes!("../programs/ssz-withdrawals/input.bin"), | ||
), | ||
TesterProgram::new( | ||
"tendermint", | ||
include_bytes!("../programs/tendermint/elf"), | ||
include_bytes!("../programs/tendermint/input.bin"), | ||
), | ||
]; | ||
|
||
pub fn load_program(elf_path: &str, input_path: &str) -> (Vec<u8>, SP1Stdin) { | ||
let elf_path = format!("./programs/{}", elf_path); | ||
let input_path = format!("./programs/{}", input_path); | ||
|
||
let mut elf_file = File::open(elf_path).expect("failed to open elf"); | ||
let mut elf = Vec::new(); | ||
elf_file.read_to_end(&mut elf).expect("failed to read elf"); | ||
|
||
let input_file = File::open(input_path).expect("failed to open input"); | ||
let stdin: SP1Stdin = | ||
bincode::deserialize_from(input_file).expect("failed to deserialize input"); | ||
|
||
(elf, stdin) | ||
pub fn load_program(elf: &[u8], input: &[u8]) -> (Vec<u8>, SP1Stdin) { | ||
let stdin: SP1Stdin = bincode::deserialize(input).expect("failed to deserialize input"); | ||
(elf.to_vec(), stdin) | ||
} |