-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core/vm/program: create evm programming utility #30725
base: master
Are you sure you want to change the base?
Conversation
I like this very much, I've been using |
As long as we're not promising API stability and are willing to massively iterate on this if needed, I'm happy about it. |
Yeah, definitely. We should make it explicit, though. I'll add some documentation to that effect |
lint failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally like this a lot.
In many cases, we have a need to create somewhat nontrivial bytecode. A recent example is the verkle statetests, where we want a
CREATE2
- op to create a contract, which can then be invoked, and when invoked does a selfdestruct-to-self.It is overkill to go full solidity, but it is also a bit tricky do assemble this by concatenating bytes. This PR takes an approach that I've been using in goevmlab for several years.
Using this utility, the case can be expressed as:
We have a lot of places in the codebase where we concatenate bytes, cast from
vm.OpCode
. If we use this approach, we can make those places a bit more maintainable/robust.WDYT?
Note: I could have just added a dependency to goevmlab
Program
. However, goevmlab depends on go-ethereum, and I'd rather just avoid the potential cycle problems.