Closed The-Arbiter closed 6 months ago
NOTE Protego immutable protego; has no explicit visibility, should we use public or internal (default)?
I don't see any harm in making this explicitly public.
NOTE: bytes public sig; doesn't have the immutable tag but cannot be changed in any way; I assume this is Solidity not liking dynamically sized bytes being immutable? Or is there some other reasoning here?
bytes
is an array under the hood, so can't be made immutable.
NOTE: Do we need description and planned in the drop spell? They're already in protego. It would save us 1 storage slot per drop spell (IMO I would have it in protego only) ==> I did this before in this branch but I added it back in, up to you if you want to remove it
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.
NOTE: I renamed 'NewDropSpell' to 'DropSpellCreated' and 'NewDrop' to 'DroppedPlan' to make the events reflect what actually happened
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
NOTE: DssSpell in the comments, DsSpell per the code [here](https://github.com/dapphub/ds-spell/blob/master/src/spell.sol) - what do we want to use?
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. )
I agree with the above; changes to event names and visibility are good. LGTM besides this for the time being.
Closing this PR because it is going to be superseded by #2.
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 anyplan
permissionless. While this would stall malicious governance attacks, it would also allow anyplan
to be dropped permissionlessly and therefore halt all progress.Protego also contains the ability to drop an individual
plan
(rather than making alldrop
operations permissionless via electing as the chief).The core logic here is that
deploy
takes either aDsSpell
or the plan arguments and then creates aSpell
instance which can do three things:description()
returns the hash of the plan being targeted by the drop spellplanned()
returns true if the spell is plannedcast()
callsdrop
onDsPause
for the targetedplan
(cancels the plan)Overall, protego solves two problems: 1) Spell creation to
drop
a plan inPause
is now permissionless (i.e. anyone can create the spell which can then be voted tohat
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 effectivelyDocs
> 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
Protego immutable protego;
has no explicit visibility, should we use public or internal (default)?bytes public sig;
doesn't have theimmutable
tag but cannot be changed in any way; I assume this is Solidity not liking dynamically sized bytes being immutable? Or is there some other reasoning here?description
andplanned
in the drop spell? They're already in protego. It would save us 1 storage slot per drop spell (IMO I would have it in protego only) ==> I did this before in this branch but I added it back in, up to you if you want to remove itDssSpell
in the comments,DsSpell
per the code here - what do we want to use?fax
wassig
andusr
wasaction
but I see that they refer to the values that the spell gives us and make a trust assumption. We could call itspell_usr
or something since otherwise there is no differentiating factor for stuff likeeta
but I am OK with it as is.Test Contract