-
Notifications
You must be signed in to change notification settings - Fork 499
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
Support Fee Bump Transactions (CAP 15) #2360
Comments
@tamirms Unfortunately One thing that I don’t see addressed in this issue is that there won’t be any true Below is a conceptual prototype of what the new enum TransactionResultCode
{
txFEE_BUMP_INNER_SUCCESS = 1, // all operations succeeded for fee bump
txSUCCESS = 0, // all operations succeeded
txFAILED = -1, // one of the operations failed (none were applied)
txTOO_EARLY = -2, // ledger closeTime before minTime
txTOO_LATE = -3, // ledger closeTime after maxTime
txMISSING_OPERATION = -4, // no operation was specified
txBAD_SEQ = -5, // sequence number does not match source account
txBAD_AUTH = -6, // too few valid signatures / wrong network
txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
txNO_ACCOUNT = -8, // source account not found
txINSUFFICIENT_FEE = -9, // fee is too small
txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction
txINTERNAL_ERROR = -11 // an unknown error occured
txFEE_BUMP_INNER_FAILED = -12 // the inner transaction failed
};
struct TransactionResult
{
int64 feeCharged; // actual fee charged for the transaction
union switch (TransactionResultCode code)
{
case txFEE_BUMP_INNER_SUCCESS:
case txFEE_BUMP_INNER_FAILED:
TransactionResultPair innerResult;
case txSUCCESS:
case txFAILED:
OperationResult results<>;
default:
void;
}
result;
// reserved for future use
union switch (int v)
{
case 0:
void;
}
ext;
}; With XDR along these lines, fee-bump transactions will never return a Would a change like this be helpful? I’m happy to optimize the XDR further if possible. |
@jonjove and I discussed #2360 (comment) on slack. Following our conversation, here is my new proposal for Horizon responses: We want to structure the Horizon responses so that the hash in the response always matches the hash in the
Note that all the links in the horizon response will be based off the fee bump transaction hash. I found a case where the Java SDK parses the transaction envelope XDR while deserializing the Horizon JSON response. This means that we will need to release the protocol 13 support in the SDKs before it is deployed in Horizon and Stellar Core. Otherwise, clients which use the protocol 12 version of the Java SDK will fail to parse Horizon responses corresponding to fee bump transactions. Regarding how we obtain the hash of the inner transaction, I think it's best if Horizon computes the hash manually during ingestion using the transaction envelop. @jonjove mentions that it should be relatively easy for Stellar Core to provide the inner transaction hash somewhere in |
@abuiles It's definitely possible that we one day might have other "nesting" transaction types. I had an idea for one a few months ago, although I don't currently think we will end up developing that idea. |
@jonjove thanks! |
|
Ignore previous comment. I was talking about CAP 23. This one is good to go. |
Seems like this has been fixed in the recent versions of Horizon. |
The Stellar Core protocol 13 release will introduce a new type of transaction called Fee Bump transactions. Here is a summary of the changes (see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0015.md for the full set of details):
The XDR representation of a transaction envelope has changed to be a union of legacy (pre protocol 13) transactions, normal transactions where the source account pays for their own transactions, and fee bump transactions where another account elects to pay for someone else's transaction
A fee bump transaction wraps a normal transaction with two extra pieces of information: the account which will be paying for the fee and the new fee amount the account is willing to pay. Consequently, the transaction hash of the fee bump transaction will differ from the hash of the fee bump's inner transaction.
A fee bump transaction envelope will contain the signature of the fee source account.
The fee bump transaction envelope will also contain the full contents of the inner transaction including the original source account, signatures, and fee of the inner transaction.
To support Fee Bump transactions we will need to implement the following changes in Horizon and the SDKs:
Update XDR definitions and auto generated code derived from XDR definitions in Horizon
Update XDR definitions and auto generated code derived from XDR definitions in all the SDKs
Update horizon schema to support fee bump transactions. I propose the following schema changes:
inner_transaction_hash
,inner_signatures
, andfee_account
columns to thehistory_transactions
tableinner_transaction_hash
inner_transaction_hash
,inner_signatures
, andfee_account
will beNULL
inner_transaction_hash
will be the hash of the inner transaction wrapped by the fee bump,inner_signatures
will be the set of signatures for the inner transaction, andfee_account
will be the account paying the fee on behalf of the inner transactiontransaction_hash
will be the hash of the fee bump transaction,max_fee
will be the fee set by the fee bump transaction,fee_charged
will be the amount paid by the fee source account, and all remaining fields in thehistory_transactions
row will be populated using fields from the inner transaction.Update horizon ingestion to support fee bump transactions.
results
field from theTransactionResult
XDR object.innerResult
field from theTransactionResult
XDR object.TransactionResultPair
XDR object in theTransactionResultSet
. In the case of a fee bump transaction, I assume the transaction hash inTransactionResultPair
will correspond to the fee bump transaction, not the inner transaction. How should we obtain the transaction hash of the inner transaction? Should we calculate the inner transaction hash during ingestion? Or shouldTransactionResultPair
be amended to include the inner transaction hash? @jonjove any thoughts on this topic?Update the horizon protocol transaction response struct so that it includes the new fields added to the
history_transactions
tableUpdate SDKs so that they are compatible with the new horizon transaction response structure
Update horizon
GET /transactions/{hash}
handler so thathash
can match either thetransaction_hash
orinner_transaction_hash
column from thehistory_transactions
table. In other words, we should be able to look up a transaction by either its hash or its inner hash (in the case the transaction is a fee bump)Update
txsub
package in horizon so that a request to submit a normal transaction will respond with the transaction result from its corresponding fee bump transaction if the normal transaction was fee bumped.Updates SDKs with functionality to create and submit fee bump transactions. Note that fee bump transactions have a different fee rate calculation compared to normal transactions, see https://github.com/stellar/stellar-protocol/blob/master/core/cap-0015.md#fee-rate .
Consider SEP 10 implications of fee bump transactions. We probably want to add the restriction that a fee bump transaction cannot be a valid SEP 10 challenge transaction.
The text was updated successfully, but these errors were encountered: