feat: generic receipt ExecuteOutput (#12966)

This commit is contained in:
Hoa Nguyen
2024-11-30 22:49:54 +07:00
committed by GitHub
parent e0cad9fdae
commit 7353dc94a8
4 changed files with 10 additions and 8 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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 })
} }