solidity/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol
2021-04-22 16:54:02 +02:00

24 lines
587 B
Solidity

contract C {
uint256[] storageArray;
function pushEmpty(uint256 len) public {
while(storageArray.length < len)
storageArray.push();
for (uint i = 0; i < len; i++)
require(storageArray[i] == 0);
}
}
// ====
// EVMVersion: >=petersburg
// compileViaYul: also
// ----
// pushEmpty(uint256): 128
// gas irOptimized: 630896
// gas legacy: 607287
// gas legacyOptimized: 589048
// pushEmpty(uint256): 256
// gas irOptimized: 861040
// gas legacy: 828983
// gas legacyOptimized: 802808
// pushEmpty(uint256): 32768 -> FAILURE # out-of-gas #