From 9aa9150d9046116edf0d14e600b847fb58da3fac Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Wed, 15 May 2019 22:35:36 +0100 Subject: [PATCH 1/9] Create eip-draft_StateRentBNetTransactionCounter.md --- ...p-draft_StateRentBNetTransactionCounter.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 EIPS/eip-draft_StateRentBNetTransactionCounter.md diff --git a/EIPS/eip-draft_StateRentBNetTransactionCounter.md b/EIPS/eip-draft_StateRentBNetTransactionCounter.md new file mode 100644 index 00000000000000..137a198b325fbc --- /dev/null +++ b/EIPS/eip-draft_StateRentBNetTransactionCounter.md @@ -0,0 +1,59 @@ +--- +eip: +title: State Rent B - Net transaction counter +author: Alexey Akhunov (@AlexeyAkhunov) +discussions-to: to be added when the number is known +status: Draft +type: Standards Track +category: Core +created: 2019-05-15 +--- + + + +## Simple Summary + +Ethereum starts to track the number of transactions inside it state (for now, only number of transactions after this change is introduced, therefore +it is called *Net* transaction count). +It is done by incrementing a storage slot in the special contract, called State counter contract (see EIP 2029). + +## Abstract + +It is part of the State Rent roadmap. This particular change makes any Ethereum transaction increment the transaction counter, which is a special storage slot +in the State counter contract. This counter will be used to populate the nonces of newly created +non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them. + +## Motivation + +Ethereum currently does not have a special place in the state for tracking number of transactions. + +## Specification + +A new field, with the location 0, is added to the state counter contract. It will eventually contain `txCount`, the total number of transactions processed up until that point. +On an after block B, or after the deployment of the state counter contract (which comes first), the field `txCount` is incremented after each transaction. Updating `txCount` means updating the storage of state counter contract at the location 0. These changes are never reverted. + +## Rationale + +Two main alternatives were proposed for the replay protection of the accounts that were evicted by subsequently brought back by sending ether to them: +1. Temporal replay protection. The nonce of the new accounts (and those brought back) is still zero, but a new `valid-until` field is introduced, making +transactions invalid for inclusion after the time specified in this field. This, however, has unwanted side effected related to the fact that account +nonces are not only used for replay protection, but also for computing the addresses of the deployed contracts (except those created by `CREATE2`). +2. Setting nonce of new accounts (and those brought back) to something depending on the current block number. This approach requires coming up with +an arbitrary parameter, which is the maximum number of transaction in the block, so that the new nonces never clash with the existing nonces. +This is mostly concern for private networks at the moment, potentially having much more transactions in a block. + +## Backwards Compatibility + +This change is not backwards compatible and requires hard fork to be activated. + +## Test Cases + +Tests cases will be generated out of a reference implementation. + +## Implementation + +There will be proof of concept implementation to refine and clarify the specification. + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). + From 64ef55fecdb585815cf21a280d0b1ac2f977e452 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Wed, 15 May 2019 22:39:53 +0100 Subject: [PATCH 2/9] Update and rename eip-draft_StateRentBNetTransactionCounter.md to eip-2031.md --- ...p-draft_StateRentBNetTransactionCounter.md => eip-2031.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename EIPS/{eip-draft_StateRentBNetTransactionCounter.md => eip-2031.md} (97%) diff --git a/EIPS/eip-draft_StateRentBNetTransactionCounter.md b/EIPS/eip-2031.md similarity index 97% rename from EIPS/eip-draft_StateRentBNetTransactionCounter.md rename to EIPS/eip-2031.md index 137a198b325fbc..68640ef10bf13e 100644 --- a/EIPS/eip-draft_StateRentBNetTransactionCounter.md +++ b/EIPS/eip-2031.md @@ -1,8 +1,8 @@ --- -eip: +eip: 2031 title: State Rent B - Net transaction counter author: Alexey Akhunov (@AlexeyAkhunov) -discussions-to: to be added when the number is known +discussions-to: https://ethereum-magicians.org/t/eip-2031-net-transaction-counter-change-b-from-state-rent-v3-proposal/3283 status: Draft type: Standards Track category: Core From 1cdd97f5aae484165b3f50ed566ed16045535a79 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 17 May 2019 08:20:55 +0100 Subject: [PATCH 3/9] Update eip-2031.md --- EIPS/eip-2031.md | 1 + 1 file changed, 1 insertion(+) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 68640ef10bf13e..c32990fadffefe 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -7,6 +7,7 @@ status: Draft type: Standards Track category: Core created: 2019-05-15 +requires: 2029 --- From 0976fe05d9e02afd615164abfbd59b9ad9f6afce Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 17 May 2019 08:22:20 +0100 Subject: [PATCH 4/9] Update eip-2031.md --- EIPS/eip-2031.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index c32990fadffefe..50d8f742c2399a 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -30,7 +30,8 @@ Ethereum currently does not have a special place in the state for tracking numbe ## Specification -A new field, with the location 0, is added to the state counter contract. It will eventually contain `txCount`, the total number of transactions processed up until that point. +A new field, with the location 0 (that means it resides in the storage slot 0 in the state counter contract, and can +be read by calling that contract with argument 0), is added to the state counter contract. It will eventually contain `txCount`, the total number of transactions processed up until that point. On an after block B, or after the deployment of the state counter contract (which comes first), the field `txCount` is incremented after each transaction. Updating `txCount` means updating the storage of state counter contract at the location 0. These changes are never reverted. ## Rationale From b5c02ae35481fbf96315ba36018a8e7779a5a887 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 17 May 2019 21:45:40 +0100 Subject: [PATCH 5/9] Update eip-2031.md --- EIPS/eip-2031.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 50d8f742c2399a..026a45c2853a3a 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -42,7 +42,7 @@ transactions invalid for inclusion after the time specified in this field. This, nonces are not only used for replay protection, but also for computing the addresses of the deployed contracts (except those created by `CREATE2`). 2. Setting nonce of new accounts (and those brought back) to something depending on the current block number. This approach requires coming up with an arbitrary parameter, which is the maximum number of transaction in the block, so that the new nonces never clash with the existing nonces. -This is mostly concern for private networks at the moment, potentially having much more transactions in a block. +This is mostly a concern for private networks at the moment, because they will potentially have significantly more transactions in a block. ## Backwards Compatibility From d872f9d53fa90befd599b2bdc795948889edb61c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 23 May 2019 23:21:08 +0100 Subject: [PATCH 6/9] Fix some typos --- EIPS/eip-2031.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 026a45c2853a3a..3c3df511fea80c 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -14,14 +14,14 @@ requires: 2029 ## Simple Summary -Ethereum starts to track the number of transactions inside it state (for now, only number of transactions after this change is introduced, therefore +Ethereum starts to track the number of transactions inside its state (for now, only number of transactions after this change is introduced, therefore it is called *Net* transaction count). -It is done by incrementing a storage slot in the special contract, called State counter contract (see EIP 2029). +It is done by incrementing a storage slot in the special contract, called *State counter contract* (see EIP 2029). ## Abstract It is part of the State Rent roadmap. This particular change makes any Ethereum transaction increment the transaction counter, which is a special storage slot -in the State counter contract. This counter will be used to populate the nonces of newly created +in the *State counter contract*. This counter will be used to populate the nonces of newly created non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them. ## Motivation From 1cc630cbb44951c4a984fa8d6927ca2b93d56dbc Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 23 May 2019 23:21:31 +0100 Subject: [PATCH 7/9] Use canonical link to EIP-2029 --- EIPS/eip-2031.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 3c3df511fea80c..30c7e3c6d358c0 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -16,7 +16,7 @@ requires: 2029 Ethereum starts to track the number of transactions inside its state (for now, only number of transactions after this change is introduced, therefore it is called *Net* transaction count). -It is done by incrementing a storage slot in the special contract, called *State counter contract* (see EIP 2029). +It is done by incrementing a storage slot in the special contract, called *State counter contract* ([EIP-2029](https://eips.ethereum.org/EIPS/eip-2029). ## Abstract From 382e32c0245ad98f35db9b26c698c4ac56be30a3 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 24 May 2019 07:19:28 +0100 Subject: [PATCH 8/9] Update eip-2031.md --- EIPS/eip-2031.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 30c7e3c6d358c0..48b611831d4cb8 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -31,7 +31,7 @@ Ethereum currently does not have a special place in the state for tracking numbe ## Specification A new field, with the location 0 (that means it resides in the storage slot 0 in the state counter contract, and can -be read by calling that contract with argument 0), is added to the state counter contract. It will eventually contain `txCount`, the total number of transactions processed up until that point. +be read by calling that contract with argument being 32 zero bytes), is added to the state counter contract. It will eventually contain `txCount`, the total number of transactions processed up until that point. On an after block B, or after the deployment of the state counter contract (which comes first), the field `txCount` is incremented after each transaction. Updating `txCount` means updating the storage of state counter contract at the location 0. These changes are never reverted. ## Rationale From da20d2d018197e4510eecd08f45ec26e169af200 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 24 May 2019 07:20:23 +0100 Subject: [PATCH 9/9] Update eip-2031.md --- EIPS/eip-2031.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-2031.md b/EIPS/eip-2031.md index 48b611831d4cb8..894eb0d9fc0325 100644 --- a/EIPS/eip-2031.md +++ b/EIPS/eip-2031.md @@ -16,7 +16,7 @@ requires: 2029 Ethereum starts to track the number of transactions inside its state (for now, only number of transactions after this change is introduced, therefore it is called *Net* transaction count). -It is done by incrementing a storage slot in the special contract, called *State counter contract* ([EIP-2029](https://eips.ethereum.org/EIPS/eip-2029). +It is done by incrementing a storage slot in the special contract, called *State counter contract* ([EIP-2029](https://eips.ethereum.org/EIPS/eip-2029)). ## Abstract