Skip to content

Commit

Permalink
Add back in validation for negative chainId
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Dudley <[email protected]>
  • Loading branch information
siladu committed Jan 14, 2025
1 parent 58f52fa commit 910ef3f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ public ChainIdDeserializer(final Class<?> vc) {
@Override
public BigInteger deserialize(final JsonParser jsonparser, final DeserializationContext context)
throws IOException {
return UInt256.fromHexString(jsonparser.getCodec().readValue(jsonparser, String.class))
.toBigInteger();
final var chainId =
UInt256.fromHexString(jsonparser.getCodec().readValue(jsonparser, String.class))
.toBigInteger();
if (chainId.signum() < 0) {
throw new IllegalArgumentException("Negative chain id: " + chainId);
}
return chainId;
}
}

0 comments on commit 910ef3f

Please sign in to comment.