Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

[bug] vote account should be initialized to modern schema upon starting solana-test-validator in 1.16 #33517

Closed
steveluscher opened this issue Oct 4, 2023 · 1 comment · Fixed by #33518
Assignees
Labels
bug Something isn't working

Comments

@steveluscher
Copy link
Contributor

Problem

I found the source of a pesky race condition in the web3.js tests. The tests assert the result of getProgramAccounts on accounts belonging to the vote program. One of those is the test validator's own vote account.

If the web3.js test's run soon enough after validator startup, the vote account will be the old 1.14 size (3731 bytes) instead of the new size (3762 bytes) and the test will fail. This is because the test validator creates a 1.14 vote account, and only upgrades it the first time that it has reason to update the vote state.

Proposed Solution

When starting a 1.16 test validator, create a modern vote account from the get-go.

@steveluscher steveluscher added the bug Something isn't working label Oct 4, 2023
@steveluscher steveluscher changed the title [bug] VoteState should be initialized to modern schema upon starting solana-test-validator in 1.16 [bug] vote account should be initialized to modern schema upon starting solana-test-validator in 1.16 Oct 4, 2023
@steveluscher
Copy link
Contributor Author

Yep.

// In all cases, initializing with the 1_14_11 version of VoteState is safest, as this version will in-place upgrade

let mut vote_account = AccountSharedData::new(lamports, VoteState1_14_11::size_of(), &id());

Can we change this? If not, can we change this just where the test validator is concerned?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants