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

core: refactor signed data types to interfaces #698

Closed
corverroos opened this issue Jun 12, 2022 · 0 comments
Closed

core: refactor signed data types to interfaces #698

corverroos opened this issue Jun 12, 2022 · 0 comments
Assignees
Labels
refactor Code refactoring

Comments

@corverroos
Copy link
Contributor

corverroos commented Jun 12, 2022

Problem to be solved

See design doc: https://docs.google.com/document/d/1uGoYuYWROAfWiRwVtcd4DO7DIOVLsXkddrQarsHidhg/edit#

Core workflow data types ParSignedData and AggSignedData are partially unstructured containing signatures and raw json (bytes) data. This works well to decouple data from logic, and promotes the charon middleware architecture as a “transparent” data-signing layer in the eth2 stack.

This approach has however the following drawbacks:

  • The logic working with the data (like extracting, replacing, verifying signatures) is spread out throughout the different components.
  • Most components have type switches that then decode and encode different types.
  • Charon isn’t actually transparent wrt data, since we do encode and decode.

Proposed solution

Refactoring these types into interfaces with proper typed implementations for the different duties would provide the following benefits:

  • Data wrangling logic moved out of components and colocated in one place; the interface implementation.
  • Adding new duties, would mostly be adding a new implementation.
  • Components focus on what they need to do, not how it is done.
obol-bulldozer bot pushed a commit that referenced this issue Jun 13, 2022
Step 1 of N: Adds the new interface and implementations and helper functions. Nothing wired or integrated yet.

category: refactor
ticket: #698
obol-bulldozer bot pushed a commit that referenced this issue Jun 14, 2022
Adds the `Clone` method to `SignedData` and other core types. This makes explicit that data should be cloned before sharing to ensure immutability. 

category: refactor
ticket: #698
obol-bulldozer bot pushed a commit that referenced this issue Jun 15, 2022
Refactors `core.UnsignedData` into an interface. Follow pattern established via `SignedData`.

category: refactor
ticket: #698
@corverroos corverroos self-assigned this Jun 15, 2022
@corverroos corverroos added the refactor Code refactoring label Jun 15, 2022
obol-bulldozer bot pushed a commit that referenced this issue Jun 15, 2022
Continuing with the core data interface refactor. Refactor FetchArgs to an interface. Note that FetchArgs will be renamed to DutyDefinition in a subsequent PR to improve naming since it isn't only used by Fetcher anymore.

category: refactor
ticket: #698
obol-bulldozer bot pushed a commit that referenced this issue Jun 15, 2022
Renames `FetchArgs` to `DutyDefinition` and update docs.

category: refactor
ticket: #698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code refactoring
Projects
None yet
Development

No branches or pull requests

1 participant