Use static call and apparent value transfer for block reward contract code (#9603)
This commit is contained in:
		
							parent
							
								
									346594c406
								
							
						
					
					
						commit
						4c2301fdf6
					
				@ -44,7 +44,7 @@ use self::epoch::PendingTransition;
 | 
			
		||||
 | 
			
		||||
use account_provider::AccountProvider;
 | 
			
		||||
use builtin::Builtin;
 | 
			
		||||
use vm::{EnvInfo, Schedule, CreateContractAddress};
 | 
			
		||||
use vm::{EnvInfo, Schedule, CreateContractAddress, CallType, ActionValue};
 | 
			
		||||
use error::Error;
 | 
			
		||||
use header::{Header, BlockNumber};
 | 
			
		||||
use snapshot::SnapshotComponents;
 | 
			
		||||
@ -163,8 +163,10 @@ pub fn default_system_or_code_call<'a>(machine: &'a ::machine::EthereumMachine,
 | 
			
		||||
					None,
 | 
			
		||||
					Some(code),
 | 
			
		||||
					Some(code_hash),
 | 
			
		||||
					Some(ActionValue::Apparent(U256::zero())),
 | 
			
		||||
					U256::max_value(),
 | 
			
		||||
					Some(data),
 | 
			
		||||
					Some(CallType::StaticCall),
 | 
			
		||||
				)
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
@ -135,8 +135,10 @@ impl EthereumMachine {
 | 
			
		||||
			Some(contract_address),
 | 
			
		||||
			code,
 | 
			
		||||
			code_hash,
 | 
			
		||||
			None,
 | 
			
		||||
			gas,
 | 
			
		||||
			data
 | 
			
		||||
			data,
 | 
			
		||||
			None,
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -149,8 +151,10 @@ impl EthereumMachine {
 | 
			
		||||
		contract_address: Option<Address>,
 | 
			
		||||
		code: Option<Arc<Vec<u8>>>,
 | 
			
		||||
		code_hash: Option<H256>,
 | 
			
		||||
		value: Option<ActionValue>,
 | 
			
		||||
		gas: U256,
 | 
			
		||||
		data: Option<Vec<u8>>
 | 
			
		||||
		data: Option<Vec<u8>>,
 | 
			
		||||
		call_type: Option<CallType>,
 | 
			
		||||
	) -> Result<Vec<u8>, Error> {
 | 
			
		||||
		let env_info = {
 | 
			
		||||
			let mut env_info = block.env_info();
 | 
			
		||||
@ -167,11 +171,11 @@ impl EthereumMachine {
 | 
			
		||||
			origin: SYSTEM_ADDRESS,
 | 
			
		||||
			gas,
 | 
			
		||||
			gas_price: 0.into(),
 | 
			
		||||
			value: ActionValue::Transfer(0.into()),
 | 
			
		||||
			value: value.unwrap_or(ActionValue::Transfer(0.into())),
 | 
			
		||||
			code,
 | 
			
		||||
			code_hash,
 | 
			
		||||
			data,
 | 
			
		||||
			call_type: CallType::Call,
 | 
			
		||||
			call_type: call_type.unwrap_or(CallType::Call),
 | 
			
		||||
			params_type: ParamsType::Separate,
 | 
			
		||||
		};
 | 
			
		||||
		let schedule = self.schedule(env_info.number);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user