-
Notifications
You must be signed in to change notification settings - Fork 616
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
refactor: decouple EVMData from Inspector trait #456
Conversation
c67e9d4
to
5b6d110
Compare
I think this is the right approach, but I intend to make more breaking changes to the inspector as I would like to have opcode aware inspections ( as in hook to only specified opcodes, or add new opcodes). I am still not exactly sure how this would look like, it would need to be drop in replacement for current inspector trait, but it would be best to do all of this changes at once to minimize breaking versions. |
If you'd like, I'm more than happy to experiment with and give feedback on different API designs you have 🙂 Do you have a rough estimate for when you plan on incorporating this? |
I don't have any timeline but the idea is kinda broader and requires replacing the interpreter dispatching of opcodes, but i need to experiment a little with that. |
c773409
to
9fdf446
Compare
Hi @rakita. We'd like to include this in our release. Is there a chance of getting it in before a next (breaking) release of revm? |
9fdf446
to
19df2ba
Compare
Rebased to resolve conflicts |
19df2ba
to
f14e47a
Compare
af48dcf
to
f14e47a
Compare
This could be done inside Handler and EvmBuilder as it has a lot more control: #888 |
Currently, the
Inspector
trait has aDatabase
generic that imposes its lifetime constraints onto theInspector
. This would prohibit user-providedInspector
implementations from being used in async contexts as when theDatabase
implementation is using references, as lifetimes need to be'static
in async contexts.E.g.
The above example illustrates how the lifetimes imposed on the database bleed into the inspector. It is however impossible for a user to create a dynamic object with the lifetime constraints mentioned on the inspector's bounds.
This PR decouples the
Database
from theInspector
by using a strategy pattern: atrait EVMData<E>
that returns a&mut dyn Database<E>
NOTE: This is a breaking change to the existing public API