-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix - FailedVerification and Closed tombstones
#419
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
Changes from all commits
e3a2609
cde499b
d6612ae
edf358a
e6be8a8
4ccd1dc
c1af5b5
fd971ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,11 +63,11 @@ pub trait ForkGraph { | |
| /// Actual payload of [LoadedProgram]. | ||
| #[derive(Default)] | ||
| pub enum LoadedProgramType { | ||
| /// Tombstone for programs which did not pass the verifier. | ||
| /// | ||
| /// These can potentially come back alive if the environment changes. | ||
| /// Tombstone for programs which currently do not pass the verifier but could if the feature set changed. | ||
| FailedVerification(ProgramRuntimeEnvironment), | ||
| /// Tombstone for programs which were explicitly undeployed / closed. | ||
| /// Tombstone for programs that were either explicitly closed or never deployed. | ||
| /// | ||
| /// It's also used for accounts belonging to program loaders, that don't actually contain program code (e.g. buffer accounts for LoaderV3 programs). | ||
| #[default] | ||
| Closed, | ||
| /// Tombstone for programs which have recently been modified but the new version is not visible yet. | ||
|
|
@@ -776,12 +776,17 @@ impl<FG: ForkGraph> ProgramCache<FG> { | |
| Ok(index) => { | ||
| let existing = slot_versions.get_mut(index).unwrap(); | ||
| match (&existing.program, &entry.program) { | ||
| // Add test for Closed => Loaded transition in same slot | ||
| (LoadedProgramType::Builtin(_), LoadedProgramType::Builtin(_)) | ||
| | (LoadedProgramType::Closed, LoadedProgramType::LegacyV0(_)) | ||
| | (LoadedProgramType::Closed, LoadedProgramType::LegacyV1(_)) | ||
| | (LoadedProgramType::Closed, LoadedProgramType::Typed(_)) | ||
| | (LoadedProgramType::Unloaded(_), LoadedProgramType::LegacyV0(_)) | ||
| | (LoadedProgramType::Unloaded(_), LoadedProgramType::LegacyV1(_)) | ||
| | (LoadedProgramType::Unloaded(_), LoadedProgramType::Typed(_)) => {} | ||
| #[cfg(test)] | ||
| (LoadedProgramType::Unloaded(_), LoadedProgramType::TestLoaded(_)) => {} | ||
| (LoadedProgramType::Closed, LoadedProgramType::TestLoaded(_)) | ||
| | (LoadedProgramType::Unloaded(_), LoadedProgramType::TestLoaded(_)) => {} | ||
| _ => { | ||
| // Something is wrong, I can feel it ... | ||
| error!("ProgramCache::assign_program() failed key={:?} existing={:?} entry={:?}", key, slot_versions, entry); | ||
|
|
@@ -1680,7 +1685,6 @@ mod tests { | |
| #[test_matrix( | ||
| ( | ||
| LoadedProgramType::FailedVerification(Arc::new(BuiltinProgram::new_mock())), | ||
| LoadedProgramType::Closed, | ||
| LoadedProgramType::TestLoaded(Arc::new(BuiltinProgram::new_mock())), | ||
| ), | ||
| ( | ||
|
|
@@ -1692,7 +1696,10 @@ mod tests { | |
| ) | ||
| )] | ||
| #[test_matrix( | ||
| (LoadedProgramType::Unloaded(Arc::new(BuiltinProgram::new_mock())),), | ||
| ( | ||
| LoadedProgramType::Closed, | ||
| LoadedProgramType::Unloaded(Arc::new(BuiltinProgram::new_mock())), | ||
| ), | ||
| ( | ||
| LoadedProgramType::FailedVerification(Arc::new(BuiltinProgram::new_mock())), | ||
| LoadedProgramType::Closed, | ||
|
|
@@ -1739,6 +1746,10 @@ mod tests { | |
| ); | ||
| } | ||
|
|
||
| #[test_case( | ||
| LoadedProgramType::Closed, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a FIXME here that says we need to test the missing Closed => Legacy cases?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI does not like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. worst CI ever |
||
| LoadedProgramType::TestLoaded(Arc::new(BuiltinProgram::new_mock())) | ||
| )] | ||
| #[test_case( | ||
| LoadedProgramType::Unloaded(Arc::new(BuiltinProgram::new_mock())), | ||
| LoadedProgramType::TestLoaded(Arc::new(BuiltinProgram::new_mock())) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find all other transitions pretty straightforward, but this Closed => xxx
is not obvious. It would be good to add a comment that explains when it happens
(on deploy) and why