-
Notifications
You must be signed in to change notification settings - Fork 473
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
cmd: Improve logicsig with signer support for goal clerk send
#6180
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6180 +/- ##
==========================================
+ Coverage 51.86% 51.88% +0.01%
==========================================
Files 639 639
Lines 85492 85501 +9
==========================================
+ Hits 44344 44359 +15
+ Misses 38331 38329 -2
+ Partials 2817 2813 -4 ☔ View full report in Codecov by Sentry. |
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.
We could merge as-is, but I think it can be simplified.
if account == "" { | ||
fromAddressResolved = pha.String() | ||
} else { | ||
fromAddressResolved = accountList.getAddressByName(account) | ||
} |
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.
The else
of the program != nil
test has some similar logic. It seems like each arm could assign to account
if account
is currently empty (in the lsig case, by hashing and such, in the non-lsig case by looking up the default), and then after the if/else
we can unconditionally do fromAddressResolved = accountList.getAddressByName(account)
, just like the assignment to toAddressResolved
is done unconditionally.
var authAddr basics.Address | ||
if signerAddress != "" { | ||
authAddr, err = basics.UnmarshalChecksumAddress(signerAddress) | ||
if err != nil { | ||
reportErrorf("Signer invalid (%s): %v", signerAddress, err) | ||
} | ||
stx.AuthAddr = basics.Address(authAddr) | ||
} |
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.
Here again, I'm hoping we can remove some conditional logic, rather than add code to the program != nil
case. But here I'm less confident.
Here it seems like the code that set authAddr
could be unconditionally run before the whole if/else if/else
. Then the authAddr could be used here and below.
I was attempting to submit a payment transaction from an account that was rekeyed to a logic sig address, but I experienced two issues.
This PR fixes those two points by firstly only setting the sender address as the logic sig address if a sender address hasn't been provided, then secondly setting the transactions AuthAddr if a signer is set.
I pieced together an expect test that simulates my scenario by first rekeying a normal account to a logic sig, then submitting a second transaction removing that rekey by including the logic sig and a signer on the transaction.