From 0a3a694fe88ef4240516d615d3dbbb908de8ca33 Mon Sep 17 00:00:00 2001 From: Lukasz Rozmej Date: Tue, 12 Dec 2023 15:05:53 +0100 Subject: [PATCH] Skip signature only for TxType.DepositTx (#6349) Co-authored-by: Nikita Mescheryakov --- .../Nethermind.Serialization.Rlp/TxDecoder.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs b/src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs index 3c67f6bd0f0..1c408d3b6d0 100644 --- a/src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs +++ b/src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs @@ -162,10 +162,7 @@ static Span DecodeTxType(RlpStream rlpStream, int length, out TxType txTyp transactionSequence = DecodeTxType(rlpStream, rlpStream.ReadPrefixAndContentLength().ContentLength, out txType); } - return transactionSequence; - - } private static Hash256 CalculateHashForNetworkPayloadForm(TxType type, Span transactionSequence) @@ -521,10 +518,7 @@ private static void DecodeSignature( ulong v = rlpStream.DecodeULong(); ReadOnlySpan rBytes = rlpStream.DecodeByteArraySpan(); ReadOnlySpan sBytes = rlpStream.DecodeByteArraySpan(); - if (!(v == 0 && rBytes.IsEmpty && sBytes.IsEmpty)) - { - ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors); - } + ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors); } private static void DecodeSignature( @@ -535,10 +529,7 @@ private static void DecodeSignature( ulong v = decoderContext.DecodeULong(); ReadOnlySpan rBytes = decoderContext.DecodeByteArraySpan(); ReadOnlySpan sBytes = decoderContext.DecodeByteArraySpan(); - if (!(v == 0 && rBytes.IsEmpty && sBytes.IsEmpty)) - { - ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors); - } + ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors); } private static void ApplySignature( @@ -548,6 +539,8 @@ private static void ApplySignature( ReadOnlySpan sBytes, RlpBehaviors rlpBehaviors) { + if (transaction.Type == TxType.DepositTx && v == 0 && rBytes.IsEmpty && sBytes.IsEmpty) return; + bool allowUnsigned = (rlpBehaviors & RlpBehaviors.AllowUnsigned) == RlpBehaviors.AllowUnsigned; bool isSignatureOk = true; string signatureError = null;