Skip to content
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

Merged
merged 20 commits into from
May 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bring back Cost field but mark for deprecation
algoidurovic committed May 16, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ricmoo Richard Moore
commit 4efa1d18c340c2b172a49d56b8c8247e59adbaf8
3 changes: 3 additions & 0 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
@@ -1211,6 +1211,9 @@ var dryrunRemoteCmd = &cobra.Command{
trace = *txnResult.LogicSigTrace
}
}
if txnResult.Cost != nil {
fmt.Fprintf(os.Stdout, "tx[%d] cost: %d\n", i, *txnResult.Cost)
}
if txnResult.BudgetConsumed != nil {
fmt.Fprintf(os.Stdout, "tx[%d] budget consumed: %d\n", i, *txnResult.BudgetConsumed)
}
4 changes: 4 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
@@ -2302,6 +2302,10 @@
"budget-consumed": {
"description": "Budget consumed during execution of app call transaction.",
"type": "integer"
},
"cost": {
"description": "Net cost of app execution. Will be DEPRECATED.",
"type": "integer"
}
}
},
4 changes: 4 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
@@ -1336,6 +1336,10 @@
"description": "Budget consumed during execution of app call transaction.",
"type": "integer"
},
"cost": {
"description": "Net cost of app execution. Will be DEPRECATED.",
"type": "integer"
},
"disassembly": {
"description": "Disassembled program line by line.",
"items": {
2 changes: 2 additions & 0 deletions daemon/algod/api/server/v2/dryrun.go
Original file line number Diff line number Diff line change
@@ -546,8 +546,10 @@ func doDryrunRequest(dr *DryrunRequest, response *generated.DryrunResponse) {
// integers, so a negative cost would underflow. The two fields also provide
// more information, which can be useful for testing purposes.
// cost = budgetConsumed - budgetAdded
netCost := uint64(cost)
budgetAdded := uint64(proto.MaxAppProgramCost * numInnerTxns(delta))
budgetConsumed := uint64(cost) + budgetAdded
result.Cost = &netCost
result.BudgetAdded = &budgetAdded
result.BudgetConsumed = &budgetConsumed
maxCurrentBudget = pooledAppBudget
296 changes: 148 additions & 148 deletions daemon/algod/api/server/v2/generated/private/routes.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions daemon/algod/api/server/v2/generated/private/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

397 changes: 199 additions & 198 deletions daemon/algod/api/server/v2/generated/routes.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions daemon/algod/api/server/v2/generated/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.