Skip to content

Commit 0111cb1

Browse files
authored
Feature/contract to contract -> master (#3397)
1 parent f00b072 commit 0111cb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+11107
-6766
lines changed

THANKS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A big thank you to everyone who has contributed to the `go-algorand` codebase.
55

66
### External Contributors
77
- aybehrouz
8+
- fionnachan
89
- jeapostrophe
910
- jecassis
1011
- jsign

cmd/goal/clerk.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,15 @@ var sendCmd = &cobra.Command{
321321
var err error
322322
if progByteFile != "" {
323323
if programSource != "" || logicSigFile != "" {
324-
reportErrorln("should at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
324+
reportErrorln("should use at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
325325
}
326326
program, err = readFile(progByteFile)
327327
if err != nil {
328328
reportErrorf("%s: %s", progByteFile, err)
329329
}
330330
} else if programSource != "" {
331331
if logicSigFile != "" {
332-
reportErrorln("should at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
332+
reportErrorln("should use at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
333333
}
334334
program = assembleFile(programSource)
335335
} else if logicSigFile != "" {
@@ -788,6 +788,9 @@ var signCmd = &cobra.Command{
788788
for _, group := range groupsOrder {
789789
txnGroup := []transactions.SignedTxn{}
790790
for _, txn := range txnGroups[group] {
791+
if lsig.Logic != nil {
792+
txn.Lsig = lsig
793+
}
791794
txnGroup = append(txnGroup, *txn)
792795
}
793796
var groupCtx *verify.GroupContext
@@ -801,7 +804,6 @@ var signCmd = &cobra.Command{
801804
for i, txn := range txnGroup {
802805
var signedTxn transactions.SignedTxn
803806
if lsig.Logic != nil {
804-
txn.Lsig = lsig
805807
err = verify.LogicSigSanityCheck(&txn, i, groupCtx)
806808
if err != nil {
807809
reportErrorf("%s: txn[%d] error %s", txFilename, txnIndex[txnGroups[group][i]], err)
@@ -1065,10 +1067,7 @@ var dryrunCmd = &cobra.Command{
10651067
}
10661068
stxns = append(stxns, txn)
10671069
}
1068-
txgroup := make([]transactions.SignedTxn, len(stxns))
1069-
for i, st := range stxns {
1070-
txgroup[i] = st
1071-
}
1070+
txgroup := transactions.WrapSignedTxnsWithAD(stxns)
10721071
proto, params := getProto(protoVersion)
10731072
if dumpForDryrun {
10741073
// Write dryrun data to file
@@ -1078,7 +1077,7 @@ var dryrunCmd = &cobra.Command{
10781077
if err != nil {
10791078
reportErrorf(err.Error())
10801079
}
1081-
data, err := libgoal.MakeDryrunStateBytes(client, nil, txgroup, accts, string(proto), dumpForDryrunFormat.String())
1080+
data, err := libgoal.MakeDryrunStateBytes(client, nil, stxns, accts, string(proto), dumpForDryrunFormat.String())
10821081
if err != nil {
10831082
reportErrorf(err.Error())
10841083
}
@@ -1096,22 +1095,15 @@ var dryrunCmd = &cobra.Command{
10961095
if uint64(txn.Lsig.Len()) > params.LogicSigMaxSize {
10971096
reportErrorf("program size too large: %d > %d", len(txn.Lsig.Logic), params.LogicSigMaxSize)
10981097
}
1099-
ep := logic.EvalParams{Txn: &txn, Proto: &params, GroupIndex: uint64(i), TxnGroup: txgroup}
1100-
err := logic.Check(txn.Lsig.Logic, ep)
1098+
ep := logic.NewEvalParams(txgroup, &params, nil)
1099+
err := logic.CheckSignature(i, ep)
11011100
if err != nil {
11021101
reportErrorf("program failed Check: %s", err)
11031102
}
1104-
sb := strings.Builder{}
1105-
ep = logic.EvalParams{
1106-
Txn: &txn,
1107-
GroupIndex: uint64(i),
1108-
Proto: &params,
1109-
Trace: &sb,
1110-
TxnGroup: txgroup,
1111-
}
1112-
pass, err := logic.Eval(txn.Lsig.Logic, ep)
1103+
ep.Trace = &strings.Builder{}
1104+
pass, err := logic.EvalSignature(i, ep)
11131105
// TODO: optionally include `inspect` output here?
1114-
fmt.Fprintf(os.Stdout, "tx[%d] trace:\n%s\n", i, sb.String())
1106+
fmt.Fprintf(os.Stdout, "tx[%d] trace:\n%s\n", i, ep.Trace.String())
11151107
if pass {
11161108
fmt.Fprintf(os.Stdout, " - pass -\n")
11171109
} else {

0 commit comments

Comments
 (0)