-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: lukasz.rozmej <[email protected]> Co-authored-by: Ben Adams <[email protected]>
- Loading branch information
1 parent
27c18db
commit d9f88cd
Showing
21 changed files
with
108 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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
47 changes: 47 additions & 0 deletions
47
src/Nethermind/Nethermind.Optimism.Test/RlpDecoderTests.cs
This file contains 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,47 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using FluentAssertions; | ||
using Nethermind.Core; | ||
using Nethermind.Core.Test.Builders; | ||
using Nethermind.Serialization.Rlp; | ||
using NUnit.Framework; | ||
|
||
namespace Nethermind.Optimism.Test; | ||
|
||
public class RlpDecoderTests | ||
{ | ||
[Test] | ||
public void Can_decode_non_null_Transaction() | ||
{ | ||
TxDecoder decoder = TxDecoder.Instance; | ||
decoder.RegisterDecoder(new OptimismTxDecoder<Transaction>()); | ||
|
||
Transaction tx = Build.A.Transaction.WithType(TxType.DepositTx).TestObject; | ||
|
||
RlpStream rlpStream = new(decoder.GetLength(tx, RlpBehaviors.None)); | ||
decoder.Encode(rlpStream, tx); | ||
rlpStream.Reset(); | ||
|
||
Transaction? decodedTx = decoder.Decode(rlpStream); | ||
|
||
decodedTx.Should().NotBeNull(); | ||
} | ||
|
||
[Test] | ||
public void Can_decode_non_null_Transaction_through_Rlp() | ||
{ | ||
TxDecoder decoder = TxDecoder.Instance; | ||
decoder.RegisterDecoder(new OptimismTxDecoder<Transaction>()); | ||
|
||
Transaction tx = Build.A.Transaction.WithType(TxType.DepositTx).TestObject; | ||
|
||
RlpStream rlpStream = new(decoder.GetLength(tx, RlpBehaviors.None)); | ||
decoder.Encode(rlpStream, tx); | ||
rlpStream.Reset(); | ||
|
||
Transaction? decodedTx = Rlp.Decode<Transaction?>(rlpStream); | ||
|
||
decodedTx.Should().NotBeNull(); | ||
} | ||
} |
This file contains 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 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 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 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
Oops, something went wrong.