Skip to content

Commit

Permalink
le -> be in U256
Browse files Browse the repository at this point in the history
  • Loading branch information
wanderer committed Nov 11, 2016
1 parent dad20bc commit 218378e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions EVMinterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ module.exports = class Interface {
_call (gasHigh, gasLow, addressOffset, valueOffset, dataOffset, dataLength, resultOffset, resultLength) {
const gas = from64bit(gasHigh, gasLow)
// Load the params from mem
const address = Address.fromMemory(this.getMemory(addressOffset, ADDRESS_SIZE_BYTES))
const address = [...this.getMemory(addressOffset, ADDRESS_SIZE_BYTES)]
const value = U256.fromMemory(this.getMemory(valueOffset, U128_SIZE_BYTES))

this.takeGas(40)
Expand Down Expand Up @@ -517,7 +517,7 @@ module.exports = class Interface {
this.takeGas(40)

const data = this.getMemory(dataOffset, dataLength).slice(0)
const address = Address.fromMemory(this.getMemory(addressOffset, ADDRESS_SIZE_BYTES))
const address = [...this.getMemory(addressOffset, ADDRESS_SIZE_BYTES)]
const [errorCode, result] = this.environment.callDelegate(gas, address, data)
this.setMemory(resultOffset, resultLength, result)
return errorCode
Expand Down
4 changes: 2 additions & 2 deletions deps/u256.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ module.exports = class U256 {

// This assumes Uint8Array in LSB (WASM code)
static fromMemory (value) {
return new U256(new BN(value, 16, 'le'))
return new U256(new BN(value, 16, 'be'))
}

// This assumes Uint8Array in LSB (WASM code)
toMemory (width) {
return this._value.toBuffer('le', width || 32)
return this._value.toBuffer('be', width || 32)
}

toString (radix = 10) {
Expand Down

0 comments on commit 218378e

Please sign in to comment.