Hash bump
This commit is contained in:
parent
3cefd7ed38
commit
094486d0ce
|
@ -397,23 +397,6 @@ func `$`*(vids: HashSet[VertexID]): string =
|
||||||
"$" & it.uint64.toHex.strip(trailing=false,chars={'0'})
|
"$" & it.uint64.toHex.strip(trailing=false,chars={'0'})
|
||||||
).join(",") & "}"
|
).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 =
|
func `$`*(key: HashKey): string =
|
||||||
toHex(key.data)
|
toHex(key.data)
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ template toStackElem(v: EvmStackInts, elem: EvmStackElement) =
|
||||||
template toStackElem(v: EthAddress, elem: EvmStackElement) =
|
template toStackElem(v: EthAddress, elem: EvmStackElement) =
|
||||||
elem.initFromBytesBE(v)
|
elem.initFromBytesBE(v)
|
||||||
|
|
||||||
template toStackElem(v: MDigest, elem: EvmStackElement) =
|
template toStackElem(v: Hash256, elem: EvmStackElement) =
|
||||||
elem.initFromBytesBE(v.data)
|
elem.initFromBytesBE(v.data)
|
||||||
|
|
||||||
template toStackElem(v: openArray[byte], elem: EvmStackElement) =
|
template toStackElem(v: openArray[byte], elem: EvmStackElement) =
|
||||||
|
@ -254,4 +254,3 @@ template unaryAddress*(stack: EvmStack, unOp): EvmResultVoid =
|
||||||
EvmResultVoid.ok()
|
EvmResultVoid.ok()
|
||||||
else:
|
else:
|
||||||
EvmResultVoid.err(stackErr(StackInsufficient))
|
EvmResultVoid.err(stackErr(StackInsufficient))
|
||||||
|
|
|
@ -120,7 +120,7 @@ func pp*(q: openArray[int]; itemsPerLine: int; lineSep: string): string =
|
||||||
.mapIt(it.mapIt(&"0x{it:02x}").join(", "))
|
.mapIt(it.mapIt(&"0x{it:02x}").join(", "))
|
||||||
.join("," & lineSep)
|
.join("," & lineSep)
|
||||||
|
|
||||||
func pp*(a: MDigest[256]; collapse = true): string =
|
func pp*(a: Hash256; collapse = true): string =
|
||||||
if not collapse:
|
if not collapse:
|
||||||
a.data.toHex
|
a.data.toHex
|
||||||
elif a == ZERO_HASH256:
|
elif a == ZERO_HASH256:
|
||||||
|
@ -136,7 +136,7 @@ func pp*(a: MDigest[256]; collapse = true): string =
|
||||||
else:
|
else:
|
||||||
"£" & a.data.toHex.join[0..6] & ".." & a.data.toHex.join[56..63]
|
"£" & 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(" ") & "]"
|
"@[" & a.toSeq.mapIt(it.pp).join(" ") & "]"
|
||||||
|
|
||||||
func pp*(q: openArray[int]; itemsPerLine: int; indent: int): string =
|
func pp*(q: openArray[int]; itemsPerLine: int; indent: int): string =
|
||||||
|
@ -146,7 +146,7 @@ func pp*(q: openArray[byte]; noHash = false): string =
|
||||||
if q.len == 32 and not noHash:
|
if q.len == 32 and not noHash:
|
||||||
var a: array[32,byte]
|
var a: array[32,byte]
|
||||||
for n in 0..31: a[n] = q[n]
|
for n in 0..31: a[n] = q[n]
|
||||||
MDigest[256](data: a).pp
|
Hash256(data: a).pp
|
||||||
else:
|
else:
|
||||||
q.toHex.pp(hex = true)
|
q.toHex.pp(hex = true)
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ebfe63b9b6523a1823e4505f0972d81047a77cf5
|
Subproject commit 864d54467e09c08d62b508149e9184001a813363
|
Loading…
Reference in New Issue