Closed mfw78 closed 3 months ago
This mapping results in a new slot being initialiased from bytes32(0) on every nonce being executed. This results in more gas consumption as opposed to using a bitmap (mapping(uint256 => uint256)) per https://github.com/Vectorized/solady/blob/183a5c9cc3ca982492ae5fcca9e7ed6668ddb6ac/src/utils/LibBitmap.sol.
bytes32(0)
nonce
mapping(uint256 => uint256)
Line reference:
https://github.com/meetmangukiya/cow-shed/blob/d67e97dd501d2fec42ab7d3e511bc3f9a2d87a8a/src/COWShedStorage.sol#L12
Implement nonce using bitmaps.
Problem
This mapping results in a new slot being initialiased from
bytes32(0)
on everynonce
being executed. This results in more gas consumption as opposed to using a bitmap (mapping(uint256 => uint256)
) per https://github.com/Vectorized/solady/blob/183a5c9cc3ca982492ae5fcca9e7ed6668ddb6ac/src/utils/LibBitmap.sol.Line reference:
https://github.com/meetmangukiya/cow-shed/blob/d67e97dd501d2fec42ab7d3e511bc3f9a2d87a8a/src/COWShedStorage.sol#L12
Solution
Implement
nonce
using bitmaps.