cowdao-grants / cow-shed

A gas-efficient, address-bound account abstraction for permissioned hooks on CoW Protocol
GNU General Public License v3.0
8 stars 1 forks source link

Descriptive call type #6

Open mfw78 opened 3 months ago

mfw78 commented 3 months ago

In the following code, the call type may optionally be set as a DELEGATECALL:

https://github.com/meetmangukiya/cow-shed/blob/d67e97dd501d2fec42ab7d3e511bc3f9a2d87a8a/src/ICOWAuthHook.sol#L6

An option that may be useful in the UX for when a user is signing the hook is to provide a string callType field and have this set as "call" or "delegatecall". This is more descriptive, and would incur the same levels of gas cost (perhaps even slightly cheaper without the need to cast around bool).

No strong opinion on this one, just some food for thought.

meetmangukiya commented 3 months ago

I think isDelegateCall is descriptive enough. Will need to add some additional input validation. Equality check on string is also more expensive, libs usually just keccak both the string ranges and compare. I suppose since we know these strings to fit within one word, can probably load, shift and eq it.