From 2656d616adc0004b6e40a629e51bb7c2f6ec2635 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 11 May 2019 12:14:06 +0100 Subject: [PATCH 1/5] Add draft for ESO (extended state oracle) --- EIPS/eip-draft_extended_state_oracle.md | 86 +++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 EIPS/eip-draft_extended_state_oracle.md diff --git a/EIPS/eip-draft_extended_state_oracle.md b/EIPS/eip-draft_extended_state_oracle.md new file mode 100644 index 0000000000000..317350bb84e1a --- /dev/null +++ b/EIPS/eip-draft_extended_state_oracle.md @@ -0,0 +1,86 @@ +--- +eip: +title: Extended State Oracle +author: Alex Beregszaszi (@axic) +discussions-to: +status: Draft +type: Standards Track +category: Core +created: 2019-05-10 +--- + +## Simple Summary + + +## Abstract + +Introduce a new system contract with an extensible interface following the [Contract ABI Encoding] to access extended data sets, such as chain identifiers, block hashes, etc. + +This allows Ethereum contract languages to interact with this contract as if it were a regular contract and not needing any language support. + +## Motivation + +Over the past couple of years several proposals were made to extend the EVM with more data. Some examples include extended access to block hashes ([EIP-210]) and chain identifiers ([EIP-1344]). + +Adding them as EVM opcodes seems to be using the scarce opcode space for relatively less frequently used features, while adding them as precompiles is perceived as more complicated due to an interface +needs to be defined and agreed on for every case. + +This proposal tries to solve both issues with defining an extensible standard interface. + +## Specification + +A new system contract ("precompile") is introduced at address `0x0000000000000000000000000000000000000009` called ESO (Extended State Oracle). + +It can be queried using `CALL` or `STATICCALL` and follows the [Contract ABI Encoding] for the inputs and outputs. Using elementary types in the ABI encoding is encouraged to keep complexity low. + +In the future it could be possible to extend ESO to have a state and accept transactions from a system address to store the passed data -- similarly to what [EIP-210] proposed. + +Proposals wanting to introduce more data to the state, which is not part of blocks or transactions, should aim to extend the ESO. + +At this time it is not proposed to make the ESO into a contract existing in the state, but to include it as a precompile and leave the implementation details to the client. +In the future if it is sufficiently extended and a need arises to have a state, it would make sense to move it from being a precompile and have actual code. + +### Chain identifier + +Initially, a feature to read the current chain identifier is introduced: `getCurrentChainId()` returns the current chain identifier as a `uint64` encoded value. This has been proposed as [EIP-1344]. + +The contract ABI JSON is the following: +```json +[ + { + "constant": true, + "inputs": [], + "name": "getCurrentChainId", + "outputs": [ + { + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } +] +``` + +This will be translated into sending the bytes `5cf0e8a4` to the ESO and returning the bytes `0000000000000000000000000000000000000000000000000000000000000001` for Ethereum mainnet. + +## Rationale + + +## Backwards Compatibility + + +## Test Cases + + +## Implementation + + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). + +[Contract ABI Encoding]: https://solidity.readthedocs.io/en/latest/abi-spec.html +[EIP-210]: https://eips.ethereum.org/EIPS/eip-210 +[EIP-1344]: https://eips.ethereum.org/EIPS/eip-1344 From bf35291cba3236490d96981fb197761cd7ecccd2 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 11 May 2019 13:28:45 +0100 Subject: [PATCH 2/5] Add mention of revert to ESO --- EIPS/eip-draft_extended_state_oracle.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-draft_extended_state_oracle.md b/EIPS/eip-draft_extended_state_oracle.md index 317350bb84e1a..0a99e22cedfb0 100644 --- a/EIPS/eip-draft_extended_state_oracle.md +++ b/EIPS/eip-draft_extended_state_oracle.md @@ -7,6 +7,7 @@ status: Draft type: Standards Track category: Core created: 2019-05-10 +requires: 140 --- ## Simple Summary @@ -42,7 +43,9 @@ In the future if it is sufficiently extended and a need arises to have a state, ### Chain identifier -Initially, a feature to read the current chain identifier is introduced: `getCurrentChainId()` returns the current chain identifier as a `uint64` encoded value. This has been proposed as [EIP-1344]. +Initially, a feature to read the current chain identifier is introduced: `getCurrentChainId()` returns the current chain identifier as a `uint64` encoded value. +It should be a non-payable function, which means sending any value would revert the transaction as described in [EIP-140]. +This has been proposed as [EIP-1344]. The contract ABI JSON is the following: ```json @@ -82,5 +85,6 @@ This will be translated into sending the bytes `5cf0e8a4` to the ESO and returni Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). [Contract ABI Encoding]: https://solidity.readthedocs.io/en/latest/abi-spec.html +[EIP-140]: https://eips.ethereum.org/EIPS/eip-140 [EIP-210]: https://eips.ethereum.org/EIPS/eip-210 [EIP-1344]: https://eips.ethereum.org/EIPS/eip-1344 From d647aece488b23c27bf9d0e22e35d3fef98ec55a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 11 May 2019 13:30:08 +0100 Subject: [PATCH 3/5] Add EIP-2014 number and rename file --- EIPS/{eip-draft_extended_state_oracle.md => eip-2014.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename EIPS/{eip-draft_extended_state_oracle.md => eip-2014.md} (99%) diff --git a/EIPS/eip-draft_extended_state_oracle.md b/EIPS/eip-2014.md similarity index 99% rename from EIPS/eip-draft_extended_state_oracle.md rename to EIPS/eip-2014.md index 0a99e22cedfb0..e80b485819dcf 100644 --- a/EIPS/eip-draft_extended_state_oracle.md +++ b/EIPS/eip-2014.md @@ -1,5 +1,5 @@ --- -eip: +eip: 2014 title: Extended State Oracle author: Alex Beregszaszi (@axic) discussions-to: From f75940f668da9666a53f15eabc7d57a1d54fbaf9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 11 May 2019 13:39:38 +0100 Subject: [PATCH 4/5] Add reference to EIP-1959 and EIP-1965 --- EIPS/eip-2014.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/EIPS/eip-2014.md b/EIPS/eip-2014.md index e80b485819dcf..1644b2de11347 100644 --- a/EIPS/eip-2014.md +++ b/EIPS/eip-2014.md @@ -69,6 +69,8 @@ The contract ABI JSON is the following: This will be translated into sending the bytes `5cf0e8a4` to the ESO and returning the bytes `0000000000000000000000000000000000000000000000000000000000000001` for Ethereum mainnet. +**Note:** It should be possible to introduce another interface checking the validity of a chain identifier in the chain history or for a given block (see [EIP-1959] and [EIP-1965]). + ## Rationale @@ -88,3 +90,5 @@ Copyright and related rights waived via [CC0](https://creativecommons.org/public [EIP-140]: https://eips.ethereum.org/EIPS/eip-140 [EIP-210]: https://eips.ethereum.org/EIPS/eip-210 [EIP-1344]: https://eips.ethereum.org/EIPS/eip-1344 +[EIP-1959]: https://github.com/ethereum/EIPs/pull/1959 +[EIP-1965]: https://github.com/ethereum/EIPs/pull/1965 From 5e5fc56f66906620cd92418d09120e90619037cc Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 20 May 2019 12:47:55 +0100 Subject: [PATCH 5/5] Add discussions-to URL --- EIPS/eip-2014.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-2014.md b/EIPS/eip-2014.md index 1644b2de11347..95c88d908f0e8 100644 --- a/EIPS/eip-2014.md +++ b/EIPS/eip-2014.md @@ -2,7 +2,7 @@ eip: 2014 title: Extended State Oracle author: Alex Beregszaszi (@axic) -discussions-to: +discussions-to: https://ethereum-magicians.org/t/eip-2014-extended-state-oracle/3301 status: Draft type: Standards Track category: Core