File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -190,4 +190,25 @@ mod test {
190190 serde_yaml:: from_reader ( reader) . expect ( "error while deserializing" ) ;
191191 assert_eq ! ( ConfigAndPreset :: Gloas ( from) , yamlconfig) ;
192192 }
193+
194+ // This is not exhaustive, but it can be extended as new fields are added to the spec.
195+ #[ test]
196+ fn test_required_spec_fields_exist ( ) {
197+ let mainnet_spec = ChainSpec :: mainnet ( ) ;
198+ let config = ConfigAndPreset :: from_chain_spec :: < MainnetEthSpec > ( & mainnet_spec) ;
199+ let json = serde_json:: to_value ( & config) . expect ( "should serialize" ) ;
200+ let obj = json. as_object ( ) . expect ( "should be an object" ) ;
201+ let required_fields = [
202+ "SLOT_DURATION_MS" ,
203+ "PROPOSER_REORG_CUTOFF_BPS" ,
204+ "ATTESTATION_DUE_BPS" ,
205+ "AGGREGATE_DUE_BPS" ,
206+ "CONTRIBUTION_DUE_BPS" ,
207+ "SYNC_MESSAGE_DUE_BPS" ,
208+ ] ;
209+ for field in required_fields {
210+ assert ! ( obj. contains_key( field) , "Missing required field: {}" , field) ;
211+ }
212+ }
193213}
214+
You can’t perform that action at this time.
0 commit comments