-
Notifications
You must be signed in to change notification settings - Fork 105
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
Adding SkipchainDB.GetProofFromIndex #2423
Conversation
9e1c4c8
to
ec337c7
Compare
skipchain/struct.go
Outdated
}) | ||
// GetProof returns the shortest chain from the genesis to the latest block | ||
// using the highest forward-links available in the local db | ||
func (db *SkipBlockDB) GetProof(sid SkipBlockID) (sbs []*SkipBlock, |
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 it is pretty much the same as GetFullProof
, maybe it can be removed?
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.
I'm hesitating - it is public, so theoretically it could be used elsewhere, and I didn't want to break it. But looking at the usage, it's only in the skipchain
package, so it should be fine. I can mark it Deprecated
(even though we never really removed anything, did we?)
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.
I'm hesitating - it is public, so theoretically it could be used elsewhere, and I didn't want to break it. But looking at the usage, it's only in the
skipchain
package, so it should be fine.
As you wish, I'm always in favor of reducing the number of exposed function, especially if it serves the same purpose.
I can mark it
Deprecated
(even though we never really removed anything, did we?)
Yeah, to be nice with semver, we should do a new major release where we remove the deprecated functions, but that might never happen.
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.
Renamed the methods to make more sense:
- GetProofFromIndex - takes a skipchain-ID and an index
- GetProof - for compatibility, deprecated, not used anymore in the code
- GetProofForLatest - calls
GetProofFromIndex
with magical value-1
- replaces previousGetProof
And the return values of all these methods is now the same. The Proof
structure got a GetForwardLinks
method.
And there is a Code Smell for the naming convention of test case. btw, I finally found my "golang standard" argument, in effective go. |
OK, bikeshedding for
So my take here is: follow the sheeps. dedis/cothority has |
Okay, then let's keep it as is, but you'll need to fix SonarCloud to avoid the next code smells :P |
Agreed, whatever the accepted rules are, the tools should be adjusted accordingly to remove false positives. :) |
Opened #2425 so we can go forward with this. |
ec337c7
to
bc56a59
Compare
Previously the GetByID was only available as a service-endpoint, but as it is a handy method in general, this PR moves it to the SkipchainDB as `GetFullProof`, which can do much more. Also contains a fix to SkipBlock.pathForIndex
bc56a59
to
87a2411
Compare
- GetFullProof -> GetProofFromIndex - GetProof -> GetProofFromLatest - GetProof: Deprecated Also changed the return-values from the GetProofs to always return a Proof. Added GetForwardLinks to the Proof structure. Added tests
OK - changed the names and signatures of the |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Previously the GetByID was only available as a service-endpoint, but as it is
a handy method in general, this PR moves it to the SkipchainDB as
GetFullProof
,which can do much more.
Also contains a fix to SkipBlock.pathForIndex