rename sha => sha3_32

pull/7/head
yann300 8 years ago
parent d843449bdd
commit 877250932b
  1. 2
      src/helpers/util.js
  2. 2
      src/solidity/types/ArrayType.js
  3. 2
      src/solidity/types/DynamicByteArray.js
  4. 2
      src/storage/storageResolver.js
  5. 2
      src/trace/traceCache.js
  6. 4
      test/solidity/mockStorageResolver.js

@ -125,7 +125,7 @@ module.exports = {
* @param {String} value - value to sha3
* @return {Object} - return sha3ied value
*/
sha3: function (value) {
sha3_32: function (value) {
var ret = ethutil.bufferToHex(ethutil.setLengthLeft(value, 32))
ret = ethutil.sha3(ret)
return ethutil.bufferToHex(ret)

@ -43,7 +43,7 @@ class ArrayType extends RefType {
}
if (this.arraySize === 'dynamic') {
size = util.toBN('0x' + slotValue)
currentLocation.slot = helper.sha3(location.slot)
currentLocation.slot = helper.sha3_32(location.slot)
} else {
size = new BN(this.arraySize)
}

@ -23,7 +23,7 @@ class DynamicByteArray extends RefType {
var bn = new BN(value, 16)
if (bn.testn(0)) {
var length = bn.div(new BN(2))
var dataPos = new BN(helper.sha3(location.slot).replace('0x', ''), 16)
var dataPos = new BN(helper.sha3_32(location.slot).replace('0x', ''), 16)
var ret = ''
var currentSlot = '0x'
try {

@ -32,7 +32,7 @@ class StorageResolver {
if (error) {
callback(error)
} else {
var hashed = helper.sha3(slot)
var hashed = helper.sha3_32(slot)
callback(null, storage[hashed] !== undefined ? storage[hashed] : null)
}
})

@ -87,7 +87,7 @@ TraceCache.prototype.pushStoreChanges = function (index, address, key, value) {
'address': address,
'key': key,
'value': value,
'hashedKey': helper.sha3(key)
'hashedKey': helper.sha3_32(key)
}
this.storageChanges.push(index)
}

@ -5,7 +5,7 @@ class MockStorageResolver {
constructor (_storage) {
this.storage = {}
for (var k in _storage) {
var hashed = util.sha3(k)
var hashed = util.sha3_32(k)
this.storage[hashed] = {
hashed: hashed,
key: k,
@ -19,7 +19,7 @@ class MockStorageResolver {
}
storageSlot (slot, callback) {
var hashed = util.sha3(slot)
var hashed = util.sha3_32(slot)
callback(null, this.storage[hashed])
}

Loading…
Cancel
Save