There are many potential ways to deviate from the happy path e.g. addFunding is called with the wrong amount, custClose signature is invalid, a third party tries calling the contract, calling an entrypoint at the wrong time.
I'm not sure what the best way is to go about creating these tests. Is it enough to test each type of unhappy path once? e.g. Making sure that sp.verify(self.data.merchAddr == sp.sender) is sufficient at preventing any other account from calling that entrypoint? Or would we need a test case for every entrypoint to make sure it fails if someone other than the intended account calls it?
I'd be interested if there are any principled approaches or ideas for going about it. It may make sense to design these tests based on the zkchannels-spec for 'Tezos Escrow Agent Realization' (wip)
Right now we have tests that cover all of the happy paths in the zkchannels contract, but not the unhappy paths.
A high level description of the tests are here: https://github.com/boltlabs-inc/tezos-contract/blob/main/zkchannel_contract_tests.md It probably makes sense to use the Sandbox testing for the comprehensive testing with unhappy paths as it can run through the tests faster.
There are many potential ways to deviate from the happy path e.g.
addFunding
is called with the wrong amount,custClose
signature is invalid, a third party tries calling the contract, calling an entrypoint at the wrong time.I'm not sure what the best way is to go about creating these tests. Is it enough to test each type of unhappy path once? e.g. Making sure that
sp.verify(self.data.merchAddr == sp.sender)
is sufficient at preventing any other account from calling that entrypoint? Or would we need a test case for every entrypoint to make sure it fails if someone other than the intended account calls it?I'd be interested if there are any principled approaches or ideas for going about it. It may make sense to design these tests based on the zkchannels-spec for 'Tezos Escrow Agent Realization' (wip)