gerbil-ethereum
gerbil-ethereum copied to clipboard
General purpose instructions for bytes
Part of https://gitlab.com/mukn/glow/-/issues/80.
Features
Batch 1 (Merged: https://github.com/fare/gerbil-ethereum/pull/46)
- [x] Methods for known-size bytes
- [x] Compat with bytes larger than EVM Word
- [x] Store at free memory pointer
- [x] Load at free memory pointer
- [x] Push for large bytes
- [x] Unit tests
- [x] Integration tests
- [x] Invariant assertions
Batch 2 (WIP: https://github.com/fare/gerbil-ethereum/pull/50)
- [ ] Call by reference methods (by storing offset, length on stack)
- [ ] Static offset methods for load, store. Glow compiler uses
mstoreat
,mloadat
. - [ ] Support types with have variable sizes during runtime.
For example, given a
Bytestring
with aUInt64
length, during compile time we do not know the actual length / contents of the bytestring. instead we generate instructions to store the length: - on stack is just takes up a slot. - in memory it takes up 8bytes. And use it to decode the contents: - LOAD: Use the offset and length on stack to retrieve the entire bytestring from memory - STORE: Use length on stack to store bytestring in memory - [ ] memcpy
- [ ] Hashing
- [ ] calldataload, calldatacopy.
- [ ] Limit memory offset to 16/24 bytes due to gas limits, rather than 32.
Batch 3
- [ ] Integrate with existing EVM-Types - Extend? Create new types?
- [ ] Either use .box? directly to handle boxed / unboxed types
- [ ] or use it implicitly, with a general
.evm<-
method for marshalling data to EVM.
Batch 4
- [ ] Handle singletons.
- [ ] Benchmark gas for methods
- [ ] Support for marshalling? (further investigation needed)