Closed katat closed 6 years ago
The hash and sign method was implemented based on what jens ivar told us in #4 If that no longer holds true we need to sit down and re-evaluate how to stay in sync with the contracts.
@jijordre clarified in slack that the hash in the smart contracts support both numbers and strings (bignumber style) as equal inputs, so the discrepancy between the signature.v
property in SDK and in the SC test code is insignificant when it comes to actually validating hashes.
That's good news. Thanks
The SDK seems to have a different hash function from the one expected in the smart contracts. The SDK hash an array of arguments, while the smart contract requires the hashing to be done in another way (hash of hash), please see: https://github.com/hubiinetwork/striim-contracts/blob/develop/test/mocks.js#L419
Therefore, the signature generated by the SDK failed to pass the genuine checks in the
startChallengeFromPayment
function on the smart contract.Also, the signature needs to be in the following format:
The
r
ands
properties need to be prefixed with0x
, otherwise it can't go through the ethers lib's contract object's input validator when calling the functions that accept the payment receipt as an argument.