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

Impl block prevrandao #2736

Merged
merged 13 commits into from
Apr 19, 2024
Merged

Impl block prevrandao #2736

merged 13 commits into from
Apr 19, 2024

Conversation

zjb0807
Copy link
Member

@zjb0807 zjb0807 commented Apr 11, 2024

Closes: #2693

@zjb0807 zjb0807 requested review from xlc and ermalkaleci April 11, 2024 08:27
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 64.89%. Comparing base (1bead11) to head (2967694).
Report is 1 commits behind head on master.

Files Patch % Lines
modules/evm/src/lib.rs 0.00% 3 Missing ⚠️
modules/support/src/mocks.rs 0.00% 3 Missing ⚠️
modules/evm/src/runner/stack.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2736      +/-   ##
==========================================
- Coverage   65.35%   64.89%   -0.47%     
==========================================
  Files          69       66       -3     
  Lines        9797     8563    -1234     
==========================================
- Hits         6403     5557     -846     
+ Misses       3394     3006     -388     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

runtime/acala/src/lib.rs Outdated Show resolved Hide resolved
runtime/acala/src/lib.rs Outdated Show resolved Hide resolved
runtime/acala/src/lib.rs Outdated Show resolved Hide resolved
@ermalkaleci
Copy link
Contributor

I have 2 concerns with this:

  1. Is this going to work for tx executive on_initialize?
  2. This is a read and doing hashing every time is called. Any risk this can be abused?

runtime/common/src/lib.rs Outdated Show resolved Hide resolved
xlc
xlc previously approved these changes Apr 15, 2024
@xlc
Copy link
Member

xlc commented Apr 15, 2024

  1. Is this going to work for tx executive on_initialize?

An insecure random value that's based on parent block hash will be provided. But there are only few limited ways to trigger EVM call in on_initialize including scheduler and XCM. XCM processing will be moved out from on_initialize in future and scheduler usage is governance protected so it should be fine.

  1. This is a read and doing hashing every time is called. Any risk this can be abused?

I guess we can cache the value? Otherwise we need to ensure we charge enough gas.

@ermalkaleci
Copy link
Contributor

  1. Is this going to work for tx executive on_initialize?

An insecure random value that's based on parent block hash will be provided. But there are only few limited ways to trigger EVM call in on_initialize including scheduler and XCM. XCM processing will be moved out from on_initialize in future and scheduler usage is governance protected so it should be fine.

  1. This is a read and doing hashing every time is called. Any risk this can be abused?

I guess we can cache the value? Otherwise we need to ensure we charge enough gas.

I think we need to be careful with this, at least enable only on mandala & karura first

@xlc
Copy link
Member

xlc commented Apr 16, 2024

It is known prevrandao have its limitation and cannot be used solely for cases requires strong random number, extra randomness source are required so I am not too worried about abuse.

@zjb0807 zjb0807 enabled auto-merge (squash) April 19, 2024 09:47
@zjb0807 zjb0807 disabled auto-merge April 19, 2024 10:50
@zjb0807 zjb0807 enabled auto-merge (squash) April 19, 2024 10:51
@zjb0807 zjb0807 merged commit 4115cd5 into master Apr 19, 2024
6 checks passed
@zjb0807 zjb0807 deleted the impl-block-prevrandao branch April 19, 2024 10:51
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.

implement block.prevrandao
3 participants