makerdao / protego

GNU Affero General Public License v3.0
10 stars 3 forks source link

2023-01-15 Protego Review #1

Closed The-Arbiter closed 6 months ago

The-Arbiter commented 1 year ago

Hi, here is my Protego review. My foundry is a bit broken right now so I didn't double check if the tests work locally but I don't think I made any major functional changes.

Abstract and Rationale

Protego allows spell deployment with the intention of dropped existing plans (not spells). This can be used to mitigate damage from governance attacks. A plan is a scheduled delegatecall that can be permissionlessly executed. (Note that I'm unsure why PP exec is authed when there is a permissionless way to call exec - need context on that...)

The rationale for Protego is that a plan can only be dropped by authorised users (i.e. the chief). I presume that the issue here is that a 'spam' style attack by malicious governance would involve plotting more actions than the chief can conceivably drop in a given window. Protego would allow the 'spam' to be prevented by temporarily making dropping any plan permissionless. While this would stall malicious governance attacks, it would also allow any plan to be dropped permissionlessly and therefore halt all progress.

Protego also contains the ability to drop an individual plan (rather than making all drop operations permissionless via electing as the chief).

The core logic here is that deploy takes either a DsSpell or the plan arguments and then creates a Spell instance which can do three things:

Overall, protego solves two problems: 1) Spell creation to drop a plan in Pause is now permissionless (i.e. anyone can create the spell which can then be voted to hat position, meaning that individual community members have the ability to easily 'veto' a spell if this were necessary). 2) Spam attacks by malicious governance can now be fought more effectively

Docs

> ameliorate

I added context since if this is meant to be permissionless it shouldn't take people an hour to understand what is going on and it is now more user-friendly for less technical folks. Use this at your discretion but I made it very easy to understand for normal folks (IMO).

Base Contract

Test Contract

brianmcmichael commented 1 year ago

I don't see any harm in making this explicitly public.

bytes is an array under the hood, so can't be made immutable.

The child spell would presumably be added to a voting UI, vote.makerdao.com currently expects a spell description, and would be a necessary description for that purpose. Open to alternative return values though or making it an immutable.

Probably want to just call these events Deploy and Drop to follow convention of naming events after function names. ex. https://github.com/makerdao/dss/blob/master/src/clip.sol#L106-L124

I view DsSpell as a dapphub construction that is minimally sufficient to interact with ds-pause, but a DssSpell as a PE team construction that follows naming conventions and expected functionality of officially-sanctioned spells. (returns eta(), action(), sig(), etc. )

The-Arbiter commented 1 year ago

I agree with the above; changes to event names and visibility are good. LGTM besides this for the time being.

amusingaxl commented 6 months ago

Closing this PR because it is going to be superseded by #2.