Commit e3f6b8d1 authored by yann300's avatar yann300

decode int, uint, address

parent a2cf573a
...@@ -13,7 +13,7 @@ Address.prototype.decodeFromStorage = function (location, storageContent) { ...@@ -13,7 +13,7 @@ Address.prototype.decodeFromStorage = function (location, storageContent) {
} }
Address.prototype.decodeLocals = function (stackHeight, stack, memory) { Address.prototype.decodeLocals = function (stackHeight, stack, memory) {
if (stack.length - 1 < stackHeight) { if (stackHeight >= stack.length) {
return '0x0000000000000000000000000000000000000000' return '0x0000000000000000000000000000000000000000'
} else { } else {
return '0x' + util.extractHexByteSlice(stack[stack.length - 1 - stackHeight], this.storageBytes, 0) return '0x' + util.extractHexByteSlice(stack[stack.length - 1 - stackHeight], this.storageBytes, 0)
......
...@@ -12,7 +12,7 @@ Int.prototype.decodeFromStorage = function (location, storageContent) { ...@@ -12,7 +12,7 @@ Int.prototype.decodeFromStorage = function (location, storageContent) {
} }
Int.prototype.decodeLocals = function (stackHeight, stack, memory) { Int.prototype.decodeLocals = function (stackHeight, stack, memory) {
if (stack.length - 1 < stackHeight) { if (stackHeight >= stack.length) {
return '0' return '0'
} else { } else {
return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), 32, true) return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), 32, true)
......
...@@ -12,7 +12,7 @@ Uint.prototype.decodeFromStorage = function (location, storageContent) { ...@@ -12,7 +12,7 @@ Uint.prototype.decodeFromStorage = function (location, storageContent) {
} }
Uint.prototype.decodeLocals = function (stackHeight, stack, memory) { Uint.prototype.decodeLocals = function (stackHeight, stack, memory) {
if (stack.length - 1 < stackHeight) { if (stackHeight >= stack.length) {
return '0' return '0'
} else { } else {
return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), this.storageBytes, false) return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), this.storageBytes, false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment