Skip to content

Commit

Permalink
Back to address ..06.
Browse files Browse the repository at this point in the history
  • Loading branch information
anorth committed Aug 27, 2024
1 parent 6cb6fd3 commit 3bb132e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions actors/evm/src/interpreter/precompiles/fvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub(super) fn call_actor_shared<RT: Runtime>(
///
/// | Param | Value |
/// |------------------|---------------------------|
/// | randomness_epoch | U256 - low i64 |
/// | epoch | U256 - low i64 |
///
/// Errors if unable to fetch randomness
pub(super) fn get_randomness<RT: Runtime>(
Expand All @@ -234,9 +234,7 @@ pub(super) fn get_randomness<RT: Runtime>(
_: PrecompileContext,
) -> PrecompileResult {
let mut input_params = ValueReader::new(input);

let randomness_epoch = input_params.read_value()?;

let randomness = system.rt.get_beacon_randomness(randomness_epoch);
randomness.map(|r| r.to_vec()).map_err(|_| PrecompileError::InvalidInput)
}
6 changes: 4 additions & 2 deletions actors/evm/src/interpreter/precompiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ pub struct Precompiles<RT>(PhantomData<RT>);

impl<RT: Runtime> Precompiles<RT> {
/// FEVM specific precompiles (0xfe prefix)
const NATIVE_PRECOMPILES: PrecompileTable<RT, 5> = PrecompileTable([
const NATIVE_PRECOMPILES: PrecompileTable<RT, 6> = PrecompileTable([
Some(resolve_address::<RT>), // 0xfe00..01
Some(lookup_delegated_address::<RT>), // 0xfe00..02
Some(call_actor::<RT>), // 0xfe00..03
Some(get_randomness::<RT>), // 0xfe00..04
None, // 0xfe00..04 get_actor_type DISABLED
Some(call_actor_id::<RT>), // 0xfe00..05
Some(get_randomness::<RT>), // 0xfe00..06

]);

/// EVM specific precompiles
Expand Down

0 comments on commit 3bb132e

Please sign in to comment.