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

VolatileDB: Unify and extend getters #1701

Merged
merged 2 commits into from
Feb 27, 2020
Merged

VolatileDB: Unify and extend getters #1701

merged 2 commits into from
Feb 27, 2020

Conversation

kderme
Copy link
Contributor

@kderme kderme commented Feb 26, 2020

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.

Copy link
Contributor

@mrBliss mrBliss left a 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)
Copy link
Contributor

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)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| BlocksInfo [Maybe (BlockInfo BlockId)]
| BlockInfos [Maybe (BlockInfo BlockId)]

Comment on lines 231 to 234
getBlockInfo :: VolDB m blk
-> STM m ( HeaderHash blk
-> Maybe (VolDB.BlockInfo (HeaderHash blk))
)
Copy link
Contributor

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@
Copy link
Contributor

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:

Suggested change
=> (HeaderHash blk -> Maybe (WithOrigin (HeaderHash blk))) -- ^ @predecessor@
=> (HeaderHash blk -> Maybe (WithOrigin (HeaderHash blk)))
-- ^ Return the predecessor

@mrBliss mrBliss added the consensus issues related to ouroboros-consensus label Feb 26, 2020
@mrBliss
Copy link
Contributor

mrBliss commented Feb 27, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Feb 27, 2020
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]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 27, 2020

Build failed

@mrBliss
Copy link
Contributor

mrBliss commented Feb 27, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 27, 2020

@iohk-bors iohk-bors bot merged commit c6df49d into master Feb 27, 2020
@iohk-bors iohk-bors bot deleted the kderme/getters branch February 27, 2020 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus issues related to ouroboros-consensus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants