-
Notifications
You must be signed in to change notification settings - Fork 45
Conversation
18e1e07
to
c3e7da1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Another test that could be interesting is checking that no storage write can be performed in this call.
@@ -90,6 +90,7 @@ export default { | |||
}, | |||
networks: { | |||
hardhat: { | |||
hardfork: "berlin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this should be the default value, is this to "freeze" the fork in case there are incompatible changes in a future fork?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that was left over when I was trying some stuff out. I'll remove it. In fact, the block gas limit setting can also be removed as the default is the same here.
}, | ||
]), | ||
).to.be.reverted; | ||
expect(await smartWallet.receiveCount()).to.not.equal(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not equal 2
instead of equal 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷 - equal 1
is more specific so will change to this.
@@ -0,0 +1,56 @@ | |||
import GnosisSafe from "@gnosis.pm/safe-contracts/build/artifacts/contracts/GnosisSafe.sol/GnosisSafe.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem to be the 1.2.0 contract. With 1.3.0 there will also be an event that is emitted in the receive
case. Is this taken into consideration?
Mentioned in the PR description ... Everything looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: you could pull the ABI from https://github.com/gnosis/safe-deployments but we are currently missing the deployment code in the deployments which might be interesting for tests ... I opened an issue for this: safe-global/safe-deployments#8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: was not even aware that we include the hardhat build artifacts in the npm release 😬
Closing this because of the aforementioned storage write issue. We will instead add access list support in order to properly support SC wallets. |
This PR just raises the transfer stipend to that it is enough for a Gnosis Safe.
For the chosen stipend amount, I simulated a transaction on Tenderly and got the following numbers:
Of the 7389 gas for the transfer, 2600 was the
COLD_ACCOUNT_ACCESS_COST
for calling a contract for the first time:The actual gas limit of the call context is
7389 - 2600 = 4789
. This makes sense since the proxy will:2100
forCOLD_SLOAD_COST
):2600
forCOLD_ACCOUNT_ACCESS_COST
)1000 additional gas was chosen so it is enough to log an even on receiving Ether for the Save v1.3.
Test Plan
Added a test to make sure the Eth transfer works for a Gnosis Safe v1.3 on Berlin hardfork 🎉.
Issues
Currently there is an issue that the with the increased stipend,
SSTORE
s are actually allowed and can be used to modify storage, as made evident by the failingshould revert when transferring Ether to contract writes storage
test. THis is because EIP-2200 makes storage writes on non-zero storage only cost 5000k gas.