-
Notifications
You must be signed in to change notification settings - Fork 7
Conversation
src/DB.hs
Outdated
let hashFromMetadata = B16.encode $ Crypto.digest (Proxy :: Proxy Crypto.Blake2b_256) $ (encodeUtf8 poolEncodedMetadata) | ||
|
||
when (hashFromMetadata /= poolHashBytestring) $ | ||
panic "TxMetadataHashMismatch" |
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.
I get from this line that poolHash
is actually not the pool id but the hash of the metadata? This feels rather confusing with the name "poolHash"?
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.
A lot of things in this PR are confusing, will address that.
src/Lib.hs
Outdated
putTextLn $ show poolHash | ||
return examplePoolOfflineMetadata | ||
fmap PoolMetadataWrapped $ either (\m -> panic $ renderLookupFail m) (\a -> a) <$> (dlGetPoolMetadataSimple dataLayer) poolHash |
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.
As a result, this returns a string which encodes a JSON object, and not a JSON object.
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.
Yes. Encoding it into a JSON object can change the JSON contents, and accordingly, the hash.
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.
Some additional notes:
- When a "unknown" hash is provided, the server doesn't reply at all (simply closes the connection) and this shows in the logs:
FatalError {fatalErrorMessage = "Tx metadata hash cbdfc4f21feb0a414b2b9471fa56b0ebd312825e63db776d68cc3fa0ca1f5aaa"}
Now returning the original JSON content on the correct hash (as agreed):
Returning the error structure (as agreed):
|
ca91f09
to
90615e9
Compare
A note that might be of use - the argument name was changed from
|
@jbgi This was merged so you can base deployment commit from |
https://jira.iohk.io/browse/CAD-779