Inspiration
There have been various projects where I've wanted to be able to run arbitrary Ethereum code within a smart contract, especially when dealing with interesting techniques, such as Wisps and a variety of Proxy contracts.
The idea of writing an EVM in EVM started as a joke, but then useful use cases started cropping up, and it's been stirring around in my head every once and a while, but without a good excuse to build it... So, perfect hackathon fodder. :)
What it does
It's like the "eval" command in JavaScript. It lets you provide bytecode
and calldata
, which it then executes, returning the computed result.
How I built it
100% Pure Assembly. It's ridiculous. It's frustrating. It's painful. But oddly rewarding and fun.
No human should be writing assembly.
Challenges I ran into
Another reason I wanted to do this now, was I recently wrote an EVM assembler, and wanted to build a large-is scale project in it to test it out.
The main challenge was the number of non-trivial bugs in the actual assembler. The assembler is much better as a result of this project, if nothing else comes of it. :)
Accomplishments that I'm proud of
It works! All opcodes do their thing and it can, on-chain, execute contracts which are not on-chain.
What I learned
There is always those random little things you learn when you suffer so much. I learned how much I miss having useful debugging tools, like console.log
. Also that writing in assembly is always more time consuming than you think it will be, even if you think it will be really time-consuming.
What's next for Lurch
There is a list of todos, for sure.
- I want a generic hook contract, which will also be evaluated through Lurch (so recursion is needed). This will make it very simple to do some very weird, cool and potentially dangerous things
- Optimize the jump table. Hackathon, time-constraints, yadda yadda. Basically, by using a better multi-tier jump table, a lot of the instructions (especially
PUSH
) will have their additional overhead reduced by at least aJUMP
(8 gas). - Incorporate it with the Long-Lived Wisp project
Built With
- etherem
- evm
Log in or sign up for Devpost to join the conversation.