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

Fix printing trie hash #3926

Merged
merged 1 commit into from
Feb 14, 2023
Merged

Fix printing trie hash #3926

merged 1 commit into from
Feb 14, 2023

Conversation

zhangchiqing
Copy link
Member

No description provided.

@@ -94,9 +94,9 @@ func (mt *MTrie) RootNode() *node.Node {
// Concurrency safe (as Tries are immutable structures by convention)
func (mt *MTrie) String() string {
if mt.IsEmpty() {
return fmt.Sprintf("Empty Trie with default root hash: %x\n", mt.RootHash())
return fmt.Sprintf("Empty Trie with default root hash: %v\n", mt.RootHash())
Copy link
Member Author

Choose a reason for hiding this comment

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

RootHash() returns hash.Hash, which has implemented String method already, using %x would double encoding.

For instance,
Before the fix, it prints:

Empty Trie with default root hash: 35363866346563373430666533623564653838303334636237623166626464623431353438623036386633316165626338616539313839653432396335373439

After the fix, it prints:

Empty Trie with default root hash: 568f4ec740fe3b5de88034cb7b1fbddb41548b068f31aebc8ae9189e429c5749

@zhangchiqing zhangchiqing marked this pull request as ready for review February 11, 2023 00:50
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2023

Codecov Report

Merging #3926 (4f49292) into master (baeacd9) will increase coverage by 0.00%.
The diff coverage is 50.00%.

@@           Coverage Diff           @@
##           master    #3926   +/-   ##
=======================================
  Coverage   53.32%   53.32%           
=======================================
  Files         819      819           
  Lines       76764    76764           
=======================================
+ Hits        40935    40937    +2     
+ Misses      32516    32514    -2     
  Partials     3313     3313           
Flag Coverage Δ
unittests 53.32% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ledger/complete/mtrie/trie/trie.go 64.71% <50.00%> (ø)
...s/hotstuff/votecollector/staking_vote_processor.go 82.35% <0.00%> (-2.95%) ⬇️
fvm/transactionVerifier.go 81.12% <0.00%> (-1.21%) ⬇️
fvm/environment/contract_updater.go 66.77% <0.00%> (-0.66%) ⬇️
engine/consensus/compliance/core.go 86.66% <0.00%> (+0.78%) ⬆️
consensus/hotstuff/eventloop/event_loop.go 75.11% <0.00%> (+0.93%) ⬆️
engine/collection/compliance/core.go 83.61% <0.00%> (+2.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@zhangchiqing
Copy link
Member Author

bors merge

bors bot added a commit that referenced this pull request Feb 13, 2023
3926: Fix printing trie hash r=zhangchiqing a=zhangchiqing



Co-authored-by: Leo Zhang (zhangchiqing) <zhangchiqing@gmail.com>
@bors
Copy link
Contributor

bors bot commented Feb 13, 2023

@zhangchiqing
Copy link
Member Author

bors retry

bors bot added a commit that referenced this pull request Feb 13, 2023
3926: Fix printing trie hash r=zhangchiqing a=zhangchiqing



Co-authored-by: Leo Zhang (zhangchiqing) <zhangchiqing@gmail.com>
@bors
Copy link
Contributor

bors bot commented Feb 13, 2023

Build failed:

  • Integration Tests (make -C integration epochs-tests)

@zhangchiqing
Copy link
Member Author

bors retry

@bors bors bot merged commit 3b4b1bc into master Feb 14, 2023
@bors bors bot deleted the leo/fix-printing-trie-hash branch February 14, 2023 18:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants