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

Shard chain #570

Merged
merged 6 commits into from Apr 19, 2018
Merged

Shard chain #570

merged 6 commits into from Apr 19, 2018

Conversation

jannikluhn
Copy link
Contributor

What was wrong?

Shard chain class was missing.

How was it fixed?

A basic shard chain class has been added, along with some minor changes in the shard db.

Right now it's a very thin wrapper around the shard db. Originally I had implemented some additional functionality, but I was unsure what we'll actually end up using so I removed all but the most basic stuff. I think extending it on the go as needed is the better approach.

Cute Animal Picture

put a cute animal picture link inside the parentheses

@jannikluhn jannikluhn merged commit c49dd0c into ethereum:master Apr 19, 2018

def _check_shard_id(self, header_or_collation: Union[CollationHeader, Collation]) -> None:
if header_or_collation.shard_id != self.shard_id:
raise ValueError("Header or collation belongs to shard {} instead of shard {}".format(
Copy link
Member

Choose a reason for hiding this comment

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

ValidationError would be more inline with other library conventions. Also, this could be done as a stand-alone validator function to reduce class size.

try:
self.get_header_by_hash(header.hash)
except CollationHeaderNotFound:
raise ValueError("Cannot set unknown header as canonical: {}".format(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe re-raise CollactionHeaderNotFound with this message instead of using ValueError?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants