Skip to content

Commit

Permalink
fmt, check
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Aug 26, 2024
1 parent a567c8a commit 8e742d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions actors/evm/src/interpreter/precompiles/fvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,16 @@ pub(super) fn get_randomness<RT: Runtime>(
input: &[u8],
_: PrecompileContext,
) -> PrecompileResult {

let mut input_params = ValueReader::new(input);

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));

let randomness = system.rt.get_randomness_from_beacon(fil_actors_runtime::runtime::DomainSeparationTag::EvmRandPrecompile, randomness_epoch, &entropy);
let randomness = system.rt.get_randomness_from_beacon(
fil_actors_runtime::runtime::DomainSeparationTag::EvmRandPrecompile,
randomness_epoch,
&entropy,
);
randomness.map(|r| r.to_vec()).map_err(|_| PrecompileError::InvalidInput)
}
}
2 changes: 1 addition & 1 deletion actors/evm/src/interpreter/precompiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod evm;
mod fvm;

use evm::{blake2f, ec_add, ec_mul, ec_pairing, ec_recover, identity, modexp, ripemd160, sha256};
use fvm::{call_actor, call_actor_id, lookup_delegated_address, resolve_address, get_randomness};
use fvm::{call_actor, call_actor_id, get_randomness, lookup_delegated_address, resolve_address};

type PrecompileFn<RT> = fn(&mut System<RT>, &[u8], PrecompileContext) -> PrecompileResult;
pub type PrecompileResult = Result<Vec<u8>, PrecompileError>;
Expand Down

0 comments on commit 8e742d8

Please sign in to comment.