From 1998330394858f0e48cf6e2ef33fbf611170a131 Mon Sep 17 00:00:00 2001 From: Jake Lang Date: Thu, 29 Nov 2018 13:08:01 -0500 Subject: [PATCH] cleanups --- src/lib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 566e678..31590a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,6 @@ type StorageKey = Bytes32; type StorageValue = Bytes32; type Topic = Bytes32; type Hash = Bytes32; -// TODO: is this a number of a bytestring? type Difficulty = Bytes32; /// Enum representing an error code for EEI calls. Currently used by `codeCopy`, `callDataCopy`, @@ -411,19 +410,19 @@ pub fn call_static(gas_limit: u64, address: &Address, data: &[u8]) -> CallResult /// Creates a contract with the the given code, sending the specified ether value to its address. pub fn create(value: &EtherValue, data: &[u8]) -> CreateResult { - let mut result: Address = Address::default(); + let mut address: Address = Address::default(); let ret = unsafe { native::ethereum_create( value.bytes.as_ptr() as *const u32, data.as_ptr() as *const u32, data.len() as u32, - result.bytes.as_mut_ptr() as *const u32, + address.bytes.as_mut_ptr() as *const u32, ) }; match ret { - 0 => CreateResult::Successful(result), + 0 => CreateResult::Successful(address), 1 => CreateResult::Failure, 2 => CreateResult::Revert, _ => panic!(), @@ -614,12 +613,12 @@ pub fn finish_data(data: &[u8]) -> ! { } /// Accesses the storage data at the specified key. -pub fn storage_load(key: &StorageKey) -> StorageValue { +pub fn storage_load(key: &mut StorageKey) -> StorageValue { let mut ret = StorageValue::default(); unsafe { native::ethereum_storageLoad( - key.bytes.as_ptr() as *const u32, + key.bytes.as_mut_ptr() as *const u32, ret.bytes.as_mut_ptr() as *const u32, ); }