-
Notifications
You must be signed in to change notification settings - Fork 95
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 reference unlock by same public key but different address #698
Fix reference unlock by same public key but different address #698
Conversation
e90904a
to
3bfaa08
Compare
3bfaa08
to
60f54ff
Compare
The review was done before a big refactor of the code :/
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.
Just a few small renames and comments suggested, but the logic changes seem quite minimal now that it's cleaned up so much and all looks good to me.
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, makes it simpler to read 👍
My take on #697.
Currently it is impossible to unlock an implicit account creation address and an ed25519 address which are derived from the same public key in the same transaction. This is because we disallow to have the same public key in different signatures, but we also fail to check correctly for a valid reference unlock, if the underlying public key is the same, but the address is different.
This PR changes the logic in a way that the public key that unlocked the identity gets tracked, and in a reference unlock it is checked that the specific derived address for that public key matches.
The PR introduces the concept of a
SignerUID
in theSignature
andAddressSigner
interface to identify unique signatures signers (in out case public keys).The
AddressSigner
for theTransactionBuilder
now needs to be passed in the constructor instead of theBuild
method. This breaking change was necessary because otherwise the workscore for transaction payload was wrong in certain edge cases, because the formerly usedEmptyAddressSigner
had no knowledge about theSignerUID
s and therefore didn't construct theReferentialUnlocks
properly. TheEmptyAddressSigner
was therefore removed.The PR also removes the unused
Key
interface from the chain ID and other IDs, because theKey
method of the underlyingAddress
is used everywhere instead, which is more precise.