Summary
Certora identified a bug in the Solidity 0.4.24 compiler that affects the gas consumption of the Lido contract, with the help of the Certora prover. When creating a memory bytes array new bytes(48) in contracts/0.4.24/lib/SigningKeys.sol, the compiler actually allocates 32 * 48 = 1536 bytes, which is a waste of gas.
|
bytes memory tmpKey = new bytes(48); |
We believe this affects also other constant size array allocations. We've also confirmed this issue exists in the currently deployed version.
Expected Behavior
Allocate on 48 bytes.
Potential Impact
Waste of gas.
Steps to Reproduce
Any call to SigningKeys.saveKeysSigs will allocate too much memory.
Possible Solutions
No response
Guidelines
Summary
Certora identified a bug in the Solidity 0.4.24 compiler that affects the gas consumption of the Lido contract, with the help of the Certora prover. When creating a memory bytes array
new bytes(48)incontracts/0.4.24/lib/SigningKeys.sol, the compiler actually allocates 32 * 48 = 1536 bytes, which is a waste of gas.core/contracts/0.4.24/lib/SigningKeys.sol
Line 52 in 22cab0f
We believe this affects also other constant size array allocations. We've also confirmed this issue exists in the currently deployed version.
Expected Behavior
Allocate on 48 bytes.
Potential Impact
Waste of gas.
Steps to Reproduce
Any call to
SigningKeys.saveKeysSigswill allocate too much memory.Possible Solutions
No response
Guidelines