1515// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
1616
1717//! Cost schedule and other parameterisations for the EVM.
18+ use std:: collections:: HashMap ;
19+ use ethereum_types:: U256 ;
20+
21+ /// Definition of schedules that can be applied to a version.
22+ #[ derive( Debug ) ]
23+ pub enum VersionedSchedule {
24+ PWasm ,
25+ }
1826
1927/// Definition of the cost schedule and other parameterisations for the EVM.
28+ #[ derive( Debug ) ]
2029pub struct Schedule {
2130 /// Does it support exceptional failed code deposit
2231 pub exceptional_failed_code_deposit : bool ,
@@ -117,17 +126,22 @@ pub struct Schedule {
117126 pub have_bitwise_shifting : bool ,
118127 /// CHAINID opcode enabled.
119128 pub have_chain_id : bool ,
129+ /// SELFBALANCE opcode enabled.
130+ pub have_selfbalance : bool ,
120131 /// Kill basic accounts below this balance if touched.
121132 pub kill_dust : CleanDustMode ,
122133 /// Enable EIP-1283 rules
123134 pub eip1283 : bool ,
135+ /// Enable EIP-1706 rules
136+ pub eip1706 : bool ,
124137 /// VM execution does not increase null signed address nonce if this field is true.
125138 pub keep_unsigned_nonce : bool ,
126139 /// Wasm extra schedule settings, if wasm activated
127140 pub wasm : Option < WasmCosts > ,
128141}
129142
130143/// Wasm cost table
144+ #[ derive( Debug ) ]
131145pub struct WasmCosts {
132146 /// Default opcode cost
133147 pub regular : u32 ,
@@ -181,7 +195,7 @@ impl Default for WasmCosts {
181195}
182196
183197/// Dust accounts cleanup mode.
184- #[ derive( PartialEq , Eq ) ]
198+ #[ derive( Debug , PartialEq , Eq ) ]
185199pub enum CleanDustMode {
186200 /// Dust cleanup is disabled.
187201 Off ,
@@ -212,6 +226,7 @@ impl Schedule {
212226 have_return_data : false ,
213227 have_bitwise_shifting : false ,
214228 have_chain_id : false ,
229+ have_selfbalance : false ,
215230 have_extcodehash : false ,
216231 stack_limit : 1024 ,
217232 max_depth : 1024 ,
@@ -256,6 +271,7 @@ impl Schedule {
256271 have_static_call : false ,
257272 kill_dust : CleanDustMode :: Off ,
258273 eip1283 : false ,
274+ eip1706 : false ,
259275 keep_unsigned_nonce : false ,
260276 wasm : None ,
261277 }
@@ -281,8 +297,12 @@ impl Schedule {
281297 /// Schedule for the Istanbul fork of the Ethereum main net.
282298 pub fn new_istanbul ( ) -> Schedule {
283299 let mut schedule = Self :: new_constantinople ( ) ;
284- schedule. have_chain_id = true ;
285- schedule. tx_data_non_zero_gas = 16 ;
300+ schedule. have_chain_id = true ; // EIP 1344
301+ schedule. tx_data_non_zero_gas = 16 ; // EIP 2028
302+ schedule. sload_gas = 800 ; // EIP 1884
303+ schedule. balance_gas = 700 ; // EIP 1884
304+ schedule. extcodehash_gas = 700 ; // EIP 1884
305+ schedule. have_selfbalance = true ; // EIP 1884
286306 schedule
287307 }
288308
@@ -295,6 +315,7 @@ impl Schedule {
295315 have_return_data : false ,
296316 have_bitwise_shifting : false ,
297317 have_chain_id : false ,
318+ have_selfbalance : false ,
298319 have_extcodehash : false ,
299320 stack_limit : 1024 ,
300321 max_depth : 1024 ,
@@ -339,6 +360,7 @@ impl Schedule {
339360 have_static_call : false ,
340361 kill_dust : CleanDustMode :: Off ,
341362 eip1283 : false ,
363+ eip1706 : false ,
342364 keep_unsigned_nonce : false ,
343365 wasm : None ,
344366 }
0 commit comments