Skip to content

Commit

Permalink
fixed from_bits_unchecked, replaced with from_bits
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaicalinluca committed Nov 28, 2023
1 parent db90b08 commit cb49885
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions framework/scenario/src/api/core_api_vh/blockchain_api_vh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ impl<VHB: VMHooksApiBackend> BlockchainApiImpl for VMHooksApi<VHB> {
let result = self.with_vm_hooks(|vh| {
vh.get_esdt_local_roles(token_id_handle.get_raw_handle_unchecked())
});
unsafe {
multiversx_sc::types::EsdtLocalRoleFlags::from_bits_unchecked(result as u64)
}

multiversx_sc::types::EsdtLocalRoleFlags::from_bits(result as u64).unwrap()
}
}
9 changes: 4 additions & 5 deletions framework/wasm-adapter/src/api/blockchain_api_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,9 @@ impl BlockchainApiImpl for VmApiImpl {
&self,
token_id_handle: Self::ManagedBufferHandle,
) -> multiversx_sc::types::EsdtLocalRoleFlags {
unsafe {
multiversx_sc::types::EsdtLocalRoleFlags::from_bits_unchecked(getESDTLocalRoles(
token_id_handle,
) as u64)
}
multiversx_sc::types::EsdtLocalRoleFlags::from_bits(unsafe {
getESDTLocalRoles(token_id_handle)
} as u64)
.unwrap()
}
}

0 comments on commit cb49885

Please sign in to comment.