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

Return error early if program is a tombstone #30940

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

pgarg66
Copy link
Contributor

@pgarg66 pgarg66 commented Mar 28, 2023

Problem

The program cache could contain a tombstone for a program (e.g. if it failed verification, or was closed). It's already detected early in accounts.rs. But it currently returns error from BPF loader. The check could be made early and error could be returned earlier in the processing pipeline.

Summary of Changes

Return early if the program cache contains a tombstone for the program.

Fixes #

@pgarg66 pgarg66 requested a review from Lichtso March 28, 2023 18:58
@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Merging #30940 (8e195ed) into master (bf986d6) will increase coverage by 0.0%.
The diff coverage is 87.6%.

@@           Coverage Diff            @@
##           master   #30940    +/-   ##
========================================
  Coverage    81.5%    81.5%            
========================================
  Files         727      727            
  Lines      205166   205442   +276     
========================================
+ Hits       167295   167542   +247     
- Misses      37871    37900    +29     

@Lichtso
Copy link
Contributor

Lichtso commented Mar 29, 2023

Currently CPI only fails if an execution is actually attempted. With this it would also fail if a transaction just references an invalid program, without using it. Thus, we need a feature gate: Either find an existing one (which was introduced in this version) to add it to or create a new one.

@pgarg66
Copy link
Contributor Author

pgarg66 commented Mar 29, 2023

Currently CPI only fails if an execution is actually attempted. With this it would also fail if a transaction just references an invalid program, without using it. Thus, we need a feature gate: Either find an existing one (which was introduced in this version) to add it to or create a new one.

That's a good point. I have added a feature gate on the check.

@pgarg66 pgarg66 merged commit bc44ac7 into solana-labs:master Mar 30, 2023
@pgarg66 pgarg66 deleted the tombstone-early-return branch March 30, 2023 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants