From 2d3d450075866ff79146c0ced5fc2b24d4b835fe Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 12 May 2021 08:12:26 +0700 Subject: [PATCH] fixes `validateFixedLenHex` in graphql/ethapi.nim now it can detect too long hex besides padding too short hex --- nimbus/graphql/ethapi.nim | 3 +++ tests/graphql/queries.toml | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/nimbus/graphql/ethapi.nim b/nimbus/graphql/ethapi.nim index 8b9235191..fe3d91e79 100644 --- a/nimbus/graphql/ethapi.nim +++ b/nimbus/graphql/ethapi.nim @@ -350,6 +350,9 @@ proc validateFixedLenHex(x: Node, minLen: int, kind: string, padding = false): N [kind, $expectedLen, $x.stringVal.len]) else: padBytes(x, prefixLen, minLen * 2) + elif x.stringVal.len > expectedLen: + return err("$1 len is too long: expect $2 got $3" % + [kind, $expectedLen, $x.stringVal.len]) for i in prefixLen..