Skip to content

Commit

Permalink
refactor sig check
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Oct 23, 2024
1 parent 5c98318 commit d3f2b8a
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ bool IsValidForExecution(
UInt256 s = new (authorizationTuple.AuthoritySignature.SAsSpan, isBigEndian: true);
if (authorizationTuple.Authority is null
|| s > Secp256K1Curve.HalfN
|| (authorizationTuple.AuthoritySignature.V > 28 && authorizationTuple.AuthoritySignature.V < 37))
//V minus the offset can only be 1 or 0 since eip-155 does not apply to Setcode signatures
|| (authorizationTuple.AuthoritySignature.V - Signature.VOffset > 1))
{
error = "Bad signature.";
return false;
}

if ((authorizationTuple.ChainId != 0
&& SpecProvider.ChainId != authorizationTuple.ChainId)
)
Expand All @@ -267,12 +269,6 @@ bool IsValidForExecution(
return false;
}

if (authorizationTuple.AuthoritySignature.ChainId is not null && authorizationTuple.AuthoritySignature.ChainId != authorizationTuple.ChainId)
{
error = "Bad signature.";
return false;
}

if (authorizationTuple.Nonce == ulong.MaxValue)
{
error = $"Nonce ({authorizationTuple.Nonce}) must be less than 2**64 - 1.";
Expand Down

0 comments on commit d3f2b8a

Please sign in to comment.