@@ -7,8 +7,8 @@ use num_rational::Ratio;
7
7
use num_traits:: One ;
8
8
9
9
use casper_types:: {
10
- account:: AccountHash , FeeHandling , ProtocolVersion , PublicKey , RefundHandling , SystemConfig ,
11
- TimeDiff , WasmConfig , DEFAULT_FEE_HANDLING , DEFAULT_MINIMUM_BID_AMOUNT ,
10
+ account:: AccountHash , FeeHandling , ProtocolVersion , PublicKey , RefundHandling , StorageCosts ,
11
+ SystemConfig , TimeDiff , WasmConfig , DEFAULT_FEE_HANDLING , DEFAULT_MINIMUM_BID_AMOUNT ,
12
12
DEFAULT_REFUND_HANDLING ,
13
13
} ;
14
14
@@ -86,6 +86,7 @@ pub struct EngineConfig {
86
86
pub ( crate ) fee_handling : FeeHandling ,
87
87
/// Compute auction rewards.
88
88
pub ( crate ) compute_rewards : bool ,
89
+ storage_costs : StorageCosts ,
89
90
}
90
91
91
92
impl Default for EngineConfig {
@@ -108,6 +109,7 @@ impl Default for EngineConfig {
108
109
fee_handling : DEFAULT_FEE_HANDLING ,
109
110
compute_rewards : DEFAULT_COMPUTE_REWARDS ,
110
111
protocol_version : DEFAULT_PROTOCOL_VERSION ,
112
+ storage_costs : Default :: default ( ) ,
111
113
}
112
114
}
113
115
}
@@ -198,6 +200,11 @@ impl EngineConfig {
198
200
self . fee_handling
199
201
}
200
202
203
+ /// Returns the engine config's storage_costs.
204
+ pub fn storage_costs ( & self ) -> & StorageCosts {
205
+ & self . storage_costs
206
+ }
207
+
201
208
/// Returns the engine config's compute rewards flag.
202
209
pub fn compute_rewards ( & self ) -> bool {
203
210
self . compute_rewards
@@ -215,7 +222,7 @@ impl EngineConfig {
215
222
/// Sets the `wasm_config.max_memory` to `new_value`.
216
223
#[ cfg( feature = "test-support" ) ]
217
224
pub fn set_max_memory ( & mut self , new_value : u32 ) {
218
- self . wasm_config . max_memory = new_value;
225
+ * self . wasm_config . v1_mut ( ) . max_memory_mut ( ) = new_value;
219
226
}
220
227
}
221
228
@@ -244,6 +251,7 @@ pub struct EngineConfigBuilder {
244
251
fee_handling : Option < FeeHandling > ,
245
252
compute_rewards : Option < bool > ,
246
253
balance_hold_interval : Option < TimeDiff > ,
254
+ storage_costs : Option < StorageCosts > ,
247
255
}
248
256
249
257
impl EngineConfigBuilder {
@@ -312,7 +320,7 @@ impl EngineConfigBuilder {
312
320
/// Sets the maximum wasm stack height config option.
313
321
pub fn with_wasm_max_stack_height ( mut self , wasm_stack_height : u32 ) -> Self {
314
322
let wasm_config = self . wasm_config . get_or_insert_with ( WasmConfig :: default) ;
315
- wasm_config. max_stack_height = wasm_stack_height;
323
+ * wasm_config. v1_mut ( ) . max_stack_height_mut ( ) = wasm_stack_height;
316
324
self
317
325
}
318
326
@@ -391,6 +399,12 @@ impl EngineConfigBuilder {
391
399
self
392
400
}
393
401
402
+ /// Sets the storage_costs config option.
403
+ pub fn with_storage_costs ( mut self , storage_costs : StorageCosts ) -> Self {
404
+ self . storage_costs = Some ( storage_costs) ;
405
+ self
406
+ }
407
+
394
408
/// Builds a new [`EngineConfig`] object.
395
409
pub fn build ( self ) -> EngineConfig {
396
410
let max_associated_keys = self
@@ -437,6 +451,7 @@ impl EngineConfigBuilder {
437
451
. max_delegators_per_validator
438
452
. unwrap_or ( DEFAULT_MAX_DELEGATORS_PER_VALIDATOR ) ;
439
453
let compute_rewards = self . compute_rewards . unwrap_or ( DEFAULT_COMPUTE_REWARDS ) ;
454
+ let storage_costs = self . storage_costs . unwrap_or_default ( ) ;
440
455
441
456
EngineConfig {
442
457
max_associated_keys,
@@ -456,6 +471,7 @@ impl EngineConfigBuilder {
456
471
vesting_schedule_period_millis,
457
472
max_delegators_per_validator,
458
473
compute_rewards,
474
+ storage_costs,
459
475
}
460
476
}
461
477
}
0 commit comments