From a2443ac4e4b2e0383d22f6868c53d94f8ebb1d5f Mon Sep 17 00:00:00 2001 From: Moody Salem Date: Sun, 31 May 2020 09:35:47 -0400 Subject: [PATCH 1/5] transaction deadlines --- EIPS/eip-transaction_deadlines.md | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 EIPS/eip-transaction_deadlines.md diff --git a/EIPS/eip-transaction_deadlines.md b/EIPS/eip-transaction_deadlines.md new file mode 100644 index 00000000000000..5efe6599d308b0 --- /dev/null +++ b/EIPS/eip-transaction_deadlines.md @@ -0,0 +1,89 @@ +--- +eip: +title: Transaction Deadlines +author: Moody Salem (@moodysalem) +discussions-to: +status: Draft +type: Standards Track +category: Core +created: 2020-05-31 +--- + + + +## Simple Summary + +Once submitted, pending transactions can stick around for days, while the user's intentions often change after only minutes. +Transactions should have associated `deadline`s that prevent a transaction from being included in a block with a timestamp +that exceeds the deadline. This will provide a much needed improvement to the user experience during times of congestion. + +## Abstract + +Transactions currently have no way to specify for how long they are valid. Once the transaction enters the network's mempool, +it is impossible to forget the transaction. The only current option is to replace the transaction by fee. If the transaction +appears to be dropped from the mempool, there is still no guarantee that no nodes still remember the pending transaction. + +Transactions should expire after a user specified timestamp. This allows the wallet UX to determine that a transaction +previously signed will never be included into a block. + +## Motivation + +If a user sets a gas price that is too low, a pending transaction may be stuck in their wallet for days. +Later when the user returns to use their wallet again, the wallet is in a state where it cannot be used until the +previous transaction is replaced with a transaction that has a higher gas price. Few users understand how this works. +Transactions should automatically drop from the mempools after a user specified timestamp. This makes it much simpler +for users to retry after sending a transaction with a bad gas price that gets stuck in the mempool. + +## Specification + + +Transactions will have one new optional parameter: + +- `DEADLINE`: the maximum block timestamp of a block that can include the transaction, in seconds + +Any block that includes transactions with `DEADLINE` > `block.timestamp` will not be considered valid. + +## Rationale + +This is one small usability improvement to the situation we see in many dApp support channels, where users end up with +stuck transactions due to highly volatile gas prices. For example, a user may submit a transaction with a "slow" gas price +just before congestion begins, and may not understand that transactions must be ordered by their nonce. When they submit +their next transaction, they are confused that the old and new transaction have been pending for days, even if they +select a much higher gas price for the second transaction. + +This partially solves the UX problem by time-boxing how long this situation may continue. Wallets may choose to treat certain +operations as 'hot' operations, or may detect `deadline` parameters from TX arguments and automatically insert them into +the transaction, to significantly improve the UX. Users will no longer have to do the replace by fee dance that is required +once you are stuck in this situation, and will not have to pay gas to cancel transactions they no longer care about, +which will also free up block capacity. And finally, nodes can easily decide whether to drop old pending transactions from the mempool. + +## Backwards Compatibility + +Transactions that do not specify the `DEADLINE` parameter will behave the same as transactions before the EIP. + +This is soft-fork compatible; i.e. nodes following pre-EIP rules will always accept blocks validated by post-EIP rules. + +## Test Cases + + +TODO + +## Implementation + + +TODO + +## Security Considerations + + +For security considerations, here are some scenarios to consider: + +- No timestamp: Same security considerations are current transactions +- Happy path: single pending TX with `deadline` in future +- Invalid TX: TX submitted with `deadline` in past +- Pending TX chain: Multiple TXs submitted with `deadline` in future, increasing nonces-miners can include any of the valid transactions. + If a TX is dropped due to `deadline` from the in the middle of the chain, it has no effect on the following transactions. +- Multiple competing TXs: Multiple TXs submitted with `deadline`s in future and same nonce-miners can include any of the valid transactions + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From c60e59c77ec55c8ab2f0fe27831fd896fdaf1f6e Mon Sep 17 00:00:00 2001 From: Moody Salem Date: Sun, 31 May 2020 09:38:49 -0400 Subject: [PATCH 2/5] small wording fix in summary --- EIPS/eip-transaction_deadlines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-transaction_deadlines.md b/EIPS/eip-transaction_deadlines.md index 5efe6599d308b0..26c4eeb3f9c688 100644 --- a/EIPS/eip-transaction_deadlines.md +++ b/EIPS/eip-transaction_deadlines.md @@ -14,8 +14,8 @@ created: 2020-05-31 ## Simple Summary Once submitted, pending transactions can stick around for days, while the user's intentions often change after only minutes. -Transactions should have associated `deadline`s that prevent a transaction from being included in a block with a timestamp -that exceeds the deadline. This will provide a much needed improvement to the user experience during times of congestion. +Transactions should have `deadline`s that prevent a transaction from being included in a block after a given timestamp. +This will provide a much-needed improvement to the user experience during times of congestion and volatile gas prices. ## Abstract From 13b055402eda59d78d8b9719918e5799796de555 Mon Sep 17 00:00:00 2001 From: Moody Salem Date: Sun, 31 May 2020 09:40:53 -0400 Subject: [PATCH 3/5] clean up abstract --- EIPS/eip-transaction_deadlines.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/EIPS/eip-transaction_deadlines.md b/EIPS/eip-transaction_deadlines.md index 26c4eeb3f9c688..37bb1997881157 100644 --- a/EIPS/eip-transaction_deadlines.md +++ b/EIPS/eip-transaction_deadlines.md @@ -20,11 +20,15 @@ This will provide a much-needed improvement to the user experience during times ## Abstract Transactions currently have no way to specify for how long they are valid. Once the transaction enters the network's mempool, -it is impossible to forget the transaction. The only current option is to replace the transaction by fee. If the transaction -appears to be dropped from the mempool, there is still no guarantee that no nodes still remember the pending transaction. - -Transactions should expire after a user specified timestamp. This allows the wallet UX to determine that a transaction -previously signed will never be included into a block. +it is impossible to forget the transaction. The only current option is to replace the transaction by submitting another +transaction with the same nonce and a higher gas price. However, this is not a deterministic replacement. +Nodes can still include the previously submitted transaction with the lower gas price. +If the transaction appears to be dropped from the mempool (e.g. does not show up in Etherscan), +there is still no guarantee that the transaction will not be included in a future block. +This creates a number of UX issues for pending transactions. + +To solve this, transactions should expire after a user specified timestamp. +This enables the wallet UX to determine that a transaction previously signed will never be included into a block. ## Motivation From 88bc6feae83225bbfafa0b848e942c2b659e47d7 Mon Sep 17 00:00:00 2001 From: Moody Salem Date: Sun, 31 May 2020 09:42:18 -0400 Subject: [PATCH 4/5] Clean up motivation --- EIPS/eip-transaction_deadlines.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-transaction_deadlines.md b/EIPS/eip-transaction_deadlines.md index 37bb1997881157..80640f63d40580 100644 --- a/EIPS/eip-transaction_deadlines.md +++ b/EIPS/eip-transaction_deadlines.md @@ -32,11 +32,13 @@ This enables the wallet UX to determine that a transaction previously signed wil ## Motivation -If a user sets a gas price that is too low, a pending transaction may be stuck in their wallet for days. -Later when the user returns to use their wallet again, the wallet is in a state where it cannot be used until the -previous transaction is replaced with a transaction that has a higher gas price. Few users understand how this works. +If a user sets a gas price that is too low, a pending transaction may become "stuck" in their wallet for days. +Later when the user returns to use their wallet again, the wallet is in a state where it cannot be used, until the +user sends an additional transaction with the same nonce and a higher gas price. Few users understand how this works. + Transactions should automatically drop from the mempools after a user specified timestamp. This makes it much simpler -for users to retry after sending a transaction with a bad gas price that gets stuck in the mempool. +for users to retry after sending a transaction with a bad gas price, as the situation will resolve itself once the +transactions expire. ## Specification From 03fa2e14d0271d6e76c9e823d43b067bc63f622a Mon Sep 17 00:00:00 2001 From: Moody Salem Date: Sun, 31 May 2020 09:47:31 -0400 Subject: [PATCH 5/5] more clean up --- EIPS/eip-transaction_deadlines.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/EIPS/eip-transaction_deadlines.md b/EIPS/eip-transaction_deadlines.md index 80640f63d40580..97b64dbd78bad0 100644 --- a/EIPS/eip-transaction_deadlines.md +++ b/EIPS/eip-transaction_deadlines.md @@ -33,12 +33,14 @@ This enables the wallet UX to determine that a transaction previously signed wil ## Motivation If a user sets a gas price that is too low, a pending transaction may become "stuck" in their wallet for days. -Later when the user returns to use their wallet again, the wallet is in a state where it cannot be used, until the -user sends an additional transaction with the same nonce and a higher gas price. Few users understand how this works. +Once stuck, the user's wallet is unusable until they replace the problem transaction. Replacing transactions is +an advanced process that few users understand. Users should *not* have to understand the advanced semantics of replacing +transactions. -Transactions should automatically drop from the mempools after a user specified timestamp. This makes it much simpler -for users to retry after sending a transaction with a bad gas price, as the situation will resolve itself once the -transactions expire. +Instead, transactions should automatically drop from the mempools after a user or user wallet specified timestamp. +This makes it much simpler for users to reattempt sending a transaction with a bad gas price, +as the pending transaction situation will resolve itself once the transactions expire, and wallets can freely re-use the nonce +knowing that the old transaction will never be included. ## Specification @@ -58,10 +60,13 @@ their next transaction, they are confused that the old and new transaction have select a much higher gas price for the second transaction. This partially solves the UX problem by time-boxing how long this situation may continue. Wallets may choose to treat certain -operations as 'hot' operations, or may detect `deadline` parameters from TX arguments and automatically insert them into -the transaction, to significantly improve the UX. Users will no longer have to do the replace by fee dance that is required -once you are stuck in this situation, and will not have to pay gas to cancel transactions they no longer care about, -which will also free up block capacity. And finally, nodes can easily decide whether to drop old pending transactions from the mempool. +operations as 'hot' operations with very short deadlines, or may detect `deadline` parameters from TX arguments +and automatically insert them into the transaction, to significantly improve the UX. Users will no longer have to do +the replace-by-fee dance that is required once you become stuck in this situation, which is especially hairy when there +are multiple pending transactions (replacing tx with nonce 1 does not replace tx with nonce 2 and 3.) + +Users also will not have to pay gas to cancel transactions they no longer care about, which will also free up block capacity. +Finally, nodes can easily decide whether to drop old pending transactions from the mempool for transactions with a `deadline`. ## Backwards Compatibility