Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip]: BlockExecutor #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[wip]: BlockExecutor #1

wants to merge 1 commit into from

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Dec 25, 2024

Motivation

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@klkvr klkvr force-pushed the klkvr/wip-executor branch from 2184951 to 5540708 Compare December 25, 2024 13:38
@klkvr klkvr force-pushed the klkvr/wip-executor branch from 5540708 to 8a9da44 Compare December 25, 2024 13:40
EvmF: EvmFactory<Evm: Evm<Tx: From<T>>>,
ReceiptB: ReceiptBuilder<T, <EvmF::Evm as Evm>::Outcome>,
{
type Input = alloy_consensus::Block<T>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should perhaps consider adding some convenience type here so that we can accept any block variant, e.g. with recovered senders.
or we require it recovered as input

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think API wise you want the block to be either type, and if it's not recovered it should do the recovery for you -- so probably a T: Into RecoveredBlock?


impl<EvmF, ReceiptB, T> BlockExecutor for EthBlockExecutor<EvmF, ReceiptB, T>
where
EvmF: EvmFactory<Evm: Evm<Tx: From<T>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be problematic where tx is like TxEnvelope because we still need to do recovery

Comment on lines +42 to +53
pub trait BlockExecutor {
/// Input for the block execution.
type Input: BlockExecutionInput;

/// Outcome of the block execution.
type Output: BlockExecutionOutcome;

/// Errors that can occur during block execution.
type Error;

fn execute(&mut self, input: Self::Input) -> Result<Self::Output, Self::Error>;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, yep I think this is it.
pretty simple and should allow for any kind of restrictions that may be necessary

}
}

impl<T> BlockExecutionInput for alloy_consensus::Block<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this should still support somebody adding a custom block executor, say, enforcing inclusion lists from the header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants