Skip to content
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

Strengthen the precondition for the Bech32 mixed-case mutation test. #340

Conversation

jonathanknowles
Copy link
Contributor

Issue Number

#339

Overview

It's possible to change the case of a given character of a Bech32 string and yet not produce a mixed-case string.

In such cases, we can't expect that the decode function will fail with a StringToDecodeHasMixedCase error.

  • To prevent the test failing, I have changed the precondition to actually check that the string is in mixed case.

Comments

It seems to be best to put a big lock around all operations which use
the SQLite connection.

I was getting the following failed test:

  λ> quickCheck (prop_parallel db)
  *** Failed! Exception: 'SQLite3 returned ErrorError while attempting to perform step: not an error' (after 5 tests and 3 shrinks):
  ParallelCommands
    { prefix = Commands { unCommands = [] }
    , suffixes =
        [ Pair
            { proj1 =
                Commands
                  { unCommands =
                      [ Command
                          (At (ReadTxHistory (Val (MWid "c"))))
                          (At (Resp (Right (TxHistory (fromList [])))))
                          []
                      ]
                  }
            , proj2 =
                Commands
                  { unCommands =
                      [ Command
                          (At (PutTxHistory (Val (MWid "a")) (fromList [])))
                          (At (Resp (Left (NoSuchWallet (Reference (Symbolic (Var 0)))))))
                          [ Var 0 ]
                      ]
                  }
            }
        ]
    }
Sqlite: add more locking to DBLayer methods
It's possible to change the case of a given character of a Bech32 string
and yet not produce a mixed-case string.

In such cases, we can't expect that the `decode` function will fail with
a `StringToDecodeHasMixedCase` error.

To prevent the test failing, we change the precondition to actually
check that the string is in mixed case.
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/bech32-fix-mixed-case-test branch from ce19693 to 15fbefb Compare May 29, 2019 08:54
@KtorZ KtorZ changed the base branch from master to jonathanknowles/bech32-fix-index-limits May 29, 2019 08:54
@KtorZ KtorZ merged commit 3b35767 into jonathanknowles/bech32-fix-index-limits May 29, 2019
@KtorZ KtorZ deleted the jonathanknowles/bech32-fix-mixed-case-test branch May 29, 2019 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants