Skip to content

Commit

Permalink
goal: --all-trace-options keeps track of everything in exec trace (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangsu committed Jul 26, 2023
1 parent 670010a commit d82691d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ var (
simulateAllowMoreLogging bool
simulateAllowMoreOpcodeBudget bool
simulateExtraOpcodeBudget uint64
simulateEnableRequestTrace bool
simulateStackChange bool
simulateScratchChange bool

simulateFullTrace bool
simulateEnableRequestTrace bool
simulateStackChange bool
simulateScratchChange bool
)

func init() {
Expand Down Expand Up @@ -164,6 +166,8 @@ func init() {
simulateCmd.Flags().BoolVar(&simulateAllowMoreLogging, "allow-more-logging", false, "Lift the limits on log opcode during simulation")
simulateCmd.Flags().BoolVar(&simulateAllowMoreOpcodeBudget, "allow-more-opcode-budget", false, "Apply max extra opcode budget for apps per transaction group (default 320000) during simulation")
simulateCmd.Flags().Uint64Var(&simulateExtraOpcodeBudget, "extra-opcode-budget", 0, "Apply extra opcode budget for apps per transaction group during simulation")

simulateCmd.Flags().BoolVar(&simulateFullTrace, "full-trace", false, "Enable all options for simulation execution trace")
simulateCmd.Flags().BoolVar(&simulateEnableRequestTrace, "trace", false, "Enable simulation time execution trace of app calls")
simulateCmd.Flags().BoolVar(&simulateStackChange, "stack", false, "Report stack change during simulation time")
simulateCmd.Flags().BoolVar(&simulateScratchChange, "scratch", false, "Report scratch change during simulation time")
Expand Down Expand Up @@ -1368,9 +1372,17 @@ func decodeTxnsFromFile(file string) []transactions.SignedTxn {
}

func traceCmdOptionToSimulateTraceConfigModel() simulation.ExecTraceConfig {
return simulation.ExecTraceConfig{
Enable: simulateEnableRequestTrace,
Stack: simulateStackChange,
Scratch: simulateScratchChange,
var traceConfig simulation.ExecTraceConfig
if simulateFullTrace {
traceConfig = simulation.ExecTraceConfig{
Enable: true,
Stack: true,
Scratch: true,
}
}
traceConfig.Enable = traceConfig.Enable || simulateEnableRequestTrace
traceConfig.Stack = traceConfig.Stack || simulateStackChange
traceConfig.Scratch = traceConfig.Scratch || simulateScratchChange

return traceConfig
}
2 changes: 1 addition & 1 deletion test/scripts/e2e_subs/e2e-app-simulate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ APPID=$(echo "$RES" | grep Created | awk '{ print $6 }')

${gcmd} app call --app-id $APPID --app-arg "int:10" --from $ACCOUNT 2>&1 -o "${TEMPDIR}/stack-and-scratch.tx"
${gcmd} clerk sign -i "${TEMPDIR}/stack-and-scratch.tx" -o "${TEMPDIR}/stack-and-scratch.stx"
RES=$(${gcmd} clerk simulate --trace --stack --scratch -t "${TEMPDIR}/stack-and-scratch.stx")
RES=$(${gcmd} clerk simulate --full-trace -t "${TEMPDIR}/stack-and-scratch.stx")

if [[ $(echo "$RES" | jq '."txn-groups" | any(has("failure-message"))') != $CONST_FALSE ]]; then
date '+app-simulate-test FAIL the app call for stack and scratch trace should pass %Y%m%d_%H%M%S'
Expand Down

0 comments on commit d82691d

Please sign in to comment.