fix: add bundle and transaction context to call_many errors (#18127)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
crazykissshout
2025-10-17 16:40:26 +02:00
committed by GitHub
parent ca26219aa6
commit 1634535e00
2 changed files with 49 additions and 5 deletions

View File

@@ -300,7 +300,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
}
// transact all bundles
for bundle in bundles {
for (bundle_index, bundle) in bundles.into_iter().enumerate() {
let Bundle { transactions, block_override } = bundle;
if transactions.is_empty() {
// Skip empty bundles
@@ -311,15 +311,30 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
let block_overrides = block_override.map(Box::new);
// transact all transactions in the bundle
for tx in transactions {
for (tx_index, tx) in transactions.into_iter().enumerate() {
// Apply overrides, state overrides are only applied for the first tx in the
// request
let overrides =
EvmOverrides::new(state_override.take(), block_overrides.clone());
let (current_evm_env, prepared_tx) =
this.prepare_call_env(evm_env.clone(), tx, &mut db, overrides)?;
let res = this.transact(&mut db, current_evm_env, prepared_tx)?;
let (current_evm_env, prepared_tx) = this
.prepare_call_env(evm_env.clone(), tx, &mut db, overrides)
.map_err(|err| {
Self::Error::from_eth_err(EthApiError::call_many_error(
bundle_index,
tx_index,
err.into(),
))
})?;
let res = this.transact(&mut db, current_evm_env, prepared_tx).map_err(
|err| {
Self::Error::from_eth_err(EthApiError::call_many_error(
bundle_index,
tx_index,
err.into(),
))
},
)?;
match ensure_success::<_, Self::Error>(res.result) {
Ok(output) => {