Skip to content
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

feat(cheatcodes): add vm.random{Bytes, Bytes4, Bytes8}() #8805

Closed
StackOverflowExcept1on opened this issue Sep 4, 2024 · 3 comments · Fixed by #8996
Closed

feat(cheatcodes): add vm.random{Bytes, Bytes4, Bytes8}() #8805

StackOverflowExcept1on opened this issue Sep 4, 2024 · 3 comments · Fixed by #8996
Labels
A-cheatcodes Area: cheatcodes good first issue Good for newcomers T-feature Type: feature

Comments

@StackOverflowExcept1on
Copy link
Contributor

Component

Forge

Describe the feature you would like

I'm trying to rewrite the FROST cryptographic protocol from Rust to Solidity, and vm.randomBytes would be very useful for that. I could set fuzz.seed = '0xdeadbeef' in Solidity, and use StdRng::from_seed(...) in Rust. This way I can get the same random number generator, which is very convenient for debugging and copying the implementation from Rust code.

I think it makes sense to add RngCore methods as new cheat codes:

  • vm.randomBytes4 (next_u32)
  • vm.randomBytes8 (next_u64)
  • vm.randomBytes (fill_bytes)

Additional context

No response

@StackOverflowExcept1on StackOverflowExcept1on added T-feature Type: feature T-needs-triage Type: this issue needs to be labelled labels Sep 4, 2024
@yash-atreya yash-atreya added A-cheatcodes Area: cheatcodes and removed T-needs-triage Type: this issue needs to be labelled labels Sep 4, 2024
@zerosnacks zerosnacks added the good first issue Good for newcomers label Sep 6, 2024
@LazarusAA
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I've worked with both Solidity and Rust before, I am confident I can leverage that experience to tackle this issue

How I plan on tackling this issue

I will thoroughly review the RngCore documentation to ensure a solid understanding of how to implement the methods as cheat codes and integrate them effectively into the project.

@Abhishekkochar
Copy link
Contributor

@StackOverflowExcept1on Please assign me this issue. Thanks.

@StackOverflowExcept1on
Copy link
Contributor Author

@Abhishekkochar Thanks for your contribution, but I don't have rights in this organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cheatcodes Area: cheatcodes good first issue Good for newcomers T-feature Type: feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants