Skip to content

Add BLS Pubkey managerment to vote program.#9310

Merged
wen-coding merged 20 commits into
anza-xyz:masterfrom
wen-coding:implement_simd_387
Dec 20, 2025
Merged

Add BLS Pubkey managerment to vote program.#9310
wen-coding merged 20 commits into
anza-xyz:masterfrom
wen-coding:implement_simd_387

Conversation

@wen-coding
Copy link
Copy Markdown

@wen-coding wen-coding commented Nov 27, 2025

Per SIMD 387, add the following:

  • Add new init method using VoteInitV2
  • Add VoteAuthority::VoterWithBLS
  • Make them controlled by the new feature flag

@mergify
Copy link
Copy Markdown

mergify Bot commented Nov 27, 2025

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/kit (example)

Thank you for keeping the RPC clients in sync with the server API @wen-coding.

@mergify
Copy link
Copy Markdown

mergify Bot commented Nov 27, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

Comment thread programs/vote/src/vote_processor.rs
Comment thread programs/vote/src/vote_state/mod.rs
@wen-coding wen-coding changed the title Implement simd 387 (POC, please don't review for now) Add BLS Pubkey managerment to vote program. Dec 1, 2025
Comment thread cli/src/vote.rs
Comment thread ledger-tool/tests/basic.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs
Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/mod.rs Outdated
Comment thread programs/vote/src/vote_processor.rs
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Nice! This is getting really close.

Comment thread programs/vote/src/vote_state/handler.rs
Comment thread programs/vote/src/vote_state/handler.rs
Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_processor.rs
Comment thread programs/vote/src/vote_state/mod.rs Outdated
Comment thread programs/vote/src/vote_state/mod.rs Outdated
Comment thread programs/vote/src/vote_state/mod.rs
Copy link
Copy Markdown

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

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

Left some small comments, but looking good overall.

bls_proof_of_possession_compressed_bytes: &[u8; BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE],
) -> Result<(), InstructionError> {
let bls_pubkey_compressed = BLSPubkeyCompressed(*bls_pubkey_compressed_bytes);
let bls_pubkey = BLSPubkey::try_from(bls_pubkey_compressed)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new v2.0.0 interface, I'll make the function signature to also accept byte arrays directly, but we should technically still be able to call verify directly on compressed form, so we don't need extra conversion here and for proof of possession.

bls_proof_of_possession.verify(&bls_pubkey_compressed, Some(&message))

Comment thread programs/vote/src/vote_state/mod.rs Outdated
Comment thread programs/vote/src/vote_state/mod.rs
Comment thread programs/vote/src/vote_state/mod.rs
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Looking great! Test coverage looks good, but I left some suggestions on factoring the tests so we get even more coverage and we can also more clearly see what's going on.

The program side looks good from my end. Next we have to get the vote-interface release out and get this branch updated.

Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_processor.rs
Comment thread programs/vote/src/vote_processor.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs Outdated
@mergify
Copy link
Copy Markdown

mergify Bot commented Dec 13, 2025

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/kit (example)

Thank you for keeping the RPC clients in sync with the server API @wen-coding.

@wen-coding wen-coding requested a review from a team as a code owner December 15, 2025 22:09
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 99.31707% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.6%. Comparing base (bcaeadd) to head (ed37139).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #9310    +/-   ##
========================================
  Coverage    82.6%    82.6%            
========================================
  Files         902      902            
  Lines      323512   324444   +932     
========================================
+ Hits       267318   268261   +943     
+ Misses      56194    56183    -11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread gossip/src/epoch_slots.rs
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How did these changes end up here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Because it's the only way to make tests pass once we upgrade flate2, please review #9557 and I can then rebase.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we bump flate2 we need to check we are not breaking epochslots.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah definitely, even without flate2 risk, this change itself is dangerous enough, I probably should start test validator after the review goes through

Comment thread cli/src/vote.rs Outdated
let test_authorize_voter = if with_bls {
test_commands.clone().get_matches_from(vec![
"test",
"vote-authorize-voter-with-bls",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@samkim-crypto @zz-sol I'm a bit confused how to make things work here. I believe this one is for offline signing. In our case I'm doing BLS keypair derivation inside cli parser, so I always need the vote authority keypair passed in. How do we make offline signing work in this case? Is it:

  1. do vote-authorize-voter-with-bls with sign-only to generate the whole message encrypted
  2. So when this thing is called we should have BLS pubkey and PoP without the keypair online
    Does that mean I should somehow pass in the BLS pubkey and PoP?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@grod220 this is the part I'm not sure about. The ones with "--sign-only" should work, because I still have ed25519 vote authority keypair there, but how does this piece fit in the picture?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(paste from slack message)

I've done some offline signing CLI work in the past in the context of a multisig transaction. Step 1 was the offline --sign-only mode which output PUBKEY=SIGNATURE and Step 2 had the same parameters, but also with the multiple --signer PUBKEY=SIGNATURE args and broadcasted the tx.

If the tx message includes bls_pubkey and bls_proof_of_possession , but step 2 can't rebuild that same message---you need to pass those as optional args in step 2:

--bls-pubkey <base58>
--bls-proof-of-possession <base58>

And those computed values need to be an output of step 1.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks a lot! I fixed the authorized_voter_with_bls, making the new_authorized either pubkey or keypair, depending on whether --bls-pubkey or --bls-proof-of-possession are given.

Somehow I don't think we need similar structure (writing to output and pass in bls-pubkey/bls-proof-of-possession) for create-vote-account-v2, is that expected?

@buffalojoec buffalojoec self-requested a review December 17, 2025 05:56
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

It looks like there are a few things in-flight still (BLS SDK bump, CLI steps), so I just reviewed the Vote program.

Looking good! I left a few minor test requests, but overall the program implementation looks solid to me.

Comment thread ci/xtask/Cargo.lock
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How come these three ABI digests changed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think this is due to us linking in new solana-bls-signatures package. These messages aren't used in production yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

frozen-abi does not check for ABI, it checks for API compatibility in a very paranoid way. Wire format may not have changed at all here.
Our contributor @puhtaytow is working on getting these glitches separated from actual ABI changes. Stay tuned.

Comment thread programs/vote/src/vote_state/handler.rs Outdated
Comment thread programs/vote/src/vote_state/handler.rs
Comment thread programs/vote/src/vote_state/mod.rs
Comment thread programs/vote/src/vote_processor.rs Outdated
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Lgtm! The last piece is the BLS dependency and getting another sign-off from Sam about the PoP validation. Once that's all set, I'll approve.

@wen-coding
Copy link
Copy Markdown
Author

Lgtm! The last piece is the BLS dependency and getting another sign-off from Sam about the PoP validation. Once that's all set, I'll approve.

@samkim-crypto is on vacation. I chatted with @zz-sol :

  1. I don't believe there is any major work planned for 2.0.0, so this is just a release. Can this PR go in and in the follow up cli PR I change it to 2.0.0 after Sam releases that package?
  2. Zhenfei will help double check the PoP part once gain

BLSProofOfPossession::try_from(bls_proof_of_possession_compressed)
.map_err(|_| InstructionError::InvalidArgument)?;
let message = generate_pop_message(vote_account_pubkey, bls_pubkey_compressed_bytes);
if Ok(true) == bls_proof_of_possession.verify(&bls_pubkey, Some(&message)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep this can be simplified with the official release of bls-signatures v2.0, but the current version should be fine for this PR!

Copy link
Copy Markdown

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

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

Sorry for the delay on this. All the PoP and BLS parts look fine to me. When bls-signatures v2.0.0 is cut, I'll create a small PR to simplify some parts, but this shouldn't block this PR from merging (correctness will remain the same). Really great job @wen-coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants