Skip to content

Commit 5ef60a7

Browse files
authored
Goal: Add check for signer passed in the case of logic sig rekeyed account (#3773)
## Summary When trying to sign a transaction file with goal, if the sender is a normal address but the signer is a logic program, the call fails with an error message like: `send.txn: txn[0] error LogicNot signed and not a Logic-only account` The error message comes from https://github.com/algorand/go-algorand/blob/33b87c432065d3be0ce1fdad682604f416676133/data/transactions/verify/txn.go#L314 It notes that a valid case is when Auth is set to the hash of the program but we aren't setting the auth on the transaction even if the -S flag is passed ## Test Plan Made a txn where sender is a regular account and signed it with ```sh goal clerk sign -i tmp.txn -o tmp.txn -S BJATCHES5YJZJ7JITYMVLSSIQAVAWBQRVGPQUDT5AZ2QSLDSXWWM46THOY -p tmp.teal ``` I borked the git history on the last one #3459 so just nuked it and starting over here. Left it at @tsachiherman wanting better tests for this #3459 (comment)
1 parent 0e79364 commit 5ef60a7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/goal/clerk.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ var signCmd = &cobra.Command{
724724
}
725725

726726
var lsig transactions.LogicSig
727-
727+
var authAddr basics.Address
728728
var client libgoal.Client
729729
var wh []byte
730730
var pw []byte
@@ -743,6 +743,11 @@ var signCmd = &cobra.Command{
743743
dataDir := ensureSingleDataDir()
744744
client = ensureKmdClient(dataDir)
745745
wh, pw = ensureWalletHandleMaybePassword(dataDir, walletName, true)
746+
} else if signerAddress != "" {
747+
authAddr, err = basics.UnmarshalChecksumAddress(signerAddress)
748+
if err != nil {
749+
reportErrorf("Signer invalid (%s): %v", signerAddress, err)
750+
}
746751
}
747752

748753
var outData []byte
@@ -790,6 +795,9 @@ var signCmd = &cobra.Command{
790795
for _, txn := range txnGroups[group] {
791796
if lsig.Logic != nil {
792797
txn.Lsig = lsig
798+
if signerAddress != "" {
799+
txn.AuthAddr = authAddr
800+
}
793801
}
794802
txnGroup = append(txnGroup, *txn)
795803
}

0 commit comments

Comments
 (0)