Skip to content

Commit

Permalink
Add draft for data encoding of REVERT
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Feb 6, 2017
1 parent 92529c5 commit 0b46c8e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions EIPS/eip-draft_revert_data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Preamble

EIP: <to be assigned>
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 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/).

0 comments on commit 0b46c8e

Please sign in to comment.