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

staking: verifying staker's signature over slashing tx #56

Merged
merged 9 commits into from
Sep 9, 2024

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Sep 5, 2024

Part of #7

This PR adds verifications on staker's signature over the slashing tx in BTC delegation requests. This includes:

  • replacing rust secp256k1 with k256 for verifying Schnorr signatures and key pairs. This prevents bloating wasm binary size
  • adding an assertion ensuring the full validation version of btc staking contract is less than 1 MB. This checks whether rust-bitcoin stuff bloats the contract size or not.
  • verifying staker's Schnorr signature over its slashing tx in handle_btc_delegation (the version with full-validation feature)
  • fixing datagen to use 1st FP's secret key for generating pub rand commit and finality sig

Copy link
Contributor

@gusin13 gusin13 left a comment

Choose a reason for hiding this comment

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

Looks good!

keys.sort_by(|a, b| {
let a_serialized = a.serialize();
let b_serialized = b.serialize();
let a_serialized = a.to_bytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

whats difference in serialize and to_bytes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well k256's VerifyingKey does not have serialize() function but instead defines to_bytes()

@SebastianElvis SebastianElvis merged commit 21e3fc1 into main Sep 9, 2024
1 check passed
@SebastianElvis SebastianElvis deleted the btc-del-verify-sig branch September 9, 2024 02:33
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