Fixed bug that added a superfluous empty slot for data when encoding an empty string coming from storage.

Added tests covering empty string, uninitialized string, emptry string literal, byte arrays and explicit call to `abi.encode`.
This commit is contained in:
Matheus Aguiar
2022-05-18 14:50:26 -03:00
committed by matheusaaguiar
parent de7daaa2af
commit 33ea6a679d
10 changed files with 110 additions and 9 deletions
+1 -1
View File
@@ -699,7 +699,7 @@ string ABIFunctions::abiEncodingFunctionCompactStorageArray(
case 0 {
// short byte array
mstore(pos, and(slotValue, not(0xff)))
ret := add(pos, <lengthPaddedShort>)
ret := add(pos, mul(<lengthPaddedShort>, iszero(iszero(length))))
}
case 1 {
// long byte array