Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor StateTransition construction #197

Open
ericsson49 opened this issue Sep 18, 2019 · 0 comments
Open

Refactor StateTransition construction #197

ericsson49 opened this issue Sep 18, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ericsson49
Copy link
Contributor

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

@ericsson49 ericsson49 added the enhancement New feature or request label Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant