Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This namespaces ssz types under
config.types.phase0
orimport {phase0} from "@chainsafe/lodestar-types";
This allows us to always refer unambiguously to a specific version of a type.
It also allows us to add types for future HFs without breaking the 'backward compatibility' of the existing types.
This PR creates
IPhase0Params
andIPhase0SSZTypes
and integrates them in the params and types libraries in a standard way.Future HF params are expected to define new params and never update the value of a pre-existing param.
IBeaconParams
will be the union of all HF params.(eg:
type IBeaconParams = IPhase0Params & IHFParams ....;
)Future HF ssz types are expected to define new types and possibly update existing types (but only by adding additional fields to those types).
IBeaconSSZTypes
will have a separate namespace for each HF that allows for unambiguously selecting a type at a specific version.(eg:
type IBeaconSSZTypes = { phase0: IPhase0SSZTypes; hf: IHFSSZTypes };
)These same namespaces are exported from the root of the
@chainsafe/lodestar-types
to access the typescript types.(eg:
import {phase0, hf} from "@chainsafe/lodestar-types";
)For improved ergonomics, a few tweaks have been made.
Primitive types are also available directly on
IBeaconSSZTypes
and are also exported from the roof of@chainsafe/lodestar-types
. This list of un-namespaced types may only ever grow to include types that we know will never change, to protect backwards compatibility.Additionally, phase0 typescript types have been re-exported under phase0 exports in
@chainsafe/lodestar-beacon-state-transition
. This allows importing a singlephase0
object from@chainsafe/lodestar-beacon-state-transition
to both access phase0 state transition functions AND phase0 typescript types.