Skip to content

Commit 85ca398

Browse files
committed
fix: refuse to process unsupported feature
1 parent 66bed19 commit 85ca398

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/utils/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ impl From<&proto::FeatureSet> for FeatureSet {
3535
let mut feature_set = FeatureSet::default();
3636
for id in &input.features {
3737
if let Some(pubkey) = INDEXED_FEATURES.get(id) {
38+
if !crate::SUPPORTED_FEATURES.contains(id)
39+
&& !crate::HARDCODED_FEATURES.contains(id)
40+
{
41+
panic!("Feature: ({}, {}) is not supported: ", pubkey, id);
42+
}
3843
feature_set.activate(pubkey, 0);
3944
}
4045
}
@@ -78,3 +83,13 @@ pub const fn pchash_inverse(hash: u32) -> u32 {
7883
x = x.wrapping_mul(0xdee13bb1);
7984
x
8085
}
86+
87+
#[test]
88+
#[should_panic(expected = "is not supported")]
89+
fn test_reject_unsupported_feature() {
90+
let unsupported_feature = feature_u64(&agave_feature_set::reenable_sbpf_v0_execution::id());
91+
let proto_features = proto::FeatureSet {
92+
features: vec![unsupported_feature],
93+
};
94+
let _ = FeatureSet::from(&proto_features);
95+
}

0 commit comments

Comments
 (0)