CAP: 0028
Title: Clear pre-auth transaction signer on failed transactions
Author: Siddharth Suresh
Status: Final
Created: 2019-10-10
Discussion: https://github.com/stellar/stellar-protocol/issues/495
Protocol version: 13
Pre-auth signers are only removed from the source account if signature verification on the transaction succeeds during transaction application. The signer is left on the account otherwise. This proposal will remove the signer from the source account when the transaction is being applied, regardless of the outcome of that transaction.
If the pre-auth transaction fails before signature verification succeeds, the pre-auth signer needs to be removed manually using the Set Options operation. The fee for that transaction will have already been consumed, so it should never be applied again. The pre-auth signer can never be used again due to this, so there's no reason to keep it around.
CAP-0015 (Fee-Bump Transactions) also introduces behavior that can make it harder to clean up the obsolete pre-auth signers. If the outer fee bump transaction has an invalid signature, the inner transaction will still need to be applied. The pre-auth signer will not be removed due to the outer transaction failing, but the inner transaction can return txSUCCESS
, so the account owner won't know to remove the signer.
The Stellar Network should facilitate simplicity and interoperability with other protocols and networks.
This proposal will add functionality to remove a pre-auth signer even if the signer has not been checked yet. A method will be added to TransactionFrame
that will check every transaction and operation source account for the pre-auth signer, and remove it if found. This method will be called every time a transaction enters the application stage (even if the transaction fails for any reason).
The existing functionality along with what's being added is only executed when the transaction is in the application stage. The application stage is where the transaction will be used to execute it's operations and modify the ledger. The transaction will not enter the application stage if it isn't accepted into the transaction set, which means the signatures on the source accounts of the transaction/operations won't be considered for removal. The transactions must have valid signatures and sequence number at the time of submission to be accepted into the transaction set. Here are some examples to make this clearer.
- Source account
B
with a pre-auth signer is at sequence numberX
. - A transaction that corresponds to the signer on
B
is submitted for source accountB
with sequence numberX
. - This sequence number is invalid, so the transaction will not be included in the transaction set to be applied. The signer will not be removed.
- Source account
B
with a pre auth signer is at sequence numberX
. - A transaction for source account B is submitted with sequence number
X + 1
, with aBUMP_SEQUENCE
operation that sets the sequence number toX + 2
. This transaction makes it into the transaction set. It hasn't been applied yet. - A transaction that corresponds to the signer on
B
is submitted for source accountB
with sequence numberX + 2
. This transaction makes it into the transaction set because the sequence number is right. - Transaction set is being applied. The first transaction with the
BUMP_SEQUENCE
operation is applied succesfully, which sets the sequence number of source accountB
toX + 2
. - Now the second transaction is being applied. The sequence number check on the transaction will fail because it is equivalent to the sequence number on the account (both are
X + 2
). The signer will be removed in this case.
A similar scenario to the sequence number failure above can happen with a signature verification failure. To remove a signer on signature verification failure -
- Source account
B
has pre-auth signer with weight1
. All thresholds on account are also set to1
. - A transaction set with two transactions for source account
B
are being applied.- Transaction #1 -
SET_OPTIONS
operation that sets all thresholds to some high value (say255
) - Transaction #2 - Pre-auth transaction that corresponds to the signer that was added to
B
- Transaction #1 -
- Transaction #2 will fail during application because the signer weight isn't high enough, and the pre-auth signer will be removed from account
B
.
The proposed solution is simple and maintains backwards compatibility.
None
There are no security concerns here, as this is a small change that removes a signer from a source account.
None yet