From 4d965a2a1ea52822273a34d97f9d3c696573413c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 6 Feb 2017 21:51:44 +0000 Subject: [PATCH 1/4] Add draft for data encoding of REVERT --- EIPS/eip-draft_revert_data.md | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 EIPS/eip-draft_revert_data.md diff --git a/EIPS/eip-draft_revert_data.md b/EIPS/eip-draft_revert_data.md new file mode 100644 index 00000000000000..7221a21da03f62 --- /dev/null +++ b/EIPS/eip-draft_revert_data.md @@ -0,0 +1,48 @@ +## Preamble + + EIP: + Title: Data structure for the REVERT instruction + Author: Alex Beregszaszi + Type: Standard Track + Category: ERC + Status: Draft + Created: 2017-02-06 + Requires: (`REVERT` EIP) + +## Simple Summary + +Suggested data format for the return value of a `REVERT` instruction. + +## Abstract + +The `REVERT` instruction is able to abort execution, while retaining data to be returned to the caller. This specification defines a suggested format for encoding error messages to be used by this instruction. + +## Motivation + +The `REVERT` instruction provides a flexible way to return data. It would be beneficial to define a standardised format in order for clients to make use of this data. Clients, such as Mist, could display the error in a user friendly manner. + +Potentially in the future, the *Natural Language Specification* could be extended with a list of error codes for each function. + +## Specification + +The data to be returned via a `REVERT` instruction is defined as an array, in the following order, consisting of two fields: +- an unsigned number, containing an error code +- an optional UTF-8 encoded string, containing an error message + +This array is encoded using *CBOR* (RFC7049). + +## Rationale + +The reason CBOR is chosen over RLP is its ability to encode multiple data types and the availability of CBOR libraries in a multitude of languages. + +## Backwards Compatibility + +This change has no effect on contracts created in the past. + +## Test Cases + +TBA + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From 7df71dccc2a1a24332196a94112284a978e35392 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 6 Feb 2017 21:59:34 +0000 Subject: [PATCH 2/4] Include two test cases --- EIPS/eip-draft_revert_data.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-draft_revert_data.md b/EIPS/eip-draft_revert_data.md index 7221a21da03f62..fb60bb13f1d790 100644 --- a/EIPS/eip-draft_revert_data.md +++ b/EIPS/eip-draft_revert_data.md @@ -41,7 +41,11 @@ This change has no effect on contracts created in the past. ## Test Cases -TBA +Valid: + +`[ 13 ]` -> `81 0d` + +`[ 42, "Invalid key"]` -> `82 18 2a 6b 496e76616c6964206b6579` ## Copyright From d1c37c237b0a6622e4b00918b6d657fdeb17d4b7 Mon Sep 17 00:00:00 2001 From: Nick Savers Date: Fri, 8 Mar 2019 18:33:38 +0100 Subject: [PATCH 3/4] Update eip-draft_revert_data.md Update to new formatting standard --- EIPS/eip-draft_revert_data.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/EIPS/eip-draft_revert_data.md b/EIPS/eip-draft_revert_data.md index fb60bb13f1d790..c8fc543b63216d 100644 --- a/EIPS/eip-draft_revert_data.md +++ b/EIPS/eip-draft_revert_data.md @@ -1,13 +1,14 @@ -## Preamble - - EIP: - Title: Data structure for the REVERT instruction - Author: Alex Beregszaszi - Type: Standard Track - Category: ERC - Status: Draft - Created: 2017-02-06 - Requires: (`REVERT` EIP) +--- +eip: 207 +title: Data structure for the REVERT instruction +author: Alex Beregszaszi (@axic) +discussions-to: +type: Standards Track +category: ERC +status: Draft +created: 2017-02-06 +requires: 140 +--- ## Simple Summary From 44ba0124c40f0bde6e1a35c5475d85e09b2aabe4 Mon Sep 17 00:00:00 2001 From: Nick Savers Date: Fri, 8 Mar 2019 18:33:50 +0100 Subject: [PATCH 4/4] Rename eip-draft_revert_data.md to eip-207.md --- EIPS/{eip-draft_revert_data.md => eip-207.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename EIPS/{eip-draft_revert_data.md => eip-207.md} (100%) diff --git a/EIPS/eip-draft_revert_data.md b/EIPS/eip-207.md similarity index 100% rename from EIPS/eip-draft_revert_data.md rename to EIPS/eip-207.md