Skip to content

Commit

Permalink
Hash bump
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck committed Aug 8, 2024
1 parent 3cefd7e commit 094486d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
17 changes: 0 additions & 17 deletions nimbus/db/aristo/aristo_desc/desc_identifiers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -397,23 +397,6 @@ func `$`*(vids: HashSet[VertexID]): string =
"$" & it.uint64.toHex.strip(trailing=false,chars={'0'})
).join(",") & "}"

func `$`*(key: Hash256): string =
let w = UInt256.fromBytesBE key.data
if w == high(UInt256):
"2^256-1"
elif w == 0.u256:
"0"
elif w == 2.u256.pow 255:
"2^255" # 800...
elif w == 2.u256.pow 254:
"2^254" # 400..
elif w == 2.u256.pow 253:
"2^253" # 200...
elif w == 2.u256.pow 251:
"2^252" # 100...
else:
w.toHex

func `$`*(key: HashKey): string =
toHex(key.data)

Expand Down
3 changes: 1 addition & 2 deletions nimbus/evm/stack.nim
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ template toStackElem(v: EvmStackInts, elem: EvmStackElement) =
template toStackElem(v: EthAddress, elem: EvmStackElement) =
elem.initFromBytesBE(v)

template toStackElem(v: MDigest, elem: EvmStackElement) =
template toStackElem(v: Hash256, elem: EvmStackElement) =
elem.initFromBytesBE(v.data)

template toStackElem(v: openArray[byte], elem: EvmStackElement) =
Expand Down Expand Up @@ -254,4 +254,3 @@ template unaryAddress*(stack: EvmStack, unOp): EvmResultVoid =
EvmResultVoid.ok()
else:
EvmResultVoid.err(stackErr(StackInsufficient))

6 changes: 3 additions & 3 deletions tests/replay/pp_light.nim
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func pp*(q: openArray[int]; itemsPerLine: int; lineSep: string): string =
.mapIt(it.mapIt(&"0x{it:02x}").join(", "))
.join("," & lineSep)

func pp*(a: MDigest[256]; collapse = true): string =
func pp*(a: Hash256; collapse = true): string =
if not collapse:
a.data.toHex
elif a == ZERO_HASH256:
Expand All @@ -136,7 +136,7 @@ func pp*(a: MDigest[256]; collapse = true): string =
else:
"£" & a.data.toHex.join[0..6] & ".." & a.data.toHex.join[56..63]

func pp*(a: openArray[MDigest[256]]; collapse = true): string =
func pp*(a: openArray[Hash256]; collapse = true): string =
"@[" & a.toSeq.mapIt(it.pp).join(" ") & "]"

func pp*(q: openArray[int]; itemsPerLine: int; indent: int): string =
Expand All @@ -146,7 +146,7 @@ func pp*(q: openArray[byte]; noHash = false): string =
if q.len == 32 and not noHash:
var a: array[32,byte]
for n in 0..31: a[n] = q[n]
MDigest[256](data: a).pp
Hash256(data: a).pp
else:
q.toHex.pp(hex = true)

Expand Down
2 changes: 1 addition & 1 deletion vendor/nim-eth

0 comments on commit 094486d

Please sign in to comment.