-
Notifications
You must be signed in to change notification settings - Fork 840
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 Transaction rlp encoding #7871
base: main
Are you sure you want to change the base?
Refactor Transaction rlp encoding #7871
Conversation
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
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.
Thanks, this will help future Daggerization
pooledTransactionEncoder = new PooledMainnetTransactionEncoder(); | ||
} | ||
|
||
protected static RlpRegistry getInstance() { |
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.
Why does this need to be a singleton? It's only usage is from the RlpProvider.
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.
The next pull request will extend the RLP service to allow plugins to register different transaction encoding and decoding objects, by either setting the instance or registering a factory.
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.
Can you test on mainnet with parallel transaction execution enabled ?
|
||
private RlpProvider() {} | ||
|
||
public static TransactionHandler transaction() { |
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.
I think a method in general should be in a form of action, like a verb, ex. getTransactionHandler. When reading the method without having the context, it is hard to know what the method is doing.
RlpRegistry.getInstance().getTransactionEncoder()); | ||
} | ||
|
||
public static TransactionHandler pooledTransaction() { |
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.
The same as above, getPooledTransactionHandler ?
PR Description
This pull request introduces refactoring to simplify the encoding and decoding of transactions by utilizing a new class
RlpProvider
. The changes replace the direct usage ofTransactionEncoder
andTransactionDecoder
with methods provided byRlpProvider
.Key updates include decoupling the encoding and decoding logic from the
Transaction
class itself, resulting in the removal of thereadFrom()
andwriteTo()
methods from theTransaction
class.Static calls for encoding and decoding have been replaced with calls to a singleton object, which can be configured to use different encoding classes if necessary. The next pull request will extend the RLP service to allow plugins to register different transaction encoding and decoding objects. This will enable networks with different RLP serialisation to replace the mainnet RLP serialisation.
Additionally, this pull request removes the encoding context from the transaction decoders/encoders to align them with other decoders. Some code cleanup was also performed by utilising the
encoded()
method of theTransaction
class.Key Changes:
Refactoring to use
RlpProvider
: ReplacedTransactionEncoder.encodeOpaqueBytes
andTransactionDecoder.decodeOpaqueBytes
withRlpProvider.transaction().encodeOpaqueBytes
andRlpProvider.transaction().decodeOpaqueBytes
respectively in various files.Decoupling from
Transaction
class: RemovedreadFrom()
andwriteTo()
methods from theTransaction
class.Singleton Object for Encoding/Decoding: Replaced static calls with calls to a singleton object, allowing for configurable encoding classes.
Code Cleanup: Utilized the
encoded()
method of theTransaction
class for cleaner code.Future Extensions:
Block
andBlockhead