-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
becc381
commit 11a3f0b
Showing
4 changed files
with
46 additions
and
1 deletion.
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
39 changes: 39 additions & 0 deletions
39
src/Nethermind/Nethermind.Optimism/OptimismLegacyTxDecoder.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,39 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using System; | ||
using Nethermind.Core; | ||
using Nethermind.Core.Crypto; | ||
using Nethermind.Core.Specs; | ||
using Nethermind.Serialization.Rlp; | ||
using Nethermind.Serialization.Rlp.TxDecoders; | ||
using Nethermind.TxPool; | ||
|
||
namespace Nethermind.Optimism; | ||
|
||
public class OptimismLegacyTxDecoder : LegacyTxDecoder<Transaction> | ||
{ | ||
protected override Signature? DecodeSignature(ulong v, ReadOnlySpan<byte> rBytes, ReadOnlySpan<byte> sBytes, Signature? fallbackSignature = null, | ||
RlpBehaviors rlpBehaviors = RlpBehaviors.None) | ||
{ | ||
if (v == 0 && rBytes.IsEmpty && sBytes.IsEmpty) | ||
{ | ||
return null; | ||
} | ||
return base.DecodeSignature(v, rBytes, sBytes, fallbackSignature, rlpBehaviors); | ||
} | ||
} | ||
|
||
public class OptimismLegacyTxValidator : ITxValidator | ||
{ | ||
public ValidationResult IsWellFormed(Transaction transaction, IReleaseSpec releaseSpec) | ||
{ | ||
// In op bedrock eip1559 activated with bedrock | ||
if (releaseSpec.IsEip1559Enabled) | ||
{ | ||
return transaction.Signature is null ? new ValidationResult("Empty signature") : ValidationResult.Success; | ||
} | ||
|
||
return ValidationResult.Success; | ||
} | ||
} |
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