Skip to content

Commit

Permalink
fix incorrect regular expressions for uint base types (#605)
Browse files Browse the repository at this point in the history
Closes #556

Note the slot parameter of eth_getStorageAt had to be relaxed to bytesMax32, since the
new uint256 pattern disallows leading zero, but usage of leading zero is commonplace
for storage slots.

---------

Co-authored-by: Felix Lange <[email protected]>
  • Loading branch information
PelleKrab and fjl authored Dec 18, 2024
1 parent 25a570c commit 28e82b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/eth/state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
- name: Storage slot
required: true
schema:
$ref: '#/components/schemas/uint256'
# this used to require strict uint256, but usage of leading zero is commonplace,
# so we can't disallow it.
$ref: '#/components/schemas/bytesMax32'
- name: Block
required: true
schema:
Expand Down
6 changes: 3 additions & 3 deletions src/schemas/base-types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ ratio:
uint:
title: hex encoded unsigned integer
type: string
pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
pattern: ^0x(0|[1-9a-f][0-9a-f]*)$
uint64:
title: hex encoded 64 bit unsigned integer
type: string
pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
pattern: ^0x(0|[1-9a-f][0-9a-f]{0,15})$
uint256:
title: hex encoded 256 bit unsigned integer
type: string
pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
pattern: ^0x(0|[1-9a-f][0-9a-f]{0,63})$
hash32:
title: 32 byte hex value
type: string
Expand Down

0 comments on commit 28e82b4

Please sign in to comment.