mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: generic receipt ExecuteOutput (#12966)
This commit is contained in:
@ -160,7 +160,7 @@ where
|
|||||||
&mut self,
|
&mut self,
|
||||||
block: &BlockWithSenders,
|
block: &BlockWithSenders,
|
||||||
total_difficulty: U256,
|
total_difficulty: U256,
|
||||||
) -> Result<ExecuteOutput, Self::Error> {
|
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
|
||||||
let env = self.evm_env_for_block(&block.header, total_difficulty);
|
let env = self.evm_env_for_block(&block.header, total_difficulty);
|
||||||
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
|
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
|
||||||
|
|
||||||
|
|||||||
@ -599,14 +599,14 @@ mod tests {
|
|||||||
_chain_spec: Arc<ChainSpec>,
|
_chain_spec: Arc<ChainSpec>,
|
||||||
_evm_config: EvmConfig,
|
_evm_config: EvmConfig,
|
||||||
state: State<DB>,
|
state: State<DB>,
|
||||||
execute_transactions_result: ExecuteOutput,
|
execute_transactions_result: ExecuteOutput<Receipt>,
|
||||||
apply_post_execution_changes_result: Requests,
|
apply_post_execution_changes_result: Requests,
|
||||||
finish_result: BundleState,
|
finish_result: BundleState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct TestExecutorStrategyFactory {
|
struct TestExecutorStrategyFactory {
|
||||||
execute_transactions_result: ExecuteOutput,
|
execute_transactions_result: ExecuteOutput<Receipt>,
|
||||||
apply_post_execution_changes_result: Requests,
|
apply_post_execution_changes_result: Requests,
|
||||||
finish_result: BundleState,
|
finish_result: BundleState,
|
||||||
}
|
}
|
||||||
@ -659,7 +659,7 @@ mod tests {
|
|||||||
&mut self,
|
&mut self,
|
||||||
_block: &BlockWithSenders,
|
_block: &BlockWithSenders,
|
||||||
_total_difficulty: U256,
|
_total_difficulty: U256,
|
||||||
) -> Result<ExecuteOutput, Self::Error> {
|
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
|
||||||
Ok(self.execute_transactions_result.clone())
|
Ok(self.execute_transactions_result.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,8 +711,10 @@ mod tests {
|
|||||||
fn test_strategy() {
|
fn test_strategy() {
|
||||||
let expected_gas_used = 10;
|
let expected_gas_used = 10;
|
||||||
let expected_receipts = vec![Receipt::default()];
|
let expected_receipts = vec![Receipt::default()];
|
||||||
let expected_execute_transactions_result =
|
let expected_execute_transactions_result = ExecuteOutput::<Receipt> {
|
||||||
ExecuteOutput { receipts: expected_receipts.clone(), gas_used: expected_gas_used };
|
receipts: expected_receipts.clone(),
|
||||||
|
gas_used: expected_gas_used,
|
||||||
|
};
|
||||||
let expected_apply_post_execution_changes_result = Requests::new(vec![bytes!("deadbeef")]);
|
let expected_apply_post_execution_changes_result = Requests::new(vec![bytes!("deadbeef")]);
|
||||||
let expected_finish_result = BundleState::default();
|
let expected_finish_result = BundleState::default();
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,7 @@ where
|
|||||||
&mut self,
|
&mut self,
|
||||||
block: &BlockWithSenders,
|
block: &BlockWithSenders,
|
||||||
total_difficulty: U256,
|
total_difficulty: U256,
|
||||||
) -> Result<ExecuteOutput, Self::Error> {
|
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
|
||||||
let env = self.evm_env_for_block(&block.header, total_difficulty);
|
let env = self.evm_env_for_block(&block.header, total_difficulty);
|
||||||
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
|
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ where
|
|||||||
&mut self,
|
&mut self,
|
||||||
_block: &BlockWithSenders,
|
_block: &BlockWithSenders,
|
||||||
_total_difficulty: U256,
|
_total_difficulty: U256,
|
||||||
) -> Result<ExecuteOutput, Self::Error> {
|
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
|
||||||
Ok(ExecuteOutput { receipts: vec![], gas_used: 0 })
|
Ok(ExecuteOutput { receipts: vec![], gas_used: 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user