Feature: Mark assembly blocks as memory-safe#545
Conversation
Pull Request Test Coverage Report for Build 5346514267
💛 - Coveralls |
0bc76e6 to
c55691a
Compare
…t/memory-safe-assembly
d05b3f0 to
3ae2bde
Compare
Fix changelog mention of createChainSpecificProxyWithNonce
| // memory is used, therefore we need to guarantee memory safety (keeping the free memory point 0x40 slot intact, | ||
| // not going beyond the scratch space, etc) | ||
| // Solidity docs: https://docs.soliditylang.org/en/latest/assembly.html#memory-safety | ||
| function allocate(length) -> pos { |
There was a problem hiding this comment.
Do we know if this increases the gas usage?
There was a problem hiding this comment.
Tested it on this test:
it.only("sends along msg.sender on simple call", async () => {
const { safe, mirror } = await setupWithTemplate();
// Setup Safe
await safe.setup([user1.address, user2.address], 1, AddressZero, "0x", mirror.address, AddressZero, 0, AddressZero);
const tx = {
to: safe.address,
data: mirror.interface.encodeFunctionData("lookAtMe"),
};
// Check that mock works as handler
const response = await user1.call(tx);
expect(response).to.be.eq(
"0x" +
"0000000000000000000000000000000000000000000000000000000000000020" +
"0000000000000000000000000000000000000000000000000000000000000018" +
"7f8dc53c" +
user1.address.slice(2).toLowerCase() +
"0000000000000000",
);
console.log(`Gas used: ${await user1.estimateGas(tx)}`);
});
0.7.6, no optimiser, no allocation: 31940
0.7.6, no optimiser, with allocation: 32160
0.8.19, 1m optimiser runs, no allocation: can’t compile
0.8.19, 1m optimiser runs, with allocation: 32527
There was a problem hiding this comment.
So yes, it does increase the gas used
| mstore(0x20, returndatasize()) | ||
| returndatacopy(0x40, 0, returndatasize()) | ||
| revert(0, add(returndatasize(), 0x40)) | ||
| let freeMemoryPtr := mload(0x40) |
There was a problem hiding this comment.
Could we align the variable names withe the other section where we have this code?
Bootstrap formal verification setup
…t/memory-safe-assembly
908b586 to
11e3459
Compare
* Add an optimistic assumption about DELEGATECALL, update nonce monotonicity rule * Add a rule for token balance * Add more rules for native token balance transition
Fix: Certora CI action
…ct (#583) * Add a rule for no signed messages * Add a rule for no signed messages
…t/memory-safe-assembly
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
802eadc to
27c87d4
Compare
27c87d4 to
1a0d70c
Compare
This PR:
FallbackManagerandStorageAccessibleNote:
The tests where we expect a certain return value fail with 0.8.x due to Hardhat being unable to parse the error message. The tests pass fine with 0.76.