-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: introduce iterator for default_ethereum_payload function #11978
Conversation
@mattsse, is this what you had in mind? |
There was a problem hiding this 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
crates/ethereum/payload/src/lib.rs
Outdated
@@ -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>( |
There was a problem hiding this comment.
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
pub fn default_ethereum_payload<EvmConfig, Pool, Client, IteratorClosure>( | |
pub fn default_ethereum_payload<EvmConfig, Pool, Client, F>( |
crates/ethereum/payload/src/lib.rs
Outdated
evm_config: EvmConfig, | ||
args: BuildArguments<Pool, Client, EthPayloadBuilderAttributes, EthBuiltPayload>, | ||
initialized_cfg: CfgEnvWithHandlerCfg, | ||
initialized_block_env: BlockEnv, | ||
build_best_txs_closure: IteratorClosure, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_best_txs_closure: IteratorClosure, | |
best_txs: IteratorClosure, |
crates/ethereum/payload/src/lib.rs
Outdated
type BestTransactionsIter<Transaction> = | ||
Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Transaction>>>>; |
There was a problem hiding this comment.
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>>>>
crates/ethereum/payload/src/lib.rs
Outdated
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); |
There was a problem hiding this comment.
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
crates/ethereum/payload/src/lib.rs
Outdated
args, | ||
cfg_env, | ||
block_env, | ||
iterator_closure, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
Closes #11889