There are two main StateTransition functions: preBlock (empty slot) and perBlock. However, their construction somewhat clumsy and non-uniform accross code base.
E.g.
initialTransition = new InitialStateTransition(chainStartEvent, spec);
perSlotTransition = new PerSlotTransition(spec);
perBlockTransition = new PerBlockTransition(spec);
perEpochTransition = new PerEpochTransition(spec);
extendedSlotTransition =
new ExtendedSlotTransition(perEpochTransition, perSlotTransition, spec);
emptySlotTransition = new EmptySlotTransition(extendedSlotTransition);
In order to improve readability and reduce code duplication, refactor StateTransition construction.
There can be (at least) two steps:
1 there exists already StateTransitions class with appropriate helper functions (preBlockTransition and blockTransition). The only problem is that some benchmarking code overloads some methods to gather statistics.
2 Incapsulate state transition logic in a Stepper class, having two methods: processSlots and processBlock (or something like this).
There are two main StateTransition functions: preBlock (empty slot) and perBlock. However, their construction somewhat clumsy and non-uniform accross code base.
E.g.
In order to improve readability and reduce code duplication, refactor
StateTransitionconstruction.There can be (at least) two steps:
1 there exists already
StateTransitionsclass with appropriate helper functions (preBlockTransitionandblockTransition). The only problem is that some benchmarking code overloads some methods to gather statistics.2 Incapsulate state transition logic in a Stepper class, having two methods: processSlots and processBlock (or something like this).