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

SVM: add check for check results length mismatch #3259

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

buffalojoec
Copy link

Problem

Currently, if a consumer of the SVM API provides a check_results parameter that is not the same length as the provided sanitized_txs, a truncation issue can arise.

This is less of an issue if check_results is longer than sanitized_txs, but if it's shorter, then the provided list of transactions will actually be truncated, causing only a subset of them to be processed via SVM.

We should have a check to help users avoid this footgun.

Summary of Changes

Provide a check that will panic if the lengths of check_results and sanitized_txs are not the same.

Note: I'm not sure if a panic is the best approach or not, but I did use debug_assert!. I felt like this didn't quite make sense to be a transaction error, since it's batch-wide, so I went with the pattern I saw in other parts of SVM and program-runtime. Open to alternate suggestions.

@buffalojoec buffalojoec requested a review from LucasSte October 22, 2024 12:03
@buffalojoec buffalojoec marked this pull request as ready for review October 22, 2024 12:03
@buffalojoec buffalojoec requested a review from pgarg66 October 22, 2024 12:12
@buffalojoec buffalojoec merged commit a2d20e5 into anza-xyz:master Oct 22, 2024
40 checks passed
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
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.

3 participants