Skip to content

Commit f8318c8

Browse files
committed
Move recover authority logic inside submitted lambda
Since submit_eth_call_to_pool() is called from rust thread, blocking on fiber promises is not appropriate and can lead to performance issues. Move recovert_authorities() logic inside lambda executed in fiber pool. Since eth call txn has single authority, parallelization logic inside recover_authorities() only intoduces overhead without benefits. Replace parallelization with single call to recover_authority().
1 parent de74e03 commit f8318c8

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

category/rpc/eth_call.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <category/execution/ethereum/core/transaction.hpp>
3131
#include <category/execution/ethereum/db/trie_rodb.hpp>
3232
#include <category/execution/ethereum/evmc_host.hpp>
33-
#include <category/execution/ethereum/execute_block.hpp>
3433
#include <category/execution/ethereum/execute_transaction.hpp>
3534
#include <category/execution/ethereum/state2/block_state.hpp>
3635
#include <category/execution/ethereum/state3/state.hpp>
@@ -113,11 +112,12 @@ namespace
113112
enriched_txn.sc.r = 1;
114113
enriched_txn.sc.s = 1;
115114

116-
BOOST_OUTCOME_TRY(static_validate_transaction<traits>(
117-
enriched_txn,
118-
header.base_fee_per_gas,
119-
header.excess_blob_gas,
120-
chain.get_chain_id()));
115+
BOOST_OUTCOME_TRY(
116+
static_validate_transaction<traits>(
117+
enriched_txn,
118+
header.base_fee_per_gas,
119+
header.excess_blob_gas,
120+
chain.get_chain_id()));
121121

122122
tdb.set_block_and_prefix(block_number, block_id);
123123
BlockState block_state{tdb, vm};
@@ -598,9 +598,6 @@ struct monad_eth_call_executor
598598
return;
599599
}
600600

601-
auto const authorities = recover_authorities({txn}, active_pool.pool);
602-
MONAD_ASSERT(authorities.size() == 1);
603-
604601
active_pool.pool.submit(
605602
eth_call_seq_no,
606603
[this,
@@ -613,7 +610,6 @@ struct monad_eth_call_executor
613610
block_id = block_id,
614611
&db = db_,
615612
sender = sender,
616-
authorities = authorities[0],
617613
result = result,
618614
complete = complete,
619615
user = user,
@@ -640,6 +636,15 @@ struct monad_eth_call_executor
640636
complete(result, user);
641637
return;
642638
}
639+
640+
std::vector<std::optional<Address>> authorities(
641+
orig_txn.authorization_list.size());
642+
for (auto j = 0u; j < orig_txn.authorization_list.size();
643+
++j) {
644+
authorities[j] =
645+
recover_authority(orig_txn.authorization_list[j]);
646+
}
647+
643648
auto transaction = orig_txn;
644649

645650
bool const override_with_low_gas_retry_if_oog =

0 commit comments

Comments
 (0)