You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the test suite with --match "mutated", and with seed 998627727.
Expected behavior
The test suite will pass.
Actual behavior
We see the following error:
test/Codec/Binary/Bech32Spec.hs:185:9:1) Codec.Binary.Bech32, Decoding a corrupted string should fail, Decoding fails when a single character is mutated.***Failed! (after 36 tests and1 shrink):
expected:LeftStringToDecodeMissingSeparatorChar
but got:Left (StringToDecodeContainsInvalidChars [CharPosition2]), expected:Left (StringToDecodeContainsInvalidChars[])
but got:Left (StringToDecodeContainsInvalidChars [CharPosition2]), expected:Left (StringToDecodeContainsInvalidChars [CharPosition5])
but got:Left (StringToDecodeContainsInvalidChars [CharPosition2])
ValidBech32String {getValidBech32String ="h1?ac10m7flkn0aked", humanReadablePart =HumanReadablePart"h1?ac", unencodedDataPart =DataPart"0m7flk"}
DataChar {getDataChar ='q'}
index of mutated char:5
original char:'1'
replacement char:'q'
original string:"h1?ac10m7flkn0aked"
corrupted string:"h1?acq0m7flkn0aked"
Superficially, this appears to be related to the location detection code.
Resolution Plan
Figure out why this particular example is failing.
Either fix the test case (if our expectations were invalid), or fix the code (if it's doing the wrong thing).
Mutation now only occurs in the data part to avoid accidentally mutating the separator. This still checks the main properties we want for the bech32 encoding since, errors in the human-readable part are very unlikely (would still be caught though, but it's harder to instrument in the test suite).
This particular failure appears to occur because the separator character was replaced by a different character. This then causes the decoder to treat the earlier1 as a separator character. The decoder correctly rejects the new string, but with an error that was different from what the test case was expecting.
Recommendation: change the test case to make it just check for isLeft, for the moment.
At a later date, we can do something cleverer, by treating the following mutations differently:
a mutation of the HRP
a mutation of the data part
a mutation of the separator
(Or we might decide that the location detection logic is too much trouble, and just go for a simpler set of errors.)
Context
https://travis-ci.org/input-output-hk/cardano-wallet/jobs/538075040
Steps to Reproduce
Run the test suite with
--match "mutated"
, and with seed 998627727.Expected behavior
The test suite will pass.
Actual behavior
We see the following error:
Superficially, this appears to be related to the location detection code.
Resolution Plan
PR
master
QA
Cf: https://github.com/input-output-hk/cardano-wallet/blob/master/lib/bech32/test/Codec/Binary/Bech32Spec.hs#L127-L132
The text was updated successfully, but these errors were encountered: