-
Notifications
You must be signed in to change notification settings - Fork 57
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
XLS-56d: Atomic/Batch Transactions #197
base: master
Are you sure you want to change the base?
Conversation
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 am somewhat concerned about the greater potential for front-running with batch transactions. It seems like that is the "use case" that receives the biggest direct benefit from this feature even though we would rather discourage front-running.
Related, I think the specification should make it explicit how the batch affects the canonical order of transactions. It seems like the intent is for the canonical order to contain the outer transaction followed by the successful inner transactions in direct sequence, and that would start from wherever the outer transaction gets placed in the canonical order?
It might also be worth adding a subsection to Security about transaction fees. Specifically, make a note about how the outer transaction pays fees for all the inner transactions even if using modes like ONLYONE
where some of those transactions can fail, and how this is a precaution against exploits that could make the whole network do the work of processing candidate transactions that won't pay transaction fees.
XLS-0056d-batch/README.md
Outdated
|
||
This spec supports four modes: | ||
* `ALLORNOTHING` or `tfAllOrNothing` (with a value of `0x00000001`) | ||
* `ONLYONE` or `tfOnlyOne` (with a value of `0x00000002`) |
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 suggest renaming this mode to FIRST
(tfFirst
) to reflect that the order of inner transactions matters.
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.
That might imply to some people that it's something to do with the first transaction in the batch, rather than the first success.
XLS-0056d-batch/README.md
Outdated
The `Flags` field represents the **batch mode** of the transaction. Exactly one must be specified in a `Batch` transaction. | ||
|
||
This spec supports four modes: | ||
* `ALLORNOTHING` or `tfAllOrNothing` (with a value of `0x00000001`) |
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 could optionally rename this to ALL
(tfAll
) which I think conveys the same idea as well or better. (The "nothing" case wouldn't really be a success in my book!)
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 thought tfAll
might be confused with tfIndependent
.
|
||
Each inner transaction will contain the metadata for its own processing. Only the inner transactions that were actually committed to the ledger will be included. This makes it easier for legacy systems to still be able to process `Batch` transactions as if they were normal. | ||
|
||
There will also be a pointer back to the parent outer transaction (`parent_batch`), for ease of development (similar to the `nftoken_id` field). |
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.
Is this "pointer" meant to be part of the canonical (hashed) metadata, or added afterward? It seems like something that would be useful to have in the canonical metadata, but if so it should be in PascalCase.
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 was thinking added afterward, but I'm not sure if that's possible. cc @dangell7
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'm not sure this is possible. How would the inner txn have any context of the outer batch unless this is computed ahead of time.
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.
Should it be added to the metadata then?
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.
The metadata on the inner txn? We could maybe point the PreviousTxnID back to the batch? or add something similar to that?
Just to clarify you want to link the inner txn back to the outer txn?
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.
Just to clarify you want to link the inner txn back to the outer txn?
Yes, I think that would be very useful.
An Inner account delete should be blocked if the same account is submitting the batch. |
I'm currently signing the entire txn for |
RE Before it was thought that the batch index was the index of the transaction for a specific account. Now or with the addition of tickets, it is more correctly the index of the transaction for an account/sequence/ticket. Previously we were adding +1 to the sequence calculation if the batch txn was the outer account, however if using a combination of sequence and tickets there is no way to know. So the index needs to be calculated prior to submission. Some examples.
|
@shawnxie999 @dangell7 @mDuo13 pushed the latest changes |
I think BatchExecutions in the metadata is missing in the spec |
@shawnxie999 see this section: https://github.com/mvadari/XRPL-Standards/blob/batch/XLS-0056d-batch/README.md#261-outer-transactions |
|FieldName | Required? | JSON Type | Internal Type | | ||
|:---------|:-----------|:---------------|:------------| | ||
|`TransactionHash`|✔️|`string`|`STUInt256`| | ||
|`InnerResult`|✔️|`string`|`STBlob`| |
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.
doesn't it also have sfTransactionType
?
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.
It currently has that in place of TransactionHash
. I'd prefer TransactionHash
, personally.
|
||
Some important things to note: | ||
* It is possible that all transactions will not be included in this list. For example, when using the `ONLYONE` mode, if the first transaction succeeds, then the rest of the transactions will not even be processed. | ||
* Transactions will only be included in the ledger if their result code is `tesSUCCESS` _and_ if the outer transaction has a result code of `tesSUCCESS`. For example, if the `ALLORNOTHING` mode is used and _any_ inner transaction fails, _none_ of the inner transactions will be included in the ledger. |
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.
This aspect of Batch
transactions appears to diverge from the current understanding of the XRPL blockchain. If a non-batch transaction fails with a tec...
error, such a transaction is included in the ledger. Docs
However, suppose an Outer-Batch transaction comprises of 10 inner transactions and the tfAllOrNothing
mode. If it fails on the 9th inner transaction, then none of the transactions are included on the ledger. Am I understanding this correctly?
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.
That's the purpose of Batch
- to be something new that is different from what is currently offered. If you don't need that change in functionality, then don't use it.
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.
If the Batch
transactions tec...
codes are not included in the ledger, it leads to a break in the provenance of blockchain transactions. A few drops of XRP is irrevocably lost as transaction fees and we can never trace the reasons for such decrease in an account's balance.
Is there any design reason for excluding tec...
transactions? What are the disadvantages?
Additionally, would the account_tx
also not display such err-ing Batch transactions? account_tx
uses a different database for indexing and storing the transactions and I haven't looked at the implementation.
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.
A few drops of XRP is irrevocably lost as transaction fees
Inner Batch transactions don't have a fee. The only fee comes from the outer transaction, which will still be validated. So no break in the provenance.
Is there any design reason for excluding tec... transactions? What are the disadvantages?
If, as in your example, the 9th of 10 transactions with tfAllOrNothing
fails, why is only the 9th transaction validated and not the previous 8? That's not consistent.
Additionally, would the account_tx also not display such err-ing Batch transactions? account_tx uses a different database for indexing and storing the transactions and I haven't looked at the implementation.
It will show the whole Batch
transaction as one, the inner transactions will not be displayed differently.
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.
Inner Batch transactions don't have a fee. The only fee comes from the outer transaction, which will still be validated. So no break in the provenance.
I missed this aspect of the spec, this clarifies my doubts 👍
Is there any design reason for excluding tec... transactions? What are the disadvantages?
If, as in your example, the 9th of 10 transactions with
tfAllOrNothing
fails, why is only the 9th transaction validated and not the previous 8? That's not consistent.
No, I would have preferred to specify the execution status of all the inner transactions (not just a particular failing transaction) in the ledger. This provides the best transparency for debugging purposes.
To explain my stand further, could we execute all the transactions of an tfAllOrNothing
Batch transaction and specify the transaction-execution-result for each of them?
Additionally, would the account_tx also not display such err-ing Batch transactions? account_tx uses a different database for indexing and storing the transactions and I haven't looked at the implementation.
It will show the whole
Batch
transaction as one, the inner transactions will not be displayed differently.
No, you are speaking from the perspective of the account which submits the Outer-Batch
transaction. If I query account_tx
with one of the inner-Batch
-transaction account's, what is the expected outcome?
I can wait for the implementation and try-it-out myself, this question is not urgent.
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.
No, I would have preferred to specify the execution status of all the inner transactions (not just a particular failing transaction) in the ledger. This provides the best transparency for debugging purposes.
To explain my stand further, could we execute all the transactions of an tfAllOrNothing Batch transaction and specify the transaction-execution-result for each of them?
See the section on BatchExecutions
(in 2.6.1).
No, you are speaking from the perspective of the account which submits the Outer-Batch transaction. If I query account_tx with one of the inner-Batch-transaction account's, what is the expected outcome?
The inner transactions that are validated will all show up in account_tx
. Not sure if the failed ones will show up - I don't know how the tracking of "is an account involved in this transaction" works.
I can wait for the implementation and try-it-out myself, this question is not urgent.
https://dev.to/dangell7/batch-xls-56-is-now-available-for-testing-and-development-18bk
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.
What's the influence of Batch
transactions on the open-ledger cost? For instance, if 10 Batch
transactions are included in a validated ledger, this is equivalent to inserting at most 80 non-Batch
"usual" transactions. Is the soft-limit of the open-ledger cost calculation proportionately increased by this amendment?
Discussion thread can be found here: #162
This PR will be left open for easier commenting of specific lines/sections. The discussion will also still be available for ease of commenting for non-technical people.