Skip to content

Commit acf2a2a

Browse files
authored
Merge pull request #148 from ewasm/bytes32-u256
EEI: Split u256 into bytes32+u256
2 parents ec7e053 + 9bce12e commit acf2a2a

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

eth_interface.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The Ethereum Environment Interface exposes the core Ethereum API to the ewasm en
66

77
We define the following Ethereum data types:
88
- `bytes`: an array of bytes with unrestricted length
9+
- `bytes32`: an array of 32 bytes
910
- `address`: an array of 20 bytes
1011
- `u128`: a 128 bit number, represented as a 16 bytes long little endian unsigned integer in memory
1112
- `u256`: a 256 bit number, represented as a 32 bytes long little endian unsigned integer in memory
@@ -72,7 +73,7 @@ Gets the hash of one of the 256 most recent complete blocks.
7273
**Parameters**
7374

7475
- `number` **i64** which block to load
75-
- `resultOffset` **i32ptr** the memory offset to load the hash into (`u256`)
76+
- `resultOffset` **i32ptr** the memory offset to load the hash into (`bytes32`)
7677

7778
**Returns**
7879

@@ -210,35 +211,35 @@ Store 256-bit a value in memory to persistent storage
210211

211212
**Parameters**
212213

213-
- `pathOffset` **i32ptr** the memory offset to load the path from (`u256`)
214-
- `valueOffset` **i32ptr** the memory offset to load the value from (`u256`)
214+
- `pathOffset` **i32ptr** the memory offset to load the path from (`bytes32`)
215+
- `valueOffset` **i32ptr** the memory offset to load the value from (`bytes32`)
215216

216217
**Returns**
217218

218219
*nothing*
219220

220221
**Trap conditions**
221222

222-
- load `u256` from memory at `pathOffset` results in out of bounds access,
223-
- load `u256` from memory at `valueOffset` results in out of bounds access.
223+
- load `bytes32` from memory at `pathOffset` results in out of bounds access,
224+
- load `bytes32` from memory at `valueOffset` results in out of bounds access.
224225

225226
## storageLoad
226227

227228
Loads a 256-bit a value to memory from persistent storage
228229

229230
**Parameters**
230231

231-
- `pathOffset` **i32ptr** the memory offset to load the path from (`u256`)
232-
- `resultOffset` **i32ptr** the memory offset to store the result at (`u256`)
232+
- `pathOffset` **i32ptr** the memory offset to load the path from (`bytes32`)
233+
- `resultOffset` **i32ptr** the memory offset to store the result at (`bytes32`)
233234

234235
**Returns**
235236

236237
*nothing*
237238

238239
**Trap conditions**
239240

240-
- load `u256` from memory at `pathOffset` results in out of bounds access,
241-
- store `u256` to memory at `resultOffset` results in out of bounds access.
241+
- load `bytes32` from memory at `pathOffset` results in out of bounds access,
242+
- store `bytes32` to memory at `resultOffset` results in out of bounds access.
242243

243244
## getCaller
244245

@@ -446,10 +447,10 @@ Creates a new log in the current environment
446447
- `dataOffset` **i32ptr** the memory offset to load data from (`bytes`)
447448
- `dataLength` **i32** the data length
448449
- `numberOfTopics` **i32** the number of topics following (0 to 4)
449-
- `topic1` **i32ptr** the memory offset to load topic1 from (`u256`)
450-
- `topic2` **i32ptr** the memory offset to load topic2 from (`u256`)
451-
- `topic3` **i32ptr** the memory offset to load topic3 from (`u256`)
452-
- `topic4` **i32ptr** the memory offset to load topic4 from (`u256`)
450+
- `topic1` **i32ptr** the memory offset to load topic1 from (`bytes32`)
451+
- `topic2` **i32ptr** the memory offset to load topic2 from (`bytes32`)
452+
- `topic3` **i32ptr** the memory offset to load topic3 from (`bytes32`)
453+
- `topic4` **i32ptr** the memory offset to load topic4 from (`bytes32`)
453454

454455
**Returns**
455456

@@ -459,10 +460,10 @@ Creates a new log in the current environment
459460

460461
- load `dataLength` number of bytes from memory at `dataOffset` results in out of bounds access,
461462
- `numberOfTopics` is greater than 4,
462-
- load `u256` from memory at `topic1` results in out of bounds access,
463-
- load `u256` from memory at `topic2` results in out of bounds access,
464-
- load `u256` from memory at `topic3` results in out of bounds access,
465-
- load `u256` from memory at `topic4` results in out of bounds access.
463+
- load `bytes32` from memory at `topic1` results in out of bounds access,
464+
- load `bytes32` from memory at `topic2` results in out of bounds access,
465+
- load `bytes32` from memory at `topic3` results in out of bounds access,
466+
- load `bytes32` from memory at `topic4` results in out of bounds access.
466467

467468
## getBlockNumber
468469

0 commit comments

Comments
 (0)