Skip to content

Commit

Permalink
encoder fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Sep 2, 2024
1 parent 215628a commit 3b8d8fa
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Core.Extensions;
using Nethermind.Int256;
using System;
using System.Diagnostics;
Expand Down Expand Up @@ -75,8 +76,8 @@ public void Encode(RlpStream stream, AuthorizationTuple item, RlpBehaviors rlpBe
stream.Encode(item.CodeAddress);
stream.Encode(item.Nonce);
stream.Encode(item.AuthoritySignature.RecoveryId);
stream.Encode(item.AuthoritySignature.R);
stream.Encode(item.AuthoritySignature.S);
stream.Encode(new UInt256(item.AuthoritySignature.R, true));
stream.Encode(new UInt256(item.AuthoritySignature.S, true));
}

public RlpStream EncodeWithoutSignature(ulong chainId, Address codeAddress, ulong nonce)
Expand All @@ -102,8 +103,8 @@ public void EncodeWithoutSignature(RlpStream stream, ulong chainId, Address code
private static int GetContentLength(AuthorizationTuple tuple) =>
GetContentLengthWithoutSig(tuple.ChainId, tuple.CodeAddress, tuple.Nonce)
+ Rlp.LengthOf(tuple.AuthoritySignature.RecoveryId)
+ Rlp.LengthOf(tuple.AuthoritySignature.R.AsSpan())
+ Rlp.LengthOf(tuple.AuthoritySignature.S.AsSpan());
+ Rlp.LengthOf(new UInt256(tuple.AuthoritySignature.R.AsSpan(), true))
+ Rlp.LengthOf(new UInt256(tuple.AuthoritySignature.S.AsSpan(), true));

private static int GetContentLengthWithoutSig(ulong chainId, Address codeAddress, ulong nonce) =>
Rlp.LengthOf(chainId)
Expand Down

0 comments on commit 3b8d8fa

Please sign in to comment.