evm-opcodes 0.3.1 → 0.3.2
raw patch · 2 files changed
+7/−25 lines, 2 files
Files
- README.md +6/−24
- evm-opcodes.cabal +1/−1
README.md view
@@ -8,13 +8,6 @@ This Haskell library provides opcode types for the Ethereum Virtual Machine (EVM). -The library has two purposes:-- - Provide interface between EVM-related libraries: Lower cost of interoperability.- - Provide easy access to labelled jumps. Labelled jumps are most useful when- generating EVM code, but actual EVM `jump` instructions pop the destination- address from the stack.- The library has one parameterised type, `Opcode' j` where `j` is the annotation for the jump-related instructions `JUMP`, `JUMPI` and `JUMPDEST`, and it has three concrete variants:@@ -27,24 +20,13 @@ positional jumps, and it has another function that translates those positional jumps into plain EVM opcodes where a constant is pushed before a jump is made. -## Library conventions--When the documentation refers to a lowercase opcode (e.g. `push1`), then that-means the EVM opcode. When the documentation instead refers to an uppercase-opcode (e.g. `PUSH`), then that refers to the Haskell data constructor.--While `dup1`-`dup16`, `swap1`-`swap16` and `log1`-`log4` were implemented using-the data constructors `DUP`, `SWAP` and `LOG` that are not ergonomic to use but-convenient for the library maintainer, pattern synonyms were made:-- - `DUP1`, `DUP2`, ..., `DUP16`- - `SWAP1`, `SWAP2`, ..., `SWAP16`- - `LOG1`, `LOG2`, `LOG3`, `LOG4`+The constant that is pushed depends on the position of `JUMPDEST` which depends+on the constant that is pushed, hence the need for fixpoint iteration. -When pushing a constant to the stack, EVM uses `push1`, `push2`, ..., `push32`-where the number 1-32 refers to how many bytes the constant occupies. Instead-of having 32 unique push commands, this library has a single `PUSH !Word256`-constructor that serializes to the right `push1`, `push2`, etc.+When pushing a constant to the stack, EVM uses `push0`, `push1`, `push2`, ...,+`push32` where the number 0-32 refers to how many bytes the constant occupies.+Instead of having 32 unique push commands, this library has a single `PUSH+!Word256` constructor that serializes to the right `push1`, `push2`, etc. ## Example
evm-opcodes.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: evm-opcodes-version: 0.3.1+version: 0.3.2 synopsis: Opcode types for Ethereum Virtual Machine (EVM) description: This library provides opcode types for the Ethereum Virtual Machine. category: Ethereum, Finance, Network