Skip to content

Commit

Permalink
Feature/contract to contract -> master (#3397)
Browse files Browse the repository at this point in the history
  • Loading branch information
jannotti authored Feb 8, 2022
1 parent f00b072 commit 0111cb1
Show file tree
Hide file tree
Showing 71 changed files with 11,107 additions and 6,766 deletions.
1 change: 1 addition & 0 deletions THANKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A big thank you to everyone who has contributed to the `go-algorand` codebase.

### External Contributors
- aybehrouz
- fionnachan
- jeapostrophe
- jecassis
- jsign
Expand Down
32 changes: 12 additions & 20 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ var sendCmd = &cobra.Command{
var err error
if progByteFile != "" {
if programSource != "" || logicSigFile != "" {
reportErrorln("should at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
reportErrorln("should use at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
}
program, err = readFile(progByteFile)
if err != nil {
reportErrorf("%s: %s", progByteFile, err)
}
} else if programSource != "" {
if logicSigFile != "" {
reportErrorln("should at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
reportErrorln("should use at most one of --from-program/-F or --from-program-bytes/-P --logic-sig/-L")
}
program = assembleFile(programSource)
} else if logicSigFile != "" {
Expand Down Expand Up @@ -788,6 +788,9 @@ var signCmd = &cobra.Command{
for _, group := range groupsOrder {
txnGroup := []transactions.SignedTxn{}
for _, txn := range txnGroups[group] {
if lsig.Logic != nil {
txn.Lsig = lsig
}
txnGroup = append(txnGroup, *txn)
}
var groupCtx *verify.GroupContext
Expand All @@ -801,7 +804,6 @@ var signCmd = &cobra.Command{
for i, txn := range txnGroup {
var signedTxn transactions.SignedTxn
if lsig.Logic != nil {
txn.Lsig = lsig
err = verify.LogicSigSanityCheck(&txn, i, groupCtx)
if err != nil {
reportErrorf("%s: txn[%d] error %s", txFilename, txnIndex[txnGroups[group][i]], err)
Expand Down Expand Up @@ -1065,10 +1067,7 @@ var dryrunCmd = &cobra.Command{
}
stxns = append(stxns, txn)
}
txgroup := make([]transactions.SignedTxn, len(stxns))
for i, st := range stxns {
txgroup[i] = st
}
txgroup := transactions.WrapSignedTxnsWithAD(stxns)
proto, params := getProto(protoVersion)
if dumpForDryrun {
// Write dryrun data to file
Expand All @@ -1078,7 +1077,7 @@ var dryrunCmd = &cobra.Command{
if err != nil {
reportErrorf(err.Error())
}
data, err := libgoal.MakeDryrunStateBytes(client, nil, txgroup, accts, string(proto), dumpForDryrunFormat.String())
data, err := libgoal.MakeDryrunStateBytes(client, nil, stxns, accts, string(proto), dumpForDryrunFormat.String())
if err != nil {
reportErrorf(err.Error())
}
Expand All @@ -1096,22 +1095,15 @@ var dryrunCmd = &cobra.Command{
if uint64(txn.Lsig.Len()) > params.LogicSigMaxSize {
reportErrorf("program size too large: %d > %d", len(txn.Lsig.Logic), params.LogicSigMaxSize)
}
ep := logic.EvalParams{Txn: &txn, Proto: &params, GroupIndex: uint64(i), TxnGroup: txgroup}
err := logic.Check(txn.Lsig.Logic, ep)
ep := logic.NewEvalParams(txgroup, &params, nil)
err := logic.CheckSignature(i, ep)
if err != nil {
reportErrorf("program failed Check: %s", err)
}
sb := strings.Builder{}
ep = logic.EvalParams{
Txn: &txn,
GroupIndex: uint64(i),
Proto: &params,
Trace: &sb,
TxnGroup: txgroup,
}
pass, err := logic.Eval(txn.Lsig.Logic, ep)
ep.Trace = &strings.Builder{}
pass, err := logic.EvalSignature(i, ep)
// TODO: optionally include `inspect` output here?
fmt.Fprintf(os.Stdout, "tx[%d] trace:\n%s\n", i, sb.String())
fmt.Fprintf(os.Stdout, "tx[%d] trace:\n%s\n", i, ep.Trace.String())
if pass {
fmt.Fprintf(os.Stdout, " - pass -\n")
} else {
Expand Down
Loading

0 comments on commit 0111cb1

Please sign in to comment.