@@ -8,7 +8,7 @@ use std::{vec, vec::Vec};
8
8
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
9
9
#[ derive( Clone , Debug , Eq , PartialEq ) ]
10
10
#[ non_exhaustive]
11
- pub struct CfgEnv < SPEC : Into < SpecId > = SpecId > {
11
+ pub struct CfgEnv < SPEC = SpecId > {
12
12
/// Chain ID of the EVM
13
13
///
14
14
/// `chain_id` will be compared to the transaction's Chain ID.
@@ -77,7 +77,14 @@ pub struct CfgEnv<SPEC: Into<SpecId> = SpecId> {
77
77
pub disable_base_fee : bool ,
78
78
}
79
79
80
- impl < SPEC : Into < SpecId > > CfgEnv < SPEC > {
80
+ impl CfgEnv {
81
+ /// Creates new `CfgEnv` with default values.
82
+ pub fn new ( ) -> Self {
83
+ Self :: default ( )
84
+ }
85
+ }
86
+
87
+ impl < SPEC > CfgEnv < SPEC > {
81
88
pub fn with_chain_id ( mut self , chain_id : u64 ) -> Self {
82
89
self . chain_id = chain_id;
83
90
self
@@ -196,12 +203,12 @@ impl<SPEC: Into<SpecId> + Copy> Cfg for CfgEnv<SPEC> {
196
203
}
197
204
}
198
205
199
- impl Default for CfgEnv {
206
+ impl < SPEC : Default > Default for CfgEnv < SPEC > {
200
207
fn default ( ) -> Self {
201
208
Self {
202
209
chain_id : 1 ,
203
210
limit_contract_code_size : None ,
204
- spec : SpecId :: PRAGUE ,
211
+ spec : Default :: default ( ) ,
205
212
disable_nonce_check : false ,
206
213
blob_target_and_max_count : vec ! [ ( SpecId :: CANCUN , 3 , 6 ) , ( SpecId :: PRAGUE , 6 , 9 ) ] ,
207
214
#[ cfg( feature = "memory_limit" ) ]
@@ -226,7 +233,7 @@ mod test {
226
233
227
234
#[ test]
228
235
fn blob_max_and_target_count ( ) {
229
- let cfg = CfgEnv :: default ( ) ;
236
+ let cfg: CfgEnv = Default :: default ( ) ;
230
237
assert_eq ! ( cfg. blob_max_count( SpecId :: BERLIN ) , ( 6 ) ) ;
231
238
assert_eq ! ( cfg. blob_max_count( SpecId :: CANCUN ) , ( 6 ) ) ;
232
239
assert_eq ! ( cfg. blob_max_count( SpecId :: PRAGUE ) , ( 9 ) ) ;
0 commit comments