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

feat: introduce iterator for default_ethereum_payload function #11978

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

edisontim
Copy link
Contributor

Closes #11889

@edisontim
Copy link
Contributor Author

@mattsse, is this what you had in mind?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, only have style nits

@@ -124,16 +147,18 @@ where
/// and configuration, this function creates a transaction payload. Returns
/// a result indicating success with the payload or an error in case of failure.
#[inline]
pub fn default_ethereum_payload<EvmConfig, Pool, Client>(
pub fn default_ethereum_payload<EvmConfig, Pool, Client, IteratorClosure>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's just name this F

Suggested change
pub fn default_ethereum_payload<EvmConfig, Pool, Client, IteratorClosure>(
pub fn default_ethereum_payload<EvmConfig, Pool, Client, F>(

evm_config: EvmConfig,
args: BuildArguments<Pool, Client, EthPayloadBuilderAttributes, EthBuiltPayload>,
initialized_cfg: CfgEnvWithHandlerCfg,
initialized_block_env: BlockEnv,
build_best_txs_closure: IteratorClosure,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
build_best_txs_closure: IteratorClosure,
best_txs: IteratorClosure,

Comment on lines 49 to 50
type BestTransactionsIter<Transaction> =
Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Transaction>>>>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's make this generic over pool

type BestTransactionsFor<Pool> = Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<Pool as TransactionPool>::Transaction>>>>

default_ethereum_payload(self.evm_config.clone(), args, cfg_env, block_env)
let pool = args.pool.clone();

let iterator_closure = |attributes| pool.best_transactions_with_attributes(attributes);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need a tmp var for this and can make this the argument directly

args,
cfg_env,
block_env,
iterator_closure,
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

@mattsse mattsse added the A-block-building Related to block building label Oct 24, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

great

@mattsse mattsse added this pull request to the merge queue Oct 25, 2024
Merged via the queue into paradigmxyz:main with commit a87d654 Oct 25, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-block-building Related to block building
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make payload_builder function accept BestTxterator directly
2 participants