Skip to content

Commit

Permalink
EEI: Specify signness
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast authored and axic committed Oct 7, 2018
1 parent 69c7806 commit 297701e
Showing 1 changed file with 70 additions and 4 deletions.
74 changes: 70 additions & 4 deletions eth_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ We define the following Ethereum data types:
- `u256`: a 256 bit number, represented as a 32 bytes long little endian unsigned integer in memory

We also define the following WebAssembly data types:
- `i32`: same as `i32` in WebAssembly
- `i32ptr`: same as `i32` in WebAssembly, but treated as a pointer to a WebAssembly memory offset
- `i64`: same as `i64` in WebAssembly
- `i32`: the 32-bit signed integer type mapped to `i32` in WebAssembly,
- `i32ptr`: the 32-bit signed integer treated as an offset to the WebAssembly memory, mapped to `i32` in WebAssembly,
- `i64`: the 64-bit signed integer type mapped to `i64` in WebAssembly.

# API

Expand All @@ -29,6 +29,10 @@ Subtracts an amount to the gas counter

*nothing*

**Trap conditions**

- `amount` is negative.

## getAddress

Gets address of currently executing account and stores it in memory at the given
Expand All @@ -44,6 +48,7 @@ offset.

**Trap conditions**

- `resultOffset` is negative,
- store to memory at `resultOffset` results in out of bounds access.

## getExternalBalance
Expand All @@ -62,7 +67,9 @@ offset.

**Trap conditions**

- `addressOffset` is negative,
- load from memory at `addressOffset` results in out of bounds access,
- `resultOffset` is negative,
- store to memory at `resultOffset` results in out of bounds access.

## getBlockHash
Expand All @@ -82,6 +89,8 @@ Gets the hash of one of the 256 most recent complete blocks.

**Trap conditions**

- `number` is negative,
- `resultOffset` is negative,
- store to memory at `resultOffset` results in out of bounds access (also checked on failure).

## call
Expand All @@ -102,8 +111,13 @@ Sends a message with arbitrary data to a given address path

**Trap conditions**

- `gas` is negative,
- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access,
- `valueOffset` is negative,
- load `u128` from memory at `valueOffset` results in out of bounds access,
- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## callDataCopy
Expand All @@ -123,7 +137,10 @@ the input data passed with the message call instruction or transaction.

**Trap conditions**

- `length` is negative,
- `dataOffset` is negative,
- load `length` number of bytes from input data buffer at `dataOffset` results in out of bounds access,
- `resultOffset` is negative,
- store `length` number of bytes to memory at `resultOffset` results in out of bounds access.

## getCallDataSize
Expand Down Expand Up @@ -157,8 +174,13 @@ data passed with the message call instruction or transaction.

**Trap conditions**

- `gas` is negative,
- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access,
- `valueOffset` is negative,
- load `u128` from memory at `valueOffset` results in out of bounds access,
- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## callDelegate
Expand All @@ -179,7 +201,11 @@ persisting the current values for sender and value.

**Trap conditions**

- `gas` is negative,
- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access,
- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## callStatic
Expand All @@ -201,7 +227,11 @@ value.

**Trap conditions**

- `gas` is negative,
- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access,
- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## storageStore
Expand All @@ -219,7 +249,9 @@ Store 256-bit a value in memory to persistent storage

**Trap conditions**

- `pathOffset` is negative,
- load `u256` from memory at `pathOffset` results in out of bounds access,
- `valueOffset` is negative,
- load `u256` from memory at `valueOffset` results in out of bounds access.

## storageLoad
Expand All @@ -237,7 +269,9 @@ Loads a 256-bit a value to memory from persistent storage

**Trap conditions**

- `pathOffset` is negative,
- load `u256` from memory at `pathOffset` results in out of bounds access,
- `resultOffset` is negative,
- store `u256` to memory at `resultOffset` results in out of bounds access.

## getCaller
Expand All @@ -255,6 +289,7 @@ the address of the account that is directly responsible for this execution.

**Trap conditions**

- `resultOffset` is negative,
- store `address` to memory at `resultOffset` results in out of bounds access.

## getCallValue
Expand All @@ -272,6 +307,7 @@ this execution and loads it into memory at the given location.

**Trap conditions**

- `resultOffset` is negative,
- store `u128` to memory at `resultOffset` results in out of bounds access.

## codeCopy
Expand All @@ -290,7 +326,10 @@ Copies the code running in current environment to memory.

**Trap conditions**

- `length` is negative,
- `codeOffset` is negative,
- load `length` number of bytes from the current code buffer at `codeOffset` results in out of bounds access,
- `resultOffset` is negative,
- store `length` number of bytes to memory at `resultOffset` results in out of bounds access.

## getCodeSize
Expand Down Expand Up @@ -319,6 +358,7 @@ Gets the block’s beneficiary address and loads into memory.

**Trap conditions**

- `resultOffset` is negative,
- store `address` to memory at `resultOffset` results in out of bounds access.

## create
Expand All @@ -340,8 +380,12 @@ Creates a new contract with a given value.

**Trap conditions**

- `valueOffset` is negative,
- load `u128` from memory at `valueOffset` results in out of bounds access,
- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.
- `resultOffset` is negative,
- store `address` to memory at `resultOffset` results in out of bounds access.

## getBlockDifficulty
Expand All @@ -358,6 +402,7 @@ Get the block’s difficulty.

**Trap conditions**

- `resultOffset` is negative,
- store `u256` to memory at `resultOffset` results in out of bounds access.

## externalCodeCopy
Expand All @@ -377,8 +422,12 @@ Copies the code of an account to memory.

**Trap conditions**

- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access,
- `length` is negative,
- `codeOffset` is negative,
- load `length` number of bytes from the account code buffer at `codeOffset` results in out of bounds access,
- `resultOffset` is negative,
- store `length` number of bytes to memory at `resultOffset` results in out of bounds access.

## getExternalCodeSize
Expand All @@ -395,6 +444,7 @@ Get size of an account’s code.

**Trap conditions**

- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access.

## getGasLeft
Expand Down Expand Up @@ -435,6 +485,7 @@ Gets price of gas in current environment.

**Trap conditions**

- `resultOffset` is negative,
- store `u128` to memory at `resultOffset` results in out of bounds access.

## log
Expand All @@ -457,11 +508,17 @@ Creates a new log in the current environment

**Trap conditions**

- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access,
- `numberOfTopics` is greater than 4,
- `numberOfTopics` is negative or greater than 4,
- `topic1` is negative,
- load `u256` from memory at `topic1` results in out of bounds access,
- `topic2` is negative,
- load `u256` from memory at `topic2` results in out of bounds access,
- `topic3` is negative,
- load `u256` from memory at `topic3` results in out of bounds access,
- `topic4` is negative,
- load `u256` from memory at `topic4` results in out of bounds access.

## getBlockNumber
Expand Down Expand Up @@ -492,6 +549,7 @@ account with non-empty associated code.

**Trap conditions**

- `resultOffset` is negative,
- store `address` to memory at `resultOffset` results in out of bounds access.

## finish
Expand All @@ -509,6 +567,8 @@ Set the returning output data for the execution. This will cause a trap and the

**Trap conditions**

- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## revert
Expand All @@ -526,6 +586,8 @@ Set the returning output data for the execution. This will cause a trap and the

**Trap conditions**

- `dataLength` is negative,
- `dataOffset` is negative,
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access.

## getReturnDataSize
Expand Down Expand Up @@ -560,7 +622,10 @@ from last executed `call`, `callCode`, `callDelegate`, `callStatic` or `create`.

**Trap conditions**

- `length` is negative,
- `dataOffset` is negative,
- load `length` number of bytes from input data buffer at `dataOffset` results in out of bounds access,
- `resultOffset` is negative,
- store `length` number of bytes to memory at `resultOffset` results in out of bounds access.

*nothing*
Expand All @@ -580,6 +645,7 @@ beneficiary address. This will cause a trap and the execution will be aborted im

**Trap conditions**

- `addressOffset` is negative,
- load `address` from memory at `addressOffset` results in out of bounds access.

## getBlockTimestamp
Expand Down

0 comments on commit 297701e

Please sign in to comment.