-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dryrun: Split dryrun cost field into BudgetConsumed and BudgetAdded #3957
Conversation
itxn_field TypeEnum | ||
int DeleteApplication | ||
itxn_field OnCompletion | ||
byte 0x068101 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a comment inline here right? if so can you please just add #pragma version 6; int 1;
Codecov Report
@@ Coverage Diff @@
## master #3957 +/- ##
==========================================
- Coverage 54.48% 54.46% -0.02%
==========================================
Files 390 390
Lines 48608 48619 +11
==========================================
- Hits 26482 26480 -2
- Misses 19902 19912 +10
- Partials 2224 2227 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me, just some minor comments
daemon/algod/api/server/v2/dryrun.go
Outdated
result.Cost = &cost64 | ||
// amount the budget was increased | ||
budgetDebit := uint64(proto.MaxAppProgramCost * numInnerTxns(delta)) | ||
budgetCredit := uint64(cost) + budgetDebit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't budgetCredted
just cost
? It is because cost
is really credit - debit
at this point? This might warrant a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll add a comment to clarify. You're right, cost = credit - debit
test/scripts/results.xml
Outdated
@@ -0,0 +1,2 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<testsuites></testsuites> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added by mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@algoidurovic Thanks for preserving backwards compatibility + marking cost
as deprecated. The new fields look good. 👍
Summary
Simple fix to allow reporting of budget increases, which reduce the net cost of the execution of an app call. This is needed for testing the use of inner app calls to increase the available budget.
The codegen infrastructure around the API spec has poor support for signed integers so the problem can't be solved by simply returning a negative net cost. To address this, the cost field is replaced by two unsigned integer fields representing the overall budget increase and decrease:
net cost = BudgetConsumed - BudgetAdded
.Test Plan
Updated unit test and e2e test to enforce the correct execution cost increase/decrease is reported. The unit test exercises the BudgetAdded field by using inner app calls.