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

Add test vectors for other implementations of scripts #648

Merged
merged 2 commits into from
May 21, 2024

Conversation

KonradStaniec
Copy link
Collaborator

Adding intial implementation of test vectors to test combatiblity between implementations of our scripts.

Added @SebastianElvis and @gbarkhatov as reviewers as they are working with rust and js implementation of our scripts.

Comment on lines +328 to +330
covenantKeys := generateKeys(t, numCovenantKeys)
finalityKeys := generateKeys(t, numFinalityKeys)
stakerKeys := generateKeys(t, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to make the test vector generation deterministic, such that everytime we run the test case we get the same vectors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point, I do not see a need to do that. This generator at this point is mostly a helper to avoid filling jsons manually.

Downstream consumers do not need to re-generate the testvectores themselves, they need to:

  • parse vectors.json file
  • build staking output/unbonding transaction/scripts based on parameters in this json
  • check whether locally built objects are the same as expected.

btcstaking/staking_testvectors_test.go Outdated Show resolved Hide resolved
btcstaking/staking_testvectors_test.go Outdated Show resolved Hide resolved
btcstaking/staking_testvectors_test.go Show resolved Hide resolved
return &cases
}

type Parameters struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not in this PR: do we want test vectors for Schnorr/adaptor signatures over staking/slashing/unbonding txs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will think about this, this is not that easy as schnorr sigs have this randomness parameter inside which means, we cannot just bytes equality for signatures, we can only check signature/adaptor validity. I wonder whether it is worth it.

This is definitely something for sparate pr to improve on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can only check signature/adaptor validity. I wonder whether it is worth it.

This is needed in BTC staking integration where the consumer side needs to verify the Schnorr/adaptor signatures over these txs received from Babylon. If the signatures are invalid then the consumer is supposed to reject the corresponding BTC delegation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm good point. Probably more imporant would be to test adaptor sigs verifcations, as verifing stand schnorr signatures is probably available in libraries in most languages. Created issue to track it- #653

@KonradStaniec KonradStaniec merged commit add420f into dev May 21, 2024
4 checks passed
@KonradStaniec KonradStaniec deleted the test-vectors-staking branch May 21, 2024 16:04
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.

2 participants