Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Comments

Fix/756 Fix ListHistory command#761

Merged
gdbelvin merged 4 commits intogoogle:masterfrom
gdbelvin:fix/756
Aug 18, 2017
Merged

Fix/756 Fix ListHistory command#761
gdbelvin merged 4 commits intogoogle:masterfrom
gdbelvin:fix/756

Conversation

@gdbelvin
Copy link
Contributor

@gdbelvin gdbelvin commented Aug 17, 2017

Cleans up a few off by on errors and poor stopping condition logic in the list history command.

Fixes #756
Rebased on #760 and #762. Merge them first.

@gdbelvin gdbelvin requested a review from liamsi August 17, 2017 14:55
Copy link
Contributor

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

A few suggestions/questions. But LGTM


// Initialize inserts the object hash of an empty struct into the log if it is empty.
// This keeps the log leaves in-sync with the map which starts off with an
// empty log root at map revision 0.
Copy link
Contributor

Choose a reason for hiding this comment

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

That is a cool and simple idea!

if logRoot.GetSignedLogRoot().GetTreeSize() == 0 &&
mapRoot.GetMapRoot().GetMapRevision() == 0 {
smrJSON, err := json.Marshal(mapRoot.GetMapRoot())
idHash := sha256.Sum256(smrJSON)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason behind not calling ObjectHash() on the map root?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The log server sets the leaf hash for us. It's only duplicate work on our end to do it here.

},
}); err != nil {
return fmt.Errorf("trillianLog.QueueLeaf(logID: %v, leaf: %v): %v",
s.logID, smrJSON, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is exactly the same code as in https://github.com/google/keytransparency/pull/761/files#diff-98fddaa13ed78860afbe32b4e92dc431R116 (only the two TODOs are different).

What do you think about refactoring this into a private helper writeToLog(tlog *LogClient, smr *trillian.SignedMapRoot)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Eventually we will replace this code with a proper Verifying Log Client that auto configures itself

README.md Outdated
```

3. Run Key Transparency
- `docker-compose build kt-signer`
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like we might need to update the deploy script. I'll take care of that in case this is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@google google deleted a comment from codecov-io Aug 17, 2017
@gdbelvin gdbelvin changed the title Fix/756 Initialize log with empty SignedMapRoot Fix/756 Fix ListHistory command Aug 17, 2017
Cleans up a few off by on errors and poor stopping condition logic in
the list history command.

Fixes google#763
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@33ad021). Click here to learn what that means.
The diff coverage is 42.1%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #761   +/-   ##
=========================================
  Coverage          ?   48.42%           
=========================================
  Files             ?       28           
  Lines             ?     2480           
  Branches          ?        0           
=========================================
  Hits              ?     1201           
  Misses            ?     1093           
  Partials          ?      186
Impacted Files Coverage Δ
core/keyserver/validate.go 38.77% <ø> (ø)
core/signer/signer.go 9.44% <0%> (ø)
core/keyserver/keyserver.go 0% <0%> (ø)
integration/testutil.go 68.65% <57.14%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33ad021...3f67615. Read the comment docs.

@gdbelvin gdbelvin merged commit bef78fc into google:master Aug 18, 2017
@gdbelvin gdbelvin deleted the fix/756 branch August 18, 2017 10:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants