-
Notifications
You must be signed in to change notification settings - Fork 711
Refactor TxDecoder
#7334
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
Merged
Merged
Refactor TxDecoder
#7334
Changes from 107 commits
Commits
Show all changes
125 commits
Select commit
Hold shift + click to select a range
3bd4a8d
Define Optimism Deposit transaction
emlautarom1 f46bf79
Cleanup existing `TxDecoder`
emlautarom1 ed2bbab
Missing assignment
emlautarom1 6ed28c8
Renaming
emlautarom1 f1ca0f5
Individual tx decoders
emlautarom1 6432a36
Remove intermediate interface
emlautarom1 d2499e9
Implement `AbstractTxDecoder`
emlautarom1 2716de6
Implement `AbstractTxDecoder`
emlautarom1 9bc577f
Implement `AbstractTxDecoder`
emlautarom1 03d2826
Implement `AbstractTxDecoder`
emlautarom1 4b3b3e7
Remove unused code
emlautarom1 c6bb66f
Implement `AbstractTxDecoder`
emlautarom1 57da69d
Add `Encode` to API
emlautarom1 be62cc0
Implement `Encode`
emlautarom1 5cf9633
Implement `Encode`
emlautarom1 502b313
Implement `Encode`
emlautarom1 1a38696
Implement `Encode`
emlautarom1 89045c7
Implement `Encode`
emlautarom1 0966cfa
Implement `Encode`
emlautarom1 fa51ef6
Reduce interface signature
emlautarom1 8f9188c
Remove encode dead code
emlautarom1 5d14c62
Add `GetLength` to API
emlautarom1 288de2c
Base `TxDecoder` implementing `IRlpStreamDecoder<Transaction>`
emlautarom1 5ce978b
Remove unused imports
emlautarom1 380eca9
Add `IRlpValueDecoder<Transaction>` impl
emlautarom1 16284c3
Implement ref `Decode`
emlautarom1 3904d06
Remove redundant code
emlautarom1 806830f
Implement `ref Decode`
emlautarom1 45bf28b
Remove unused code
emlautarom1 fabdcf0
Renaming
emlautarom1 fc9246a
Implement `ref Decode`
emlautarom1 93123d5
Implement `ref Decode`
emlautarom1 7aef17e
Implement `ref Decode`
emlautarom1 0f7dd60
Code cleanup
emlautarom1 bd9f0cf
Add `Rlp Encode(...)`
emlautarom1 39fd942
Add `SignatureBuilder`
emlautarom1 bb91078
Remove duplicated code
emlautarom1 85032e4
To file scoped namespace
emlautarom1 57cc72f
Remove `Rlp Encode(...)` method
emlautarom1 7e5ecd0
Reduce type switches
emlautarom1 da8d5fb
Refactor code
emlautarom1 fb2d5e2
Remove unused code
emlautarom1 0c0cf74
Simplify content length calculation
emlautarom1 afde273
Simplify content length calculation
emlautarom1 0f04a96
Remove unused method
emlautarom1 33c8515
Internal method renaming
emlautarom1 e90e628
Formatting
emlautarom1 9dffba1
Code refactor
emlautarom1 e7e89a8
Add `Rlp EncodeTx(...)`
emlautarom1 d266e3a
Implement `Rlp EncodeTx(...)` in all
emlautarom1 734ad27
Use primary constructor parameter
emlautarom1 cffa123
Make nullable parameter
emlautarom1 d875802
Make primary constructor
emlautarom1 ab76d62
Add overload to `Encode`
emlautarom1 143e84d
Make singleton instances static
emlautarom1 9a45130
Add default RlpBehaviors
emlautarom1 a1ea7e0
Fix infinite recursion
emlautarom1 55503ed
Remove unused params
emlautarom1 967c9ad
Default to legacy
emlautarom1 48fefeb
Add TODO regarding Legacy check
emlautarom1 fda0ae3
Fix incorrect type check
emlautarom1 e6b9f7b
Remove DepositTransaction subtype
emlautarom1 c47fc90
Fix incorrect conditional merge
emlautarom1 1e4eb4e
Formatting
emlautarom1 e28018a
Automated refactor and code cleanup
emlautarom1 be9e489
Starting from scratch
emlautarom1 4363a6e
Inline `DecodeTxTypeAndGetSequence`
emlautarom1 7534a39
Cleanup flag checking
emlautarom1 544bdc4
Reorder public methods
emlautarom1 fba000d
Reorder TxType initialization in `ref Decode`
emlautarom1 5875eb3
Add `ref Decode` method to `ITxDecoder` interface
emlautarom1 5780c19
Implement `ref Decode`
emlautarom1 7f5e34e
Dispatch to appropriate `ITxDecoder` in `ref Decode`
emlautarom1 5dcc43a
Remove unused code
emlautarom1 3c136cd
Add `EncodeTx` to `ITxDecoder`
emlautarom1 18b0ef5
Implement `EncodeTx`
emlautarom1 9a0069a
Dispatch `EncodeTx` to appropriate `ITxDecoder`
emlautarom1 f118008
Remove invalid `TxType` test
emlautarom1 44a84ae
Remove unused code
emlautarom1 e99d627
Add `int GetLength` to `ITxDecoder`
emlautarom1 c546250
Implement `int GetLength`
emlautarom1 ba65b9f
Dispatch to appropriate decoder
emlautarom1 972fdaa
Add `int GetTxLength` to `ITxDecoder`
emlautarom1 a4787a3
Implement `int GetTxLength`
emlautarom1 c58ae73
Dispatch to correct decoder
emlautarom1 63e95fe
Remove unused code
emlautarom1 4fbea8a
Merge `GetLength` and `GetTxLength`
emlautarom1 e42c558
Method rename
emlautarom1 ab78b21
Merge `GetLength` and `GetTxLength`
emlautarom1 9d0f35c
Method renaming
emlautarom1 08f7648
Param renaming
emlautarom1 f198b9c
Avoid infinite recursion
emlautarom1 dadec17
Remove default params
emlautarom1 99fd76a
Prefer `[]` instead of `TryGet`
emlautarom1 c5aead7
Renaming and parameter reordering
emlautarom1 22e5891
Param renaming
emlautarom1 18afa9b
Param and variable renaming and reordering
emlautarom1 1753ced
Param and var renaming and reordering
emlautarom1 e3a0941
Method and param renaming and reordering
emlautarom1 a72fa67
Method, param and var renaming and reordering
emlautarom1 4c1d0e1
Use `SignatureBuilder`
emlautarom1 6615d63
Use `SignatureBuilder`
emlautarom1 496bd1b
Remove redundant param
emlautarom1 f10fd4b
Remove const true
emlautarom1 0f9d0f0
Parametrize `new Transaction()`
emlautarom1 f29e0e6
Configure transaction factory
emlautarom1 faf37e4
Lift constant to interface
emlautarom1 f98acc6
Delete `TxFeature`
emlautarom1 6e83af8
Whitespace
emlautarom1 a6bfbb0
Delete old abstract class
emlautarom1 be50fda
Use the appropriate `TxType` directly
emlautarom1 402ce57
Whitespace
emlautarom1 fe87d31
Remove nullability
emlautarom1 4b48dc2
Merge branch 'master' into refactor/tx-decoder
emlautarom1 82d7b1f
Remove `lazyHash`
emlautarom1 04dd9ea
Remove `new` from `TxDecoder`
emlautarom1 acaf5a5
Merge branch 'master' into refactor/tx-decoder
emlautarom1 62a1e4e
Merge branch 'master' into refactor/tx-decoder
emlautarom1 87fdec0
Refactor decoders to class hierarchy (#7354)
LukaszRozmej 600b16a
Merge branch 'master' into refactor/tx-decoder
emlautarom1 4a92361
Remove const from interface
emlautarom1 3647549
Merge branch 'master' into refactor/tx-decoder
emlautarom1 1a60acd
Merge branch 'master' into refactor/tx-decoder
emlautarom1 19ed1f9
fix exceptions Rlpn unsupported tx type in rlp
LukaszRozmej 35175fa
better message
LukaszRozmej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| namespace Nethermind.Core; | ||
|
|
||
| public sealed class TxFeature | ||
| { | ||
| public static readonly TxFeature AccessList = new(); | ||
| public static readonly TxFeature EIP1559 = new(); | ||
| public static readonly TxFeature Blob = new(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Nethermind/Nethermind.Serialization.Rlp/MyTxDecoder/AbstractTxDecoder.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using System; | ||
| using Nethermind.Core; | ||
|
|
||
| namespace Nethermind.Serialization.Rlp.MyTxDecoder; | ||
|
|
||
| // NOTE: Due to requiring covariant return types we need to use `abstract class` instead of `interface` | ||
| public abstract class AbstractTxDecoder | ||
| { | ||
| // NOTE: Implementations can (and will) return more specific types than `Transaction` | ||
| public abstract Transaction Decode(Span<byte> transactionSequence, RlpStream rlpStream, RlpBehaviors rlpBehaviors); | ||
|
|
||
| public abstract Transaction Decode(int txSequenceStart, ReadOnlySpan<byte> transactionSequence, ref Rlp.ValueDecoderContext context, RlpBehaviors rlpBehaviors); | ||
|
|
||
| public abstract void Encode(Transaction? item, RlpStream stream, RlpBehaviors rlpBehaviors); | ||
|
|
||
| public abstract Rlp EncodeTx(Transaction? item, bool forSigning, bool isEip155Enabled, ulong chainId, RlpBehaviors rlpBehaviors); | ||
|
|
||
| public abstract int GetLength(Transaction item, RlpBehaviors rlpBehaviors); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.