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

Reintroduce randomness precompile #1576

Closed
wants to merge 2 commits into from
Closed

Conversation

ZenGround0
Copy link
Contributor

@ZenGround0 ZenGround0 commented Aug 26, 2024

Implementation of filecoin-project/FIPs#1048

cc @anorth

  • Tests for the EVM precompile

///
/// | Param | Value |
/// |------------------|---------------------------|
/// | randomness_epoch | U256 - low i64 |
Copy link
Member

Choose a reason for hiding this comment

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

formatting


let randomness_epoch = input_params.read_value()?;
let entropy_length: u32 = input_params.read_value()?;
let entropy = input_params.read_padded(entropy_length.try_into().unwrap_or(0));
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure we want the unwrap or zero here? u32::MAX will turn into 0, I think we want to fail in that case.

Some(resolve_address::<RT>), // 0xfe00..01
Some(lookup_delegated_address::<RT>), // 0xfe00..02
Some(call_actor::<RT>), // 0xfe00..03
None, // 0xfe00..04 DISABLED
Some(call_actor_id::<RT>), // 0xfe00..05
Some(get_randomness::<RT>), // 0xfe00..06
Copy link
Member

Choose a reason for hiding this comment

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

nit: re-use 4? This sued to be 4.

@anorth
Copy link
Member

anorth commented Aug 26, 2024

Reverting this to a draft while we settle FIP / design questions.

@anorth
Copy link
Member

anorth commented Aug 26, 2024

An alternative which just exposes the beacon values: #1577

@ZenGround0
Copy link
Contributor Author

I'm happy with your approach @anorth, closing in favor of that one

@ZenGround0 ZenGround0 closed this Aug 27, 2024
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.

3 participants