-
Notifications
You must be signed in to change notification settings - Fork 86
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
VolatileDB: Unify and extend getters #1701
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.
Good work. Just some minor things.
@@ -304,7 +301,7 @@ transitionImpl model cmd _ = eventAfter $ lockstep model cmd | |||
preconditionImpl :: Model Symbolic -> At CmdErr Symbolic -> Logic | |||
preconditionImpl Model{..} (At (CmdErr cmd mbErrors)) = | |||
compatibleWithError .&& case cmd of | |||
GetPredecessor bids -> forall bids (`elem` bidsInModel) | |||
GetBlockInfo bids -> forall bids (`elem` bidsInModel) |
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.
Remove this precondition, getBlockInfo
should just return Nothing
for blocks not in the VolatileDB.
| Successors [Set BlockId] | ||
| Predecessor [Predecessor] | ||
| BlocksInfo [Maybe (BlockInfo BlockId)] |
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.
| BlocksInfo [Maybe (BlockInfo BlockId)] | |
| BlockInfos [Maybe (BlockInfo BlockId)] |
getBlockInfo :: VolDB m blk | ||
-> STM m ( HeaderHash blk | ||
-> Maybe (VolDB.BlockInfo (HeaderHash blk)) | ||
) |
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.
getBlockInfo
:: VolDB m blk
-> STM m (HeaderHash blk -> Maybe (VolDB.BlockInfo (HeaderHash blk)))
@@ -348,32 +354,31 @@ isReachable predecessor isMember i b = | |||
-- See the documentation of 'Path'. | |||
computePath | |||
:: forall blk. HasHeader blk | |||
=> (HeaderHash blk -> WithOrigin (HeaderHash blk)) -- ^ @getPredecessor@ | |||
-> (HeaderHash blk -> Bool) -- ^ @isMember@ | |||
=> (HeaderHash blk -> Maybe (WithOrigin (HeaderHash blk))) -- ^ @predecessor@ |
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.
There is nothing called predecessor
anymore, so I suggest:
=> (HeaderHash blk -> Maybe (WithOrigin (HeaderHash blk))) -- ^ @predecessor@ | |
=> (HeaderHash blk -> Maybe (WithOrigin (HeaderHash blk))) | |
-- ^ Return the predecessor |
e33f342
to
469fbb8
Compare
bors r+ |
1701: VolatileDB: Unify and extend getters r=mrBliss a=kderme Related issue: #1684 This is done: > Unify getIsMember and getPredecessor, and return BlockInfo This is not done yet: > Possibly unify it with getSuccessors too, e.g., using return a pair of both results. Co-authored-by: kderme <[email protected]>
Build failed |
bors r+ |
Related issue: #1684
This is done:
This is not done yet: