-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add process_epoch benchmark and upgrade RISC Zero to v3.0.3 #25
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
Changes from 4 commits
94afa5d
a46ec70
06da448
c6de67f
b75e2be
752db8f
e6b1cac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ derive_more = { version = "2.0.1", features = ["full"] } | |
| dotenv = "0.15.0" | ||
| hex = "0.4.3" | ||
| methods = { path = "../methods" } | ||
| risc0-zkvm = { version = "2.0.1" } | ||
| risc0-zkvm = { version = "3.0.1" } | ||
|
||
| serde = { version = "1.0", default-features = false, features = ["derive"] } | ||
| serde_json = { version = "1.0.139", default-features = false, features = ["alloc"] } | ||
| tracing = { workspace = true } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess these changes should be also applied to the |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,15 +1,29 @@ | ||||||
| use clap::{Parser, ValueEnum}; | ||||||
| use clap::{Parser, Subcommand, ValueEnum}; | ||||||
| use derive_more::Display; | ||||||
| use ream_lib::input::{BlockOperationType, EpochOperationType}; | ||||||
| use std::path::PathBuf; | ||||||
|
|
||||||
| #[derive(Debug, Clone, Parser)] | ||||||
| pub struct OperationArgs { | ||||||
| #[clap(long, short)] | ||||||
| pub operation_name: OperationName, | ||||||
| #[clap(subcommand)] | ||||||
| pub operation: Operation, | ||||||
| } | ||||||
|
|
||||||
| #[derive(Debug, Clone, Subcommand)] | ||||||
| pub enum Operation { | ||||||
| Block { | ||||||
| #[clap(value_enum)] | ||||||
| operation: BlockOperation, | ||||||
| }, | ||||||
| Epoch { | ||||||
| #[clap(value_enum)] | ||||||
| operation: EpochOperation, | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| #[derive(ValueEnum, Debug, Clone, Display)] | ||||||
| #[clap(rename_all = "snake_case")] | ||||||
| pub enum OperationName { | ||||||
| pub enum BlockOperation { | ||||||
| #[display("attestation")] | ||||||
| Attestation, | ||||||
| #[display("attester_slashing")] | ||||||
|
|
@@ -32,19 +46,161 @@ pub enum OperationName { | |||||
| Withdrawals, | ||||||
| } | ||||||
|
|
||||||
| impl OperationName { | ||||||
| pub fn to_input_name(&self) -> String { | ||||||
| #[derive(ValueEnum, Debug, Clone, Display)] | ||||||
| #[clap(rename_all = "snake_case")] | ||||||
| pub enum EpochOperation { | ||||||
| #[display("justification_and_finalization")] | ||||||
| JustificationAndFinalization, | ||||||
| #[display("inactivity_updates")] | ||||||
| InactivityUpdates, | ||||||
| #[display("rewards_and_penalties")] | ||||||
| RewardsAndPenalties, | ||||||
| #[display("registry_updates")] | ||||||
| RegistryUpdates, | ||||||
| #[display("slashings")] | ||||||
| Slashings, | ||||||
| #[display("eth1_data_reset")] | ||||||
| Eth1DataReset, | ||||||
| #[display("pending_deposits")] | ||||||
| PendingDeposits, | ||||||
| #[display("pending_consolidations")] | ||||||
| PendingConsolidations, | ||||||
| #[display("effective_balance_updates")] | ||||||
| EffectiveBalanceUpdates, | ||||||
| #[display("slashings_reset")] | ||||||
| SlashingsReset, | ||||||
| #[display("randao_mixes_reset")] | ||||||
| RandaoMixesReset, | ||||||
| #[display("historical_summaries_update")] | ||||||
| HistoricalSummariesUpdate, | ||||||
| #[display("participation_flag_updates")] | ||||||
| ParticipationFlagUpdates, | ||||||
| } | ||||||
|
|
||||||
| // Generic traits for operation handling | ||||||
| pub trait OperationHandler { | ||||||
|
||||||
| pub trait OperationHandler { | |
| pub trait OperationHandler: std::fmt::Display { |
If you want this to implement Display trait, you can inherit the trait like this. This can also make run_tests more clean.
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.
aah got it, makes much more sense this way.
Outdated
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 to_* functions can be implemented with From trait (https://doc.rust-lang.org/std/convert/trait.From.html)
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.
Thanks! I'll use the From trait instead
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.
Do we use
sha2here? Deletting this dependency doesn't make any trouble in my local environment.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.
It was introduced by @SuccinctPaul for benchmarks using this precompile. It significantly reduces the execution cycles and time. From cargo.lock, it seems sha2 is being used extensively by several packages.
If we delete this dependency it would switch to the original sha2 crate and the timings almost double.
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.
yep.