-
Notifications
You must be signed in to change notification settings - Fork 121
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
Always use full commitment #1818
base: main
Are you sure you want to change the base?
Conversation
@@ -897,8 +901,6 @@ class AccountUpdate implements Types.AccountUpdate { | |||
*/ | |||
requireSignature() { | |||
let { nonce, isSameAsFeePayer } = AccountUpdate.getSigningInfo(this); | |||
// if this account is the same as the fee payer, we use the "full commitment" for replay protection | |||
this.body.useFullCommitment = isSameAsFeePayer; |
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.
previously there were two different ways we ensured that it's not replayed:
- if the account was the same as the fee payer, we used the full commitment
- otherwise, we incremented the nonce and set a nonce precondition
I like the simplification of just always using the full commitment (my initial idea on why not to do that was flexibility of signing with one key without yet having the fee payer sign; but now I think the simplicity is more important)
What this also means is that we don't need to do the nonce increase in this function depending on isSameAsFeePayer
.
Instead, I would do the following:
- add a
boolean
optional parameter to this functionnoFullCommitment
, if it's true do the nonce increment instead - remove the
isSameAsFeePayer
return value fromgetSigningInfo
|
||
// useFullCommitment = true by default, prevents replay attacks and similar issues | ||
// the developer can still modify this to false if needed later on | ||
body.useFullCommitment = Bool(true); |
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.
I'm not sure about this, how about setting this to true in requireSignature()
instead of always? it's a bit weird to me that the default account update differs from the natural dummy AU with no apparent reason
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.
or in setLazySignature
?
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.
well or maybe we should remove setLazySignature
since it no longer holds a private key so no real purpose
Why? This prevents transactions from being replayed. Deletable accounts will also benefit from this change in the future
closes #1798