@@ -74,11 +74,37 @@ pub use ssz_generic::*;
7474pub use ssz_static:: * ;
7575pub use transition:: TransitionTest ;
7676
77- #[ derive( Debug , PartialEq ) ]
77+ /// Used for running feature tests for future forks that have not yet been added to `ForkName`.
78+ /// This runs tests in the directory named by the feature instead of the fork name. This has been
79+ /// the pattern used in the `consensus-spec-tests` repository:
80+ /// `consensus-spec-tests/tests/general/[feature_name]/[runner_name].`
81+ /// e.g. consensus-spec-tests/tests/general/peerdas/ssz_static
82+ ///
83+ /// The feature tests can be run with one of the following methods:
84+ /// 1. `handler.run_for_feature(feature_name)` for new tests that are not on existing fork, i.e. a
85+ /// new handler. This will be temporary and the test will need to be updated to use
86+ /// `handle.run()` once the feature is incorporated into a fork.
87+ /// 2. `handler.run()` for tests that are already on existing forks, but with new test vectors for
88+ /// the feature. In this case the `handler.is_enabled_for_feature` will need to be implemented
89+ /// to return `true` for the feature in order for the feature test vector to be tested.
90+ #[ derive( Debug , PartialEq , Clone , Copy ) ]
7891pub enum FeatureName {
7992 Eip7594 ,
8093}
8194
95+ impl FeatureName {
96+ pub fn list_all ( ) -> Vec < FeatureName > {
97+ vec ! [ FeatureName :: Eip7594 ]
98+ }
99+
100+ /// `ForkName` to use when running the feature tests.
101+ pub fn fork_name ( & self ) -> ForkName {
102+ match self {
103+ FeatureName :: Eip7594 => ForkName :: Deneb ,
104+ }
105+ }
106+ }
107+
82108impl Display for FeatureName {
83109 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
84110 match self {
@@ -107,11 +133,13 @@ pub trait Case: Debug + Sync {
107133 true
108134 }
109135
110- /// Whether or not this test exists for the given `feature_name`.
136+ /// Whether or not this test exists for the given `feature_name`. This is intended to be used
137+ /// for features that have not been added to a fork yet, and there is usually a separate folder
138+ /// for the feature in the `consensus-spec-tests` repository.
111139 ///
112- /// Returns `true ` by default.
140+ /// Returns `false ` by default.
113141 fn is_enabled_for_feature ( _feature_name : FeatureName ) -> bool {
114- true
142+ false
115143 }
116144
117145 /// Execute a test and return the result.
0 commit comments