Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

Fixed-size data types use #10

Merged
merged 1 commit into from
Sep 7, 2017
Merged

Fixed-size data types use #10

merged 1 commit into from
Sep 7, 2017

Conversation

lexfrl
Copy link
Contributor

@lexfrl lexfrl commented Sep 6, 2017

use of H256 and H160 instead of plain u8-arrays

@lexfrl lexfrl requested a review from NikVolf September 7, 2017 13:34
src/ext.rs Outdated
@@ -81,7 +84,7 @@ pub fn create(endowment: &[u8; 32], code: &[u8]) -> Result<[u8; 20], Error> {
}
}

pub fn call(address: &[u8; 20], value: &[u8; 32], input: &[u8], result: &mut [u8]) -> Result<(), Error> {
pub fn call(address: &Address, value: &[u8; 32], input: &[u8], result: &mut [u8]) -> Result<(), Error> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U256 on value?
should convert then to bigendian and pass

src/ext.rs Outdated
unsafe { external::suicide(refund.as_ptr()); }
}

pub fn create(endowment: &[u8; 32], code: &[u8]) -> Result<[u8; 20], Error> {
let mut result = [0u8; 20];
pub fn create(endowment: &[u8; 32], code: &[u8]) -> Result<Address, Error> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with U256

@NikVolf
Copy link
Collaborator

NikVolf commented Sep 7, 2017

block_hash should also return H256

@NikVolf
Copy link
Collaborator

NikVolf commented Sep 7, 2017

gas_limit and difficulty should return U256

@NikVolf
Copy link
Collaborator

NikVolf commented Sep 7, 2017

Commit messages should be little more meaningful or i'll squash them

src/lib.rs Outdated
let mut value = [0u8; 32];
value.copy_from_slice(&self.raw[60..92]);
value
U256::from(value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better explicitly use from_big_endian here

@lexfrl
Copy link
Contributor Author

lexfrl commented Sep 7, 2017

Commit messages should be little more meaningful or i'll squash them

I know, I'm planning to squash them before merge

- changed interfaces of storage, ext and ParamsView to use H160, H256 and bignum::U256 primitives
lexfrl added a commit to openethereum/wasm-tests that referenced this pull request Sep 7, 2017
@NikVolf NikVolf merged commit 2096b72 into master Sep 7, 2017
@NikVolf NikVolf deleted the store_hash branch September 7, 2017 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants