tbtc-v2 icon indicating copy to clipboard operation
tbtc-v2 copied to clipboard

Improve test vectors for BTCUtils.validateVout

Open pdyraga opened this issue 3 years ago • 2 comments

BTCUtils.validateVout should fail if the number of outputs supplied (prepended) by the user does not match the actual number of outputs included.

It looks that's covered here: https://github.com/keep-network/bitcoin-spv/blob/b6af83da200522fbbd7a28b4dfe30566f60bc723/testVectors.json#L757. The compactSize uint claims there are 0 outputs but actually there are two.

We should improve the test vector by clarifying in a comment what scenario is it covering and ideally, adding at least one more test vector for non-0 compactSize uint.

See https://github.com/keep-network/tbtc-v2/pull/106#discussion_r799462810

pdyraga avatar Feb 08 '22 15:02 pdyraga

Okay, so that I understand this card, do we want:

a) A PR against https://github.com/keep-network/bitcoin-spv and potentially a new release that adds more test data b) A PR against https://github.com/keep-network/tbtc-v2/ that adds a similar test as what we're doing in bitcoin-spv?

beaurancourt avatar Jun 02 '22 20:06 beaurancourt

I was thinking about A. I think at some point we should extract the functions we use and move them unchanged to tbtc-v2 repository. The work @eth-r works on for v2 relay, IMO should also land in tbtc-v2 repository (tbtc-v2/relay). The hustle with the feature branch https://github.com/keep-network/bitcoin-spv/tree/releases/mainnet/solidity/v3.4.0-solc-0.8 is too problematic.

pdyraga avatar Jun 02 '22 20:06 pdyraga