node/ref: Encode message finalization status in message type #2458
Unanswered
tbjump
asked this question in
Problems / bugs
Replies: 1 comment
-
It moves a lot of code around, but does make it more intuitive for auditing and general maintenance. It's somewhat of a shame we don't use an existing state machine library like looplabs/fsm which has native support for turning the state flows into dot files or svgs. Being able to visualize this from the code directly would be hugely useful for someone new to the codebase. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue
It is somewhat cumbersome to audit the different steps involved between a message being first observed on chain, to it being finalized on-chain, passing accounting and governor, and finally being signed by the guardian. This is further complicated by the additional code paths for re-observations and persisting state on storage between guardian restarts.
Idea
I propose the following naming convention for the different finalization states of a message:
I am wondering if it would make the code more readable if there were different types for a message depending on what its finalization status is. That way the type system could enforce that e.g. only Approved messages can be signed and the state transitions become more explicit.
It could look like this in chainlock.go:
This change would touch many different files.
What do y'all think?
Beta Was this translation helpful? Give feedback.
All reactions