Skip to content
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

feat: vm.JumpTable override #30

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

feat: vm.JumpTable override #30

wants to merge 22 commits into from

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Sep 17, 2024

Why this should be merged

Allows for creation of unexported vm.operations and their injection into vm.JumpTables through a registered hook.

First step to full support of #22.

How this works

Introduces vm.Hooks that can be registered via vm.RegisterHooks(). These are far simpler than params hooks as they don't need payloads. The vm.Hooks.OverrideJumpTable() hook is used in both NewEVMInterpreter() and LookupInstructionSet() to modify their respective JumpTables after creation. This couldn't be defined on params.RulesHooks due to a circular dependency.

The vm.OperationBuilder factory is also introduced to allow creation of the otherwise unexported operation type. I chose this pattern over a function because it makes arguments clearer at the usage site. To provide access to internal identifiers, the custom OperationFunc is an extension of the regular executionFunc to also accept an OperationEnvironment (similar to a PrecompileEnvironment).

How this was tested

Integration tests that demonstrate (a) honouring of the params hook signal; and (b) proper execution of a newly created *operation.

@ARR4N ARR4N marked this pull request as ready for review September 17, 2024 20:34
@ARR4N ARR4N requested review from a team, darioush, ceyonur and michaelkaplan13 and removed request for a team September 17, 2024 20:43
@ARR4N ARR4N marked this pull request as draft September 18, 2024 14:03
@ARR4N ARR4N marked this pull request as ready for review September 18, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant