-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ratify governance actions in the correct order #516
Ratify governance actions in the correct order #516
Conversation
@WhatisRT Will a |
TODO: fix checks/invariants in |
The |
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.
Overall I like it a lot, just a few cosmetic changes before we can merge it
src/Ledger/Gov.lagda
Outdated
govActionPriority (TreasuryWdrl _) = 5 | ||
govActionPriority Info = 6 | ||
|
||
groupGovActions : GovState → GovState |
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.
This is unused
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.
Yes, it's unused now, but wouldn't it be useful if/when we want to make sure all gov actions in a GovState are in the right order? Well, I'll just delete it for now. We can always add it back in later if needed.
@@ -81,6 +82,40 @@ private variable | |||
\end{code} | |||
\emph{Functions used in the GOV rules} | |||
\begin{AgdaMultiCode} | |||
\begin{code}[hide] | |||
govActionPriority : GovAction → ℕ |
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.
This needs to be in the visible part of the PDF
++ filter (λ x → govActionPriority (action (proj₂ x)) ≟ 5) gs | ||
++ filter (λ x → govActionPriority (action (proj₂ x)) ≟ 6) gs | ||
|
||
insertGovAction : GovState → GovActionID × GovActionState → GovState |
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.
This also needs to be visible. Also, the with
isn't that great there, since we'd have to explain it. But I think you should be able to do
if govActionPriority (action gaSt₀) ≤ govActionPriority (action gaSt₁) then ... else ...
and I expect that this probably doesn't break any proofs.
@@ -134,6 +134,12 @@ module _ where | |||
|
|||
-- ** Proof that the set equality `govDepsMatch` (below) is a LEDGER invariant. | |||
|
|||
-- Mapping a list of `GovActionID × GovActionState`s to a list of |
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.
It's very interesting to me that you're proving things about a more complicated relation now, but the proof has gotten a lot shorter.
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.
New gov actions used to be appended to the end of the GovState. Now we insert according to the priority. So I don't think it's much more complicated, though all the lemmas about list concatenation became useless, so I deleted them. Also, this change gave me another chance to analyze, rework, and simplify the proof.
I removed another unused lemma ( |
We'll probably never have to reorder a plain list of GovActions. Question: Should the GovActionID be taken into account when reordering the GovState?
23155a5
to
396e810
Compare
Description
Will close #427.
Checklist