-
Notifications
You must be signed in to change notification settings - Fork 434
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
Refactoring of Optimism Plugin #7313
Comments
A first complication is the existence of Optimism-specific fields in the base nethermind/src/Nethermind/Nethermind.Core/Transaction.cs Lines 31 to 37 in 6beafee
I think that we can just push these fields to a subclass, but I haven't had the time to look into this yet. The main challenge of the current design is in
Depending on the nethermind/src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs Lines 76 to 94 in 6beafee
As mentioned in the ticket, we want to support additional transaction types which are not defined in Nethermind itself, but can be defined in plugins. Thus, the current design of using an This requirements forces us to look for some kind of runtime dispatch and I think our options are as follows:
In any case, we need to be able to know at runtime all possible transaction types in order to properly decode transactions. For example, if we read a For this, I think our options are as follow:
Then, we need to decide on how to pass this collection of instances, either by manually threading some kind of "registry" (actually, a parser from There is precedent for both approaches in the codebase:
|
After discussing it with the team, we'll take this opportunity to perform a bigger refactor by completely separating different transaction into their own types. As a rough sketch, we would like to construct a Currently we have 5 transactions encoded in the system: Since new transactions can be added by plugins, we'll construct a "registry" during initialization where different transactions can be registered (NOTE: we believe manual registration is a better approach over automatic discovery through reflection). This registry will be globally accessible to all code that requires it, and it's up to discussion how we want to provide this access. On this note, different access mechanism will have an impact on how much we need to refactor the existing test suite. Lastly, we want to ensure that only valid transactions will be processed by the client based on information provided by Starting with separating the |
Is your feature request related to a problem? Please describe.
Currently, Nethermind supports Optimism through its plugin mechanism, though certain Optimism specific behaviors and constants are defined in Nethermind itself, resulting in severe coupling.
Describe the solution you'd like
Ideally, supporting for Optimism should not rely on having Optimism-specific classes/constants/behaviors. Note that this in turn requires Nethermind to adjust it's plugin mechanism to support injecting these components.
Describe alternatives you've considered
Do nothing and continue working with the current implementation. Continuing with the existing implementation implies no risk of introducing new bugs but will increase the long term maintenance cost when (not if) we introduce support for new chains (ex. Taiko).
Additional context
The text was updated successfully, but these errors were encountered: