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: FVM no longer draws randomness for you #1378

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

arajasek
Copy link
Contributor

Integrates filecoin-project/ref-fvm#1848 from the FVM next workstream.

Test to come.

@arajasek arajasek requested a review from Stebalien August 17, 2023 20:30
match e {
ErrorNumber::LimitExceeded => {
actor_error!(illegal_argument; "randomness lookback exceeded: {}", e)
}
e => actor_error!(assertion_failed; "get chain randomness failed with an unexpected error: {}", e),
}
})
})?;
Ok(draw_randomness(&digest, personalization, rand_epoch, entropy))
Copy link
Member

Choose a reason for hiding this comment

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

I was initially intending to do this in the SDK but... yeah, it actually makes sense to do it here given that the FVM doesn't really care about how the user draws randomness anyways.

So LGTM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this seems like the better thing to do? It does mean that all contracts need to implement their own "drawing" logic, but that's a good thing, arguably.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (asr/next@5a3c12e). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             asr/next    #1378   +/-   ##
===========================================
  Coverage            ?   90.76%           
===========================================
  Files               ?      145           
  Lines               ?    27286           
  Branches            ?        0           
===========================================
  Hits                ?    24766           
  Misses              ?     2520           
  Partials            ?        0           

@@ -19,3 +21,63 @@ pub enum DomainSeparationTag {
PoStChainCommit = 9,
EvmPrevRandao = 10,
}

pub fn draw_randomness(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clippy is convinced this is unused, because it is only called from the FVM-specific code. Is there a more sophisticated way to fix this than slapping allow(unused) on it?

Copy link
Member

Choose a reason for hiding this comment

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

Not really.

@@ -19,3 +21,63 @@ pub enum DomainSeparationTag {
PoStChainCommit = 9,
EvmPrevRandao = 10,
}

pub fn draw_randomness(
Copy link
Member

Choose a reason for hiding this comment

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

Not really.

@Stebalien
Copy link
Member

You'll need to rebase as well.

@arajasek arajasek force-pushed the asr/stop-hashing-randomness branch 3 times, most recently from 6a76d41 to ce83ed7 Compare August 23, 2023 21:39
@arajasek arajasek changed the base branch from asr/next to fvm-next August 23, 2023 21:40
@arajasek arajasek force-pushed the asr/stop-hashing-randomness branch from ce83ed7 to 8ddec2f Compare August 23, 2023 21:50
@arajasek arajasek force-pushed the asr/stop-hashing-randomness branch from 8ddec2f to dc11008 Compare August 25, 2023 15:46
@arajasek arajasek enabled auto-merge (squash) August 25, 2023 15:46
@arajasek arajasek disabled auto-merge August 25, 2023 15:47
@arajasek arajasek enabled auto-merge (rebase) August 25, 2023 15:47
@arajasek arajasek disabled auto-merge August 25, 2023 15:47
@arajasek arajasek enabled auto-merge (squash) August 25, 2023 15:47
@arajasek arajasek merged commit 0154f8f into fvm-next Aug 25, 2023
@arajasek arajasek deleted the asr/stop-hashing-randomness branch August 25, 2023 17:13
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