penumbra
penumbra copied to clipboard
write each consensus rule as a separate function
We should document somewhere in the spec the consensus rules that we're using, e.g. only one undelegation validator identity allowed per tx
I worry about how we'd keep that in sync with the code. I'm wondering if instead, we could formalize a coding guideline, where we write each consensus rule as a separate function, in a common check
module, so that the checks look like
check::undelegations_are_only_from_one_validator(&tx)?;
check::undelegations_have_allowed_actions(&tx)?;
etc., and then we have an easy way to see what all the consensus rules are -- there's one per function -- and we're guaranteed that they'll stay in sync with the code, because they are the code.
I don't think we should plan to do this specifically, rather than keep it as a general code structure idea.