py-evm
py-evm copied to clipboard
Remove `Opcode` class
What is wrong?
The evm.opcode.Opcode class is more overhead than should probably be standard for opcodes.
How can it be fixed
I've considered the following options.
- Write a more functional approach to the same thing.
- Embed gas consumption into the opcodes themselves.
I'm pretty sure that the functional approach will be loosely equivalent in terms of computational overhead. This suggests that going ahead and moving all of the gas consumption logic into the opcode functions themselves is the right approach.
For the few cases where the cost has changed from hard forks, I think we can parametrize the gas consumption as part of the function signature and then use functools.partial to set the appropriate default.