penumbra icon indicating copy to clipboard operation
penumbra copied to clipboard

write each consensus rule as a separate function

Open redshiftzero opened this issue 2 years ago • 1 comments

We should document somewhere in the spec the consensus rules that we're using, e.g. only one undelegation validator identity allowed per tx

redshiftzero avatar Jun 16 '22 17:06 redshiftzero

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.

hdevalence avatar Jun 16 '22 19:06 hdevalence

I don't think we should plan to do this specifically, rather than keep it as a general code structure idea.

hdevalence avatar Mar 17 '23 07:03 hdevalence