Skip to content

Conversation

@x-senpai-x
Copy link
Contributor

Introduces benchmarking for process_epoch in the Beacon State transition function.
Upgrades risczero dependency from previous version to v3.0.1.

@unnawut
Copy link
Collaborator

unnawut commented Aug 25, 2025

Great work btw!

@unnawut unnawut requested a review from syjn99 September 5, 2025 05:04
@unnawut
Copy link
Collaborator

unnawut commented Sep 5, 2025

@syjn99 only if you'd like to review and have time!

Copy link
Collaborator

@unnawut unnawut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyhow this looks good to me. Just fix the build failure and see if Jun would like to review.

If no updates feel free to merge by the end of today once the fmt is fixed.

Copy link
Member

@syjn99 syjn99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things I'd like to note. BTW good job!

1. Rust version issue

➜  host git:(pr/x-senpai-x/25) ✗ make run-block-attestation
##################################################
Running block benchmarks for attestation...
##################################################
error: rustc 1.85.0 is not supported by the following packages:
  [email protected] requires rustc 1.86
  [email protected] requires rustc 1.86
  [email protected] requires rustc 1.86
  [email protected] requires rustc 1.88.0
  [email protected] requires rustc 1.88.0
  [email protected] requires rustc 1.88.0
  [email protected] requires rustc 1.88.0
  [email protected] requires rustc 1.88.0
Either upgrade rustc or select compatible dependency versions with
`cargo update <name>@<current-ver> --precise <compatible-ver>`
where `<compatible-ver>` is the latest version supporting rustc 1.85.0

Execution complete for block attestation.

As the Rust version of Ream was bumped, this should also be applied to this project. make run-* command doesn't work on my machine with the current rust-toolchain.

[toolchain]
channel = "1.89.0"
components = ["llvm-tools", "rustc-dev"]

This worked for me.

2. Formatting issue

As CI says, all files are not well formatted. Could you check your default formatter also?


let mut state: BeaconState = deserialize(&pre_state_ssz_bytes);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this file needs to be formatted.

ethereum_ssz = "0.9"
ream-consensus = { git = "https://github.com/ReamLabs/ream.git", package = "ream-consensus", features = ["zkvm"] }
ethereum_ssz = { workspace = true }
ream-consensus = { workspace=true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ream-consensus = { workspace=true }
ream-consensus = { workspace = true }

Sorry for nitpicking 🙏

host/Cargo.toml Outdated
hex = "0.4.3"
methods = { path = "../methods" }
risc0-zkvm = { version = "2.0.1" }
risc0-zkvm = { version = "3.0.1" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about updating this version with the latest one? (3.0.3)

ethereum_ssz = "0.9"
ream-consensus = { git = "https://github.com/ReamLabs/ream.git", package = "ream-consensus", features = ["zkvm"] }
ream-consensus = { git = "https://github.com/ReamLabs/ream.git", package = "ream-consensus-beacon", features = ["zkvm"] }
sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use sha2 here? Deletting this dependency doesn't make any trouble in my local environment.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess these changes should be also applied to the README.md in the project root.

}

// Generic traits for operation handling
pub trait OperationHandler {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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.

}
}

fn to_block_operation_type(&self) -> BlockOperationType {
Copy link
Member

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)

Copy link
Contributor Author

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

@x-senpai-x
Copy link
Contributor Author

@syjn99 thanks for the review, I have addressed all the changes could you please review the changes again?

Copy link
Member

@syjn99 syjn99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey just run on my machine and it works well! OK on my side, let's wait for @unnawut's approval then.

Meanwhile, I think you should change the PR title into 3.0.3 as well.

@x-senpai-x x-senpai-x changed the title feat: add process_epoch benchmark and upgrade RISC Zero to v3.0.1 feat: add process_epoch benchmark and upgrade RISC Zero to v3.0.3 Sep 8, 2025
@unnawut unnawut merged commit 9e856de into ReamLabs:master Sep 24, 2025
2 checks passed
@unnawut
Copy link
Collaborator

unnawut commented Sep 24, 2025

Thanks @x-senpai-x!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants