Skip to content

Commit e577619

Browse files
authored
use spec names for spec constants (#200)
1 parent 57a1daa commit e577619

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/test_json_marshalling.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ proc rand[T](_: type seq[T]): seq[T] =
8989
for i in 0..<3:
9090
result[i] = rand(T)
9191

92-
proc rand[T](_: type openArray[T]): array[cellsPerExternalBlob, T] =
93-
var a: array[cellsPerExternalBlob, T]
92+
proc rand[T](_: type openArray[T]): array[CELLS_PER_EXT_BLOB, T] =
93+
var a: array[CELLS_PER_EXT_BLOB, T]
9494
for i in 0..<a.len:
9595
a[i] = rand(T)
9696
a

web3/engine_api_types.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ type
134134

135135
BlobAndProofV2* = object
136136
blob*: Blob
137-
proofs*: array[cellsPerExternalBlob, KzgProof]
137+
proofs*: array[CELLS_PER_EXT_BLOB, KzgProof]
138138

139139
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
140140
# For optional withdrawals field, see:

web3/primitives.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export
2727

2828
const
2929
# https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/engine/cancun.md#blobsbundlev1
30-
fieldElementsPerBlob = 4096
30+
FIELD_ELEMENTS_PER_BLOB = 4096
3131

3232
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.4/specs/fulu/polynomial-commitments-sampling.md#cells
33-
cellsPerExternalBlob* = 128
33+
CELLS_PER_EXT_BLOB* = 128
3434

3535
type
3636
# https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/schemas/base-types.yaml
@@ -43,7 +43,7 @@ type
4343
# Quantity is use in lieu of an ordinary `uint64` to avoid the default
4444
# format that comes with json_serialization
4545

46-
Blob* = FixedBytes[fieldElementsPerBlob * 32]
46+
Blob* = FixedBytes[FIELD_ELEMENTS_PER_BLOB * 32]
4747

4848
template `==`*[minLen, maxLen](a, b: DynamicBytes[minLen, maxLen]): bool =
4949
distinctBase(a) == distinctBase(b)

0 commit comments

Comments
 (0)