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
Shard chain #570
Conversation
|
||
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( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
?
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