mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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:
committed by
matheusaaguiar
parent
de7daaa2af
commit
33ea6a679d
@@ -19,7 +19,7 @@ contract c {
|
||||
// ----
|
||||
// f(uint256): 0 -> 0x20, 0x00
|
||||
// f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00
|
||||
// gas irOptimized: 121735
|
||||
// gas irOptimized: 121752
|
||||
// gas legacy: 123884
|
||||
// gas legacyOptimized: 119139
|
||||
// f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671
|
||||
|
||||
+2
-2
@@ -37,11 +37,11 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x40, 0x80, 6, 0x6162636465660000000000000000000000000000000000000000000000000000, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000
|
||||
// gas irOptimized: 179895
|
||||
// gas irOptimized: 179912
|
||||
// gas legacy: 180676
|
||||
// gas legacyOptimized: 180070
|
||||
// g() -> 0x40, 0xc0, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000, 0x11, 0x3132333435363738393233343536373839000000000000000000000000000000
|
||||
// gas irOptimized: 107274
|
||||
// gas irOptimized: 107291
|
||||
// gas legacy: 107877
|
||||
// gas legacyOptimized: 107236
|
||||
// h() -> 0x40, 0x60, 0x00, 0x00
|
||||
|
||||
@@ -13,6 +13,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000
|
||||
// gas irOptimized: 202840
|
||||
// gas irOptimized: 202864
|
||||
// gas legacy: 204441
|
||||
// gas legacyOptimized: 203419
|
||||
|
||||
@@ -12,6 +12,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000
|
||||
// gas irOptimized: 109499
|
||||
// gas irOptimized: 109515
|
||||
// gas legacy: 126728
|
||||
// gas legacyOptimized: 123444
|
||||
|
||||
Reference in New Issue
Block a user