Skip to content

FVM specific EVM precompiles #792

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

Merged
merged 11 commits into from
Nov 12, 2022
Merged

FVM specific EVM precompiles #792

merged 11 commits into from
Nov 12, 2022

Conversation

mriise
Copy link
Contributor

@mriise mriise commented Oct 31, 2022

fixes filecoin-project/ref-fvm#947

  • changes randomness functions to take a raw i64 since this is userspace now
  • add precompiles:
    • resolve_address
    • lookup_address
    • get_actor_code_cid
    • get_randomness(beacon/chain)

context will be in its own PR

@mriise mriise marked this pull request as ready for review November 11, 2022 01:52
- changes randomness functions to take a raw i64 since this is userspace now
- add precompiles: resolve_address, lookup_address, get_actor_code_cid, get_randomness(beacon/chain)
@mriise mriise force-pushed the feat/fevm-syscall-precompile branch from 717414f to e307860 Compare November 11, 2022 02:03

fn get_actor_code_cid<RT: Runtime>(rt: &RT, input: &[u8]) -> PrecompileResult {
let id = EthAddress(input[..20].try_into().unwrap()).as_id();
if id.is_none() {
Copy link
Member

Choose a reason for hiding this comment

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

We should probably just resolve this address for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are just grabbing the code CID, its easy enough to call the resolve_address precompile

@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2022

Codecov Report

Merging #792 (735de82) into next (a56108c) will decrease coverage by 0.46%.
The diff coverage is 5.29%.

❗ Current head 735de82 differs from pull request most recent head d0af2db. Consider uploading reports for the commit d0af2db to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #792      +/-   ##
==========================================
- Coverage   87.50%   87.03%   -0.47%     
==========================================
  Files         125      125              
  Lines       22649    22806     +157     
==========================================
+ Hits        19818    19850      +32     
- Misses       2831     2956     +125     
Impacted Files Coverage Δ
runtime/src/runtime/mod.rs 84.21% <ø> (ø)
test_vm/src/lib.rs 82.50% <0.00%> (-1.64%) ⬇️
actors/evm/src/interpreter/precompiles.rs 87.42% <3.17%> (-8.31%) ⬇️
runtime/src/test_utils.rs 76.13% <8.33%> (-5.11%) ⬇️
runtime/src/runtime/randomness.rs 0.00% <0.00%> (-100.00%) ⬇️
actors/evm/src/interpreter/instructions/context.rs 79.71% <0.00%> (-1.12%) ⬇️
runtime/src/util/message_accumulator.rs 93.63% <0.00%> (-0.91%) ⬇️
actors/reward/src/lib.rs 82.92% <0.00%> (-0.82%) ⬇️
actors/power/src/lib.rs 83.62% <0.00%> (-0.22%) ⬇️
... and 10 more

@mriise mriise requested a review from Stebalien November 11, 2022 22:42
@mriise mriise enabled auto-merge (squash) November 11, 2022 23:55
@mriise mriise merged commit eea22e0 into next Nov 12, 2022
@mriise mriise deleted the feat/fevm-syscall-precompile branch November 12, 2022 00:03
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