-
Notifications
You must be signed in to change notification settings - Fork 492
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
Inner groups #3009
Inner groups #3009
Changes from all commits
5f6793e
16da9bf
c054d4d
90c611e
b9efcd1
796465c
865f2c0
5c33184
5c4dff7
ea5867a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,9 +169,10 @@ var opDocByName = map[string]string{ | |
"b~": "X with all bits inverted", | ||
|
||
"log": "write bytes to log state of the current application", | ||
"itxn_begin": "begin preparation of a new inner transaction", | ||
"itxn_begin": "begin preparation of a new inner transaction in a new transaction group", | ||
"itxn_next": "begin preparation of a new inner transaction in the same transaction group", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An expanded description for this opcode would be helpful to explain when it's useful. I.e., all inner transactions are atomic in the sense that if one fails, the entire top-level transaction fails. However, explicitly putting transactions into groups enables fee pooling and setting up the environment for inner transaction application calls. |
||
"itxn_field": "set field F of the current inner transaction to X", | ||
"itxn_submit": "execute the current inner transaction. Fail if 16 inner transactions have already been executed, or if the transaction itself fails.", | ||
"itxn_submit": "execute the current inner transaction group. Fail if executing this group would exceed 16 total inner transactions, or if any transaction in the group fails.", | ||
} | ||
|
||
// OpDoc returns a description of the op | ||
|
@@ -300,7 +301,7 @@ var OpGroups = map[string][]string{ | |
"Loading Values": {"intcblock", "intc", "intc_0", "intc_1", "intc_2", "intc_3", "pushint", "bytecblock", "bytec", "bytec_0", "bytec_1", "bytec_2", "bytec_3", "pushbytes", "bzero", "arg", "arg_0", "arg_1", "arg_2", "arg_3", "args", "txn", "gtxn", "txna", "txnas", "gtxna", "gtxnas", "gtxns", "gtxnsa", "gtxnsas", "global", "load", "loads", "store", "stores", "gload", "gloads", "gaid", "gaids"}, | ||
"Flow Control": {"err", "bnz", "bz", "b", "return", "pop", "dup", "dup2", "dig", "cover", "uncover", "swap", "select", "assert", "callsub", "retsub"}, | ||
"State Access": {"balance", "min_balance", "app_opted_in", "app_local_get", "app_local_get_ex", "app_global_get", "app_global_get_ex", "app_local_put", "app_global_put", "app_local_del", "app_global_del", "asset_holding_get", "asset_params_get", "app_params_get", "log"}, | ||
"Inner Transactions": {"itxn_begin", "itxn_field", "itxn_submit", "itxn", "itxna"}, | ||
"Inner Transactions": {"itxn_begin", "itxn_next", "itxn_field", "itxn_submit", "itxn", "itxna"}, | ||
} | ||
|
||
// OpCost indicates the cost of an operation over the range of | ||
|
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.
did you consider changing the name of "itxn_submit", since "itxn" in the other opcodes is referring to a single inner transaction, whereas here it's referring to the whole group of them?
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.
Yeah, I originally thought I'd be explicit about the whole thing, wrap a bunch of matched
itxn_begin
anditxn_end
pairs with itxg_begin, itxg_submit. But I couldn't justify all those opcodes once I started trying to write apps with them.This seemed like the minimal change possible, and you can use itxn_submit to submit a single transaction, so I didn't want to waste an opcode on the distinction. But it's not crazy if people think we should go that way.
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.
I personally like it the way you did it, I think the additional opcodes aren't worth the minimal increase in explicitness/clarity.