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(ledger): flatten code shred and data shred field nesting #332

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dnut
Copy link
Contributor

@dnut dnut commented Oct 24, 2024

closes #212

  • Moved shred fields out of GenericShred struct into each respective shred struct: DataShred and CodeShred.
  • Anywhere that fields from fields were being accessed, switched it to get the fields directly from the shred struct. so shred.fields.common is now shreds.common
  • For any usages of methods in GenericShred via fields outside shred.zig, analogous methods were added to DataShred and CodeShred to serve the same purpose. this is in service to the point above, so things like shred.fields.merkleRoot() are now shred.merkleRoot()
  • All the methods from GenericShred are now just functions in a private namespace called generic_shred. other shred structs that used to call self.fields.function() now call generic.function(self)
  • Renamed default initializers in the shred structs to zeroedForTest since the output data is actually an invalid shred and should probably not be used for anything. it's barely distinguishable from initializing the data as undefined. In the future i think these methods should be replaced with a way to initialize well-formed shreds. For now, we need it for tests, so I'd like it to be named in a way that indicates clearly what it does and what it's for, rather than implying it is a well-formed "default."

@dnut dnut self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Shred struct redesign
1 participant