Dryrun return cost#2746
Conversation
|
Seems like there's a gofmt error. Make sure you have a test that uses more than 700 units. I don't think cost should be returned at all in the json for logic sigs. That seems misleading. (It's possible it isn't, as we often omit 0s in responses.) |
| t.Log("App Cost:") | ||
| t.Log(response.Cost) |
There was a problem hiding this comment.
not needed debug output
algorandskiy
left a comment
There was a problem hiding this comment.
Protocol modification does not look correct
jannotti
left a comment
There was a problem hiding this comment.
Looks like we need to decide how to handle some protocol parmater things, and test that the api response is updated to include cost.
Codecov Report
@@ Coverage Diff @@
## master #2746 +/- ##
==========================================
- Coverage 47.14% 47.14% -0.01%
==========================================
Files 349 349
Lines 56322 56345 +23
==========================================
+ Hits 26553 26563 +10
- Misses 26800 26813 +13
Partials 2969 2969
Continue to review full report at Codecov.
|
|
did 3 things:
|
shiqizng
left a comment
There was a problem hiding this comment.
just a couple questions, but others look fine to me.
| require.Empty(t, response.Error) | ||
| require.Equal(t, 2, len(response.Txns)) | ||
|
|
||
| //dryrun call will execute but fail because the first program exceeds max possible cost |
There was a problem hiding this comment.
This is not true for the test case 2, right?
There was a problem hiding this comment.
yes, I'll remove this old comment
| -re {(ApprovalProgram)} {set PROGRAM_TYPE $expect_out(1,string); exp_continue} | ||
| "PASS" {set PASSED 1; close} | ||
| } | ||
| if { $COST == 0 } { |
There was a problem hiding this comment.
wouldn't this always be true as long as line 12 is executed?
There was a problem hiding this comment.
this looks for "cost:" string in the output. if it is there then COST = 1 and this condition does trigger termination.
c0b47cf to
15eeffb
Compare
jasonpaulos
left a comment
There was a problem hiding this comment.
Looks good, but I have a suggestion to improve the cost budget exceeded message
1f2817f
Ouddated, goal clerk changed and emits cost
This PR adds a
CostParameter to DryrunResponse. It is calculated by giving the evalParams object in dryrun.go the maximum budget allowed (maxappcost * maxgroupsize) and checking the difference after stateful evaluation. LogicSig dryruns will return cost of 0.Added a single test with sqrt and default opcodes