Commit f75fb461 authored by yann300's avatar yann300

fix array storagebytes

parent bed164fa
......@@ -128,9 +128,13 @@ function ArrayType (type, stateDefinitions) {
storageBytes = 32
} else {
if (subArray) {
storageBytes = subArray.storageBytes // size on storage of one item of the array
storageBytes = subArray.storageBytes
}
if (storageBytes > 32) {
storageBytes = 32 * arraySize * Math.ceil(storageBytes / 32)
} else {
storageBytes = 32 * (arraySize / Math.floor(32 / storageBytes))
}
storageBytes = Math.ceil(storageBytes * arraySize) // size on storage of one the whole array
}
return {
......
......@@ -23,7 +23,7 @@ tape('solidity', function (t) {
decodeInfo = index.solidity.decodeInfo.decode(stateDec[2].attributes.type, stateDec)
checkDecodeInfo(st, decodeInfo, true, 192, 'struct structDef[3]')
decodeInfo = index.solidity.decodeInfo.decode(stateDec[3].attributes.type, stateDec)
checkDecodeInfo(st, decodeInfo, true, 48, 'bytes12[4]')
checkDecodeInfo(st, decodeInfo, true, 64, 'bytes12[4]')
stateDec = index.solidity.astHelper.extractStateVariables('contractArray', output.sources)
decodeInfo = index.solidity.decodeInfo.decode(stateDec[0].attributes.type, stateDec)
......
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