-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(rln-relay): bump zerokit and update ffi #1571
Conversation
fix(chat2): compilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
One little comment for the future :)
proc sha256*(data: openArray[byte]): MerkleNode = | ||
## a thin layer on top of the Nim wrapper of the sha256 hasher | ||
debug "sha256 hash input", hashhex = data.toHex() | ||
var lenPrefData = appendLength(data) | ||
var | ||
hashInputBuffer = lenPrefData.toBuffer() | ||
outputBuffer: Buffer # will holds the hash output | ||
|
||
debug "hash input buffer length", bufflen = hashInputBuffer.len | ||
debug "sha256 hash input buffer length", bufflen = hashInputBuffer.len | ||
let | ||
hashSuccess = hash(rlnInstance, addr hashInputBuffer, addr outputBuffer) | ||
hashSuccess = sha256(addr hashInputBuffer, addr outputBuffer) | ||
|
||
# check whether the hash call is done successfully | ||
if not hashSuccess: | ||
debug "error in hash" | ||
debug "error in sha256 hash" | ||
return default(MerkleNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Knowing that this is out of this PR's scope, I recommend revisiting the log levels within the module.
In this diff snippet, for example, the log level should be set to trace
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
Changes and optimizations included in zerokit's bump - vacp2p/zerokit@005393d...master
This included ffi changes -
Note that we've changed the proc name since it conflicted with hash() generated in
hashcommon.nim
(stdlib), and since it is more indicative of the underlying hash function.Required as a prerequisite to #1451