Skip to content

Refactor StateTransition construction #197

@ericsson49

Description

@ericsson49

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions