Skip to content

fix: skip cleanup transaction check for cheatcode deployments#399

Merged
MicaiahReid merged 1 commit intosolana-foundation:mainfrom
procdump:expected_deployment_tx_count_overflow_fix
Mar 19, 2026
Merged

fix: skip cleanup transaction check for cheatcode deployments#399
MicaiahReid merged 1 commit intosolana-foundation:mainfrom
procdump:expected_deployment_tx_count_overflow_fix

Conversation

@procdump
Copy link
Contributor

@procdump procdump commented Mar 13, 2026

The problem

  • Fix subtraction overflow in deploy_program.rs when instant_surfnet_deployment = true
  • The cheatcode path produces 1 transaction, but only_cleanup_transactions_remaining unconditionally subtracts get_cleanup_transactions_count() + 1 (= 4) from the transaction count, causing a panic
  • Cheatcode deployments have no cleanup transactions (get_cleanup_transactions returns vec![] when do_cheatcode_deploy is true), so the check is skipped entirely for that path

Reproduction

  1. Use in-memory runbooks with instant_surfnet_deployment = true (the default for surfpool start)
  2. Deploy a program built with debug (cargo-build-sbf --debug) → panic at deploy_program.rs:308 with "attempt to subtract with overflow"

@procdump
Copy link
Contributor Author

This PR came from my attempt to introduce --artifacts-path in surfpool - solana-foundation/surfpool#573

The `only_cleanup_transactions_remaining` subtraction overflows when
`instant_surfnet_deployment = true` because the cheatcode path produces
only 1 transaction, and the code unconditionally subtracts 4. Cheatcode
deployments return no cleanup transactions, so the check should not
apply to them.
@MicaiahReid MicaiahReid force-pushed the expected_deployment_tx_count_overflow_fix branch from 18aba4b to d9d53e5 Compare March 19, 2026 18:27
Copy link
Collaborator

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

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

Thanks, @procdump!

@MicaiahReid MicaiahReid merged commit bdd6d03 into solana-foundation:main Mar 19, 2026
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