-
Notifications
You must be signed in to change notification settings - Fork 4
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
add tc for working hash #83
Conversation
} | ||
|
||
for _, key := range storeKeys { | ||
if key != nil && matchAny(key.Name()) { |
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.
if key != nil && matchAny(key.Name()) { | |
if matchAny(key.Name()) { |
key
is not pointer, so i think you no need to nil check
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.
@dudong2
key can be nil, it is declared as interface. I ran the following code and the result was 0x19.
counter := 0
for _, key := range storeKeys {
if key == nil {
counter++
}
if key != nil && matchAny(key.Name()) {
kvstore := app.CommitMultiStore().GetCommitKVStore(key)
require.Equal(t, storetypes.StoreTypeIAVL, kvstore.GetStoreType())
iavlStore, ok := kvstore.(*iavl.Store)
require.True(t, ok)
workingHash := hex.EncodeToString(iavlStore.WorkingHash())
require.NotEqual(t, workingHashWithZeroInitialHeight[key.Name()], workingHash)
require.Equal(t, workingHashWithCorrectInitialHeight[key.Name()], workingHash)
}
}
fmt.Println(counter)
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.
LGTM
Description
4
to perform the test.The values on the left side of the image are the working hashes of each module obtained when using the buggy version of IAVL, while the ones on the right are the correctly calculated working hashes after the patch.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...