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

Root and SignedRoot #58

Merged
merged 5 commits into from
Apr 23, 2019
Merged

Root and SignedRoot #58

merged 5 commits into from
Apr 23, 2019

Conversation

jannikluhn
Copy link
Contributor

What was wrong?

#44

How was it fixed?

  • add the property root to BaseSerializable
  • add a metaclass for signed serializables that validates that the last field is called signature and there's at least one more (otherwise we can't calculate the signed root, assuming empty containers don't exist)
  • add a new base class SignedSerializable that provides the property signed_root

(builds on top of #57)

Cute Animal Picture

put a cute animal picture link inside the parentheses

@hwwhww hwwhww requested a review from ralexstokes April 18, 2019 02:32
@hwwhww hwwhww mentioned this pull request Apr 19, 2019
Copy link
Member

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! we should update the name to signing_root and the rest of my comments were minor formatting...

seems like the root is a good compromise to avoid the circularity of calling hash_tree_root on itself

class SignedSerializable(BaseSerializable, metaclass=MetaSignedSerializable):

@property
def signed_root(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now called signing_root :)

ethereum/consensus-specs#885

field_attrs = None
container_sedes = None
class Meta(NamedTuple):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor but i feel like we usually have no whitespace b/t class decl and class attrs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I don't like how it looks, but I do like conventions, so I removed the new lines for all classes I could find.



class SignedMeta(NamedTuple):
has_fields: bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example about formatting here



class MetaSignedSerializable(MetaSerializable):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace? i'll let you decide if you want to patch these up, not blocking merging imo

@jannikluhn jannikluhn merged commit 97cc1cf into ethereum:master Apr 23, 2019
@hwwhww hwwhww mentioned this pull request Apr 24, 2019
carver pushed a commit that referenced this pull request Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants