-
Couldn't load subscription status.
- Fork 113
implement two-phase commitment of adding minor blocks (#487) #493
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
Conversation
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.
mind adding some tests? I know it could be kinda hard to simulate unexpected shutdown...
| coinbase_addrs = self.__get_coinbase_addresses_until_block(header_hash, length) | ||
| return Counter(coinbase_addrs) | ||
|
|
||
| def is_committed_by_hash(self, h): |
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.
nit: prefer letting the caller directly access shard_state.db and call is_minor_block_committed_by_hash / commit_minor_block_by_hash directly. didn't see many benefits over additional wrapping
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.
As an abstraction, the client of state_shard should not access db directly - i.e., we should probably rename db to __db to enforce that.
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.
ok. however currently shard_state.db is directly accessed in many other places
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.
That is bad, and we should fix that....
101413c to
58f6ee5
Compare
| coinbase_addrs = self.__get_coinbase_addresses_until_block(header_hash, length) | ||
| return Counter(coinbase_addrs) | ||
|
|
||
| def is_committed_by_hash(self, h): |
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.
ok. however currently shard_state.db is directly accessed in many other places
| # Let's make sure all the shards and master got it before committing it | ||
| future = self.add_block_futures.get(block_hash, None) | ||
| if future is not None: | ||
| return BlockCommitStatus.COMMITTING, future |
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.
oopsy, can you spot the bug here? @qizhou
Implement two-phase commitment of adding minor blocks