From 1feb3d25e5bcd5077bd83b64079053655d4d6bce Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Fri, 29 Sep 2023 03:57:57 -0700 Subject: [PATCH] refactor(gsys): fix signature of `gr_random` (#3376) --- gcore/src/exec.rs | 2 +- gsys/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcore/src/exec.rs b/gcore/src/exec.rs index b214be27f1e..84e1c65d7f1 100644 --- a/gcore/src/exec.rs +++ b/gcore/src/exec.rs @@ -452,7 +452,7 @@ pub fn pay_program_rent(program_id: ActorId, value: u128) -> Result<(u128, u32)> pub fn random(subject: [u8; 32]) -> Result<([u8; 32], u32)> { let mut res: BlockNumberWithHash = Default::default(); - unsafe { gsys::gr_random(subject.as_ptr(), res.as_mut_ptr()) }; + unsafe { gsys::gr_random(&subject, res.as_mut_ptr()) }; Ok((res.hash, res.bn)) } diff --git a/gsys/src/lib.rs b/gsys/src/lib.rs index e3165248b78..1ed2e672116 100644 --- a/gsys/src/lib.rs +++ b/gsys/src/lib.rs @@ -467,9 +467,9 @@ extern "C" { /// Infallible `gr_random` calculate syscall. /// /// Arguments type: - /// - `subject`: `const ptr` for the begging of the payload buffer. + /// - `subject`: `const ptr` for the subject. /// - `bn_random`: `mut ptr` for concatenated block number with hash. - pub fn gr_random(subject: *const BufferStart, bn_random: *mut BlockNumberWithHash); + pub fn gr_random(subject: *const Hash, bn_random: *mut BlockNumberWithHash); // TODO: issue #1859 /// Fallible `gr_read` get syscall.