Open PaulRBerg opened 1 year ago
What exactly do you want to test? Generally, as long as you do not do things like tx.origin == msg.sender
no custom logic is required to make the protocol work with Safe (or any thoughtfully written smart contract wallets). This is one of our main goals when writing the contracts.
In my opinion, such integration or end-to-end testing only makes sense when you're developing a protocol as an extension of Safe, like Zodiac's DAO protocol designed to work with Safe, so involving Safe's production code is highly beneficial there.
Using Safe in that Uniswap test makes little sense to me. Their goal was to test that permit2 works with EIP-1271, and they used the foundry's vm hack to change the storage slot directly... Any wallet could've been used there or even a stub
Also, do you have examples of such SDKs?
Good points.
I guess I was mostly looking for a minimal set of helpers, e.g. the Safe factory addresses.
While it's true that Safe is a generic type of wallet, that doesn't mean that running fork tests against the actual deployed contracts wouldn't give greater confidence that the protocol behaves as expected.
For instance, our protocol uses a different proxy system (PRBProxy) compared to Safe, and so we would find it helpful to check that Safe is compatible with this other proxy.
Also, do you have examples of such SDKs?
"SDK" was a stretch - what I meant was test utils. See PRBProxy and Permit2:
It looks like this might be what I was looking for?
An example from #710 : https://github.com/colinnielsen/safe-tools
Context
Scenario: Foundry project in which I want to write end-to-end tests that ensure that our protocol works with Safe.
Proposed solution
Provide a Foundry-based SDK for facilitating end-to-end tests. The SDK should contain:
GnosisSafeProy
Additional context
It looks like Permit2 has a Safe e2e test:
https://github.com/Uniswap/permit2/blob/bbbc92f895049ca45c4b25a450f9d3e907659284/test/integration/GnosisSafe.t.sol