test(bug): In TestDeleteByAddress, delete by address, check deletion of all keys with that address #2476
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR demonstrates a bug. In keybase_test, we add a new test
TestDeleteByAddress
which is similar to the existingTestKeyManagement
. We useCreateAccount
to add two accounts with the same mnemonic (same bech32 address) but two different names, "john" and "john2". Then we callDelete
to delete by the bech32 address. Only one of the keys is deleted. The other still exists.To run the test:
Expected: pass. Actual: The test fails with:
Discussion: Keybase
writeInfo
stores the same info under the key name and also the key address. This only allows an address to map to one name. When the key (with the same address) is created by the second name, the mapping from the address to the first name is replaced. Therefore, the call to delete by address only deletes the entry by the second name. The key is still accessible by the first name, meaning that "delete" doesn't really delete.Possible solutions:
writeInfo
should fail if there is already an entry for the address, orwriteInfo
should map an address to a set of key names, or