Based on the approach @SyxtonPrime described.
In terms of columns, the changes are:
- Store inputs (`A`) as `u32` limbs, rather than individual bits.
- Remove `C_partial`. It was used to store an intermediate product in a 5-way xor, but we've since realized that we can do a 5-way xor directly.
- Add `C_prime`, an intermediate result used to help verify the relation between `A` and `A'`.
Some of the `%stack` operations are now trivial, but I kind of like keeping `%stack` since it serves as documentation as well, making comments about the stack unnecessary.
Again borrowing syntax from NASM. Example from the test:
%macro spin
%%start:
PUSH %%start
JUMP
%endmacro
One thing this lets us do is create "wrapper" macros which call a function, then return to the code immediately following the macro call, such as
%macro decode_rlp_scalar
%stack (pos) -> (pos, %%after)
%jump(decode_rlp_scalar)
%%after:
%endmacro
I used this to clean up `type_0.asm`.
However, since such macros need to insert `%%after` beneath any arguments in the stack, using them will be suboptimal in some cases. I wouldn't worry about it generally, but we might want to avoid them in performance-critical code, or functions with many arguments like `memcpy`.
- `GlobalMetadata` - offsets for global kernel variables in memory
- `ContextMetadata` - offsets for context-specific kernel variables in memory
- `GAS_CONSTANTS`, based on the yellowpaper
Also move constants to a separate module since `aggregator` was getting long.
I made a couple related changes to `Interpreter`:
- Only enforce the `JUMPDEST` rule if we're in kernel mode.
- Convenience methods for dealing with the RLP and txn field segments of memory.