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

Typesafe types #2452

Merged
merged 8 commits into from May 3, 2021
Merged

Typesafe types #2452

merged 8 commits into from May 3, 2021

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented May 1, 2021

Motivation

The package lodestar-types currently uses an exotic initialization strategy to break a circular dependency between root types and their expanded type. There is also repeated information where you must declare a new phase0 type 4 times in different places.

Description

  • Break the circular dependency with LazyVariable which allows to initialize the types with a regular function, an easier to follow pattern.
  • Use the return type of that function as interface, so you only have to declare each SSZ type once.

Extra:

  • Updated the expanded types of altair block and state so they reference altair types
  • Removed the consistency test since it will be enforced by typescript itself with an SSZ update: Typesafe library ssz#99
  • Moved all params to lodestar-params

@github-actions github-actions bot added Config scope-networking All issues related to networking, gossip, and libp2p. labels May 1, 2021
@codeclimate
Copy link

codeclimate bot commented May 1, 2021

Code Climate has analyzed commit 535b3ee and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 4

View more on Code Climate.

wemeetagain
wemeetagain previously approved these changes May 3, 2021
@wemeetagain wemeetagain merged commit d8816b5 into master May 3, 2021
@wemeetagain wemeetagain deleted the dapplion/typesafe-types branch May 3, 2021 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope-networking All issues related to networking, gossip, and libp2p.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants