Skip to content

Commit 6b226bb

Browse files
committed
test whether fixtures pass when strictly enforcing feature set
1 parent 61099a9 commit 6b226bb

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/flamenco/runtime/tests/fd_harness_common.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "../program/fd_program_cache.h"
22
#include "generated/context.pb.h"
3+
#include "fd_sol_compat.h"
34
#include <assert.h>
45

56
int
@@ -56,12 +57,33 @@ fd_runtime_fuzz_load_account( fd_txn_account_t * acc,
5657
int
5758
fd_runtime_fuzz_restore_features( fd_features_t * features,
5859
fd_exec_test_feature_set_t const * feature_set ) {
60+
sol_compat_features_t const * compat_features = sol_compat_get_features_v1();
5961
fd_features_disable_all( features );
6062
for( ulong j=0UL; j < feature_set->features_count; j++ ) {
6163
ulong prefix = feature_set->features[j];
6264
fd_feature_id_t const * id = fd_feature_id_query( prefix );
6365
if( FD_UNLIKELY( !id ) ) {
64-
FD_LOG_WARNING(( "unsupported feature ID 0x%016lx", prefix ));
66+
FD_LOG_WARNING(( "unknown feature ID 0x%016lx", prefix ));
67+
return 0;
68+
}
69+
/* Check if feature is in hardcoded_features or supported_features */
70+
int found = 0;
71+
for( ulong k=0UL; k < compat_features->hardcoded_features_cnt; k++ ) {
72+
if( compat_features->hardcoded_features[k] == prefix ) {
73+
found = 1;
74+
break;
75+
}
76+
}
77+
if( !found ) {
78+
for( ulong k=0UL; k < compat_features->supported_feature_cnt; k++ ) {
79+
if( compat_features->supported_features[k] == prefix ) {
80+
found = 1;
81+
break;
82+
}
83+
}
84+
}
85+
if( FD_UNLIKELY( !found ) ) {
86+
FD_LOG_WARNING(( "feature ID 0x%016lx not in hardcoded or supported features", prefix ));
6587
return 0;
6688
}
6789
/* Enabled since genesis */

0 commit comments

Comments
 (0)