fixes memory write: no padding

This commit is contained in:
andri lim 2019-02-15 08:37:54 +07:00 committed by zah
parent fdc34a4cf6
commit 17188dfcb1
1 changed files with 6 additions and 5 deletions

View File

@ -223,9 +223,10 @@ proc writePaddedResult(mem: var Memory,
mem.extend(memPos, len) mem.extend(memPos, len)
let dataEndPosition = dataPos.int64 + len - 1 let dataEndPosition = dataPos.int64 + len - 1
let sourceBytes = data[min(dataPos, data.len) .. min(data.len - 1, dataEndPosition)] let sourceBytes = data[min(dataPos, data.len) .. min(data.len - 1, dataEndPosition)]
mem.write(memPos, sourceBytes) mem.write(memPos, sourceBytes)
# geth doesn't do padding, it causes block validation error
when false:
# Don't duplicate zero-padding of mem.extend # Don't duplicate zero-padding of mem.extend
let paddingOffset = memPos + sourceBytes.len let paddingOffset = memPos + sourceBytes.len
# TODO: avoid unnecessary memory allocation # TODO: avoid unnecessary memory allocation