|
1 | 1 | #include "../program/fd_program_cache.h" |
2 | 2 | #include "generated/context.pb.h" |
| 3 | +#include "fd_sol_compat.h" |
3 | 4 | #include <assert.h> |
4 | 5 |
|
5 | 6 | int |
@@ -56,12 +57,33 @@ fd_runtime_fuzz_load_account( fd_txn_account_t * acc, |
56 | 57 | int |
57 | 58 | fd_runtime_fuzz_restore_features( fd_features_t * features, |
58 | 59 | fd_exec_test_feature_set_t const * feature_set ) { |
| 60 | + sol_compat_features_t const * compat_features = sol_compat_get_features_v1(); |
59 | 61 | fd_features_disable_all( features ); |
60 | 62 | for( ulong j=0UL; j < feature_set->features_count; j++ ) { |
61 | 63 | ulong prefix = feature_set->features[j]; |
62 | 64 | fd_feature_id_t const * id = fd_feature_id_query( prefix ); |
63 | 65 | 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 )); |
65 | 87 | return 0; |
66 | 88 | } |
67 | 89 | /* Enabled since genesis */ |
|
0 commit comments