@pimlico/alto 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/EIP712.sol/EIP712.json +1 -1
- package/contracts/ERC165.sol/ERC165.json +1 -1
- package/contracts/ERC20.sol/ERC20.json +1 -1
- package/contracts/Eip7702Support.sol/Eip7702Support.json +1 -1
- package/contracts/EntryPoint.sol/EntryPoint.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
- package/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
- package/contracts/Exec.sol/Exec.json +1 -1
- package/contracts/IAccount.sol/IAccount.json +1 -1
- package/contracts/IAccountExecute.sol/IAccountExecute.json +1 -1
- package/contracts/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/IERC165.sol/IERC165.json +1 -1
- package/contracts/IERC5267.sol/IERC5267.json +1 -1
- package/contracts/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride08.json +1 -0
- package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride09.json +1 -0
- package/contracts/IEntryPointSimulations.sol/IEntryPointSimulations.json +1 -1
- package/contracts/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/IPaymaster.sol/IPaymaster.json +1 -1
- package/contracts/ISenderCreator.sol/ISenderCreator.json +1 -1
- package/contracts/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/LibBytes.sol/LibBytes.json +1 -1
- package/contracts/Math.sol/Math.json +1 -1
- package/contracts/MessageHashUtils.sol/MessageHashUtils.json +1 -1
- package/contracts/NonceManager.sol/NonceManager.json +1 -1
- package/contracts/Panic.sol/Panic.json +1 -1
- package/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
- package/contracts/ReentrancyGuard.sol/ReentrancyGuard.json +1 -1
- package/contracts/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -1
- package/contracts/SafeCast.sol/SafeCast.json +1 -1
- package/contracts/SenderCreator.sol/SenderCreator.json +1 -1
- package/contracts/ShortStrings.sol/ShortStrings.json +1 -1
- package/contracts/SignedMath.sol/SignedMath.json +1 -1
- package/contracts/SimulationOverrideHelper.sol/SimulationOverrideHelper.json +1 -0
- package/contracts/StakeManager.sol/StakeManager.json +1 -1
- package/contracts/StorageSlot.sol/StorageSlot.json +1 -1
- package/contracts/Strings.sol/Strings.json +1 -1
- package/contracts/TransientSlot.sol/TransientSlot.json +1 -1
- package/contracts/UserOperation.sol/UserOperationLib.json +1 -1
- package/contracts/UserOperationLib.sol/UserOperationLib.json +1 -1
- package/contracts/account-abstraction-v9/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -0
- package/contracts/build-info/338795fc743ca612.json +1 -0
- package/contracts/build-info/44a9648cfe32a468.json +1 -0
- package/contracts/build-info/{880955d5786bfdae.json → 8dbf8a4ad39019b5.json} +1 -1
- package/contracts/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/core/Eip7702Support.sol/Eip7702Support.json +1 -0
- package/contracts/core/NonceManager.sol/NonceManager.json +1 -0
- package/contracts/core/SenderCreator.sol/SenderCreator.json +1 -0
- package/contracts/core/StakeManager.sol/StakeManager.json +1 -0
- package/contracts/core/UserOperationLib.sol/UserOperationLib.json +1 -0
- package/contracts/interfaces/IAccount.sol/IAccount.json +1 -0
- package/contracts/interfaces/IAccountExecute.sol/IAccountExecute.json +1 -0
- package/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/interfaces/IPaymaster.sol/IPaymaster.json +1 -0
- package/contracts/interfaces/ISenderCreator.sol/ISenderCreator.json +1 -0
- package/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/overrides/Eip7702Support.sol/Eip7702Support.json +1 -0
- package/contracts/overrides/NonceManager.sol/NonceManager.json +1 -0
- package/contracts/overrides/SenderCreator.sol/SenderCreator.json +1 -0
- package/contracts/overrides/StakeManager.sol/StakeManager.json +1 -0
- package/contracts/overrides/UserOperationLib.sol/UserOperationLib.json +1 -0
- package/contracts/utils/Exec.sol/Exec.json +1 -1
- package/contracts/utils/StorageSlot.sol/StorageSlot.json +1 -0
- package/contracts/v09/EntryPoint.sol/EntryPoint.json +1 -0
- package/esm/cli/alto.js +13 -6
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +190 -148
- package/esm/cli/config/bundler.js +72 -83
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +2 -1
- package/esm/cli/config/options.js +105 -68
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/customTransport.d.ts +3 -3
- package/esm/cli/deploySimulationsContract.d.ts +1 -0
- package/esm/cli/deploySimulationsContract.js +41 -5
- package/esm/cli/deploySimulationsContract.js.map +1 -1
- package/esm/cli/handler.js +48 -52
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/setupServer.js +46 -47
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.d.ts +20 -0
- package/esm/cli/shutDown.js +260 -0
- package/esm/cli/shutDown.js.map +1 -0
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
- package/esm/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
- package/esm/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
- package/esm/createConfig.d.ts +9 -2
- package/esm/createConfig.js.map +1 -1
- package/esm/executor/{userOpMonitor.d.ts → bundleManager.d.ts} +38 -32
- package/esm/executor/{userOpMonitor.js → bundleManager.js} +127 -99
- package/esm/executor/bundleManager.js.map +1 -0
- package/esm/executor/executor.d.ts +4 -3
- package/esm/executor/executor.js +33 -20
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +17 -15
- package/esm/executor/executorManager.js +130 -55
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/filterOpsAndEstimateGas.d.ts +17 -2
- package/esm/executor/filterOpsAndEstimateGas.js +100 -77
- package/esm/executor/filterOpsAndEstimateGas.js.map +1 -1
- package/esm/executor/index.d.ts +1 -0
- package/esm/executor/index.js +1 -0
- package/esm/executor/index.js.map +1 -1
- package/esm/executor/senderManager/createMemorySenderManager.js +13 -0
- package/esm/executor/senderManager/createMemorySenderManager.js.map +1 -1
- package/esm/executor/senderManager/createRedisSenderManager.d.ts +2 -1
- package/esm/executor/senderManager/createRedisSenderManager.js +3 -6
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/executor/senderManager/flushOnStartUp.js +4 -4
- package/esm/executor/senderManager/flushOnStartUp.js.map +1 -1
- package/esm/executor/senderManager/index.d.ts +1 -0
- package/esm/executor/senderManager/index.js +6 -2
- package/esm/executor/senderManager/index.js.map +1 -1
- package/esm/executor/senderManager/validateAndRefill.js +2 -2
- package/esm/executor/senderManager/validateAndRefill.js.map +1 -1
- package/esm/executor/utilityWalletMonitor.d.ts +4 -4
- package/esm/executor/utilityWalletMonitor.js +1 -1
- package/esm/executor/utilityWalletMonitor.js.map +1 -1
- package/esm/executor/utils.d.ts +7 -2
- package/esm/executor/utils.js +57 -26
- package/esm/executor/utils.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.d.ts +3 -2
- package/esm/handlers/arbitrumGasPriceManager.js +6 -2
- package/esm/handlers/arbitrumGasPriceManager.js.map +1 -1
- package/esm/handlers/eventManager.d.ts +9 -9
- package/esm/handlers/eventManager.js +59 -60
- package/esm/handlers/eventManager.js.map +1 -1
- package/esm/handlers/gasPriceManager.d.ts +8 -9
- package/esm/handlers/gasPriceManager.js +68 -80
- package/esm/handlers/gasPriceManager.js.map +1 -1
- package/esm/handlers/mantleGasPriceManager.d.ts +4 -4
- package/esm/handlers/mantleGasPriceManager.js +4 -4
- package/esm/handlers/mantleGasPriceManager.js.map +1 -1
- package/esm/handlers/optimismManager.d.ts +1 -1
- package/esm/handlers/optimismManager.js +1 -1
- package/esm/handlers/optimismManager.js.map +1 -1
- package/esm/mempool/index.d.ts +1 -1
- package/esm/mempool/index.js +1 -1
- package/esm/mempool/index.js.map +1 -1
- package/esm/mempool/mempool.d.ts +57 -22
- package/esm/mempool/mempool.js +180 -134
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/reputationManager.d.ts +14 -14
- package/esm/mempool/reputationManager.js +36 -39
- package/esm/mempool/reputationManager.js.map +1 -1
- package/esm/mempool/statusManager.d.ts +20 -0
- package/esm/mempool/statusManager.js +143 -0
- package/esm/mempool/statusManager.js.map +1 -0
- package/esm/receiptCache/createMemoryReceiptCache.d.ts +3 -0
- package/esm/receiptCache/createMemoryReceiptCache.js +30 -0
- package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -0
- package/esm/receiptCache/createRedisReceiptCache.d.ts +10 -0
- package/esm/receiptCache/createRedisReceiptCache.js +56 -0
- package/esm/receiptCache/createRedisReceiptCache.js.map +1 -0
- package/esm/receiptCache/index.d.ts +11 -0
- package/esm/receiptCache/index.js +21 -0
- package/esm/receiptCache/index.js.map +1 -0
- package/esm/rpc/createMethodHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +2 -4
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimations06.d.ts +6 -7
- package/esm/rpc/estimation/gasEstimations06.js +1 -5
- package/esm/rpc/estimation/gasEstimations06.js.map +1 -1
- package/esm/rpc/estimation/gasEstimations07.d.ts +13 -41
- package/esm/rpc/estimation/gasEstimations07.js +27 -34
- package/esm/rpc/estimation/gasEstimations07.js.map +1 -1
- package/esm/{utils/preVerificationGasCalulator.d.ts → rpc/estimation/preVerificationGasCalculator.d.ts} +20 -6
- package/esm/{utils/preVerificationGasCalulator.js → rpc/estimation/preVerificationGasCalculator.js} +95 -47
- package/esm/rpc/estimation/preVerificationGasCalculator.js.map +1 -0
- package/esm/rpc/estimation/types.d.ts +4 -2
- package/esm/rpc/estimation/utils.d.ts +10 -8
- package/esm/rpc/estimation/utils.js +54 -48
- package/esm/rpc/estimation/utils.js.map +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.d.ts +304 -0
- package/esm/rpc/methods/debug_bundler_clearReputation.js +1 -1
- package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_clearState.js +1 -1
- package/esm/rpc/methods/debug_bundler_clearState.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +338 -0
- package/esm/rpc/methods/debug_bundler_dumpReputation.js +1 -1
- package/esm/rpc/methods/debug_bundler_dumpReputation.js.map +1 -1
- package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +622 -14
- package/esm/rpc/methods/eth_estimateUserOperationGas.js +50 -29
- package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
- package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +621 -11
- package/esm/rpc/methods/eth_getUserOperationByHash.js.map +1 -1
- package/esm/rpc/methods/eth_getUserOperationReceipt.d.ts +26 -26
- package/esm/rpc/methods/eth_getUserOperationReceipt.js +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.d.ts +305 -1
- package/esm/rpc/methods/eth_sendUserOperation.js +132 -36
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/pimlico_getUserOperationStatus.js +1 -1
- package/esm/rpc/methods/pimlico_getUserOperationStatus.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +330 -26
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +15 -27
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/rpc/methods/pimlico_simulateAssetChange.d.ts +620 -12
- package/esm/rpc/methods/pimlico_simulateAssetChange.js +14 -19
- package/esm/rpc/methods/pimlico_simulateAssetChange.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +21 -22
- package/esm/rpc/rpcHandler.js +15 -17
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.d.ts +5 -5
- package/esm/rpc/server.js +15 -11
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +13 -14
- package/esm/rpc/validation/SafeValidator.js +24 -24
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV06.d.ts +2 -2
- package/esm/rpc/validation/TracerResultParserV06.js +11 -11
- package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV07.d.ts +2 -2
- package/esm/rpc/validation/TracerResultParserV07.js +13 -13
- package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +18 -14
- package/esm/rpc/validation/UnsafeValidator.js +71 -40
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +63 -139
- package/esm/store/createMempoolStore.js.map +1 -1
- package/esm/store/index.d.ts +4 -75
- package/esm/store/index.js +4 -1
- package/esm/store/index.js.map +1 -1
- package/esm/store/outstanding/index.d.ts +13 -0
- package/esm/store/outstanding/index.js +16 -0
- package/esm/store/outstanding/index.js.map +1 -0
- package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +14 -13
- package/esm/store/outstanding/memory.js +263 -0
- package/esm/store/outstanding/memory.js.map +1 -0
- package/esm/store/outstanding/redis.d.ts +11 -0
- package/esm/store/outstanding/redis.js +229 -0
- package/esm/store/outstanding/redis.js.map +1 -0
- package/esm/store/outstanding/types.d.ts +19 -0
- package/esm/store/outstanding/types.js +2 -0
- package/esm/store/outstanding/types.js.map +1 -0
- package/esm/store/processing/index.d.ts +11 -0
- package/esm/store/processing/index.js +17 -0
- package/esm/store/processing/index.js.map +1 -0
- package/esm/store/processing/memory.d.ts +16 -0
- package/esm/store/processing/memory.js +58 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +23 -0
- package/esm/store/processing/redis.js +85 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +10 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +50 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.js.map +1 -0
- package/esm/types/contracts/PimlicoSimulations.d.ts +81 -0
- package/esm/types/contracts/PimlicoSimulations.js +105 -0
- package/esm/types/contracts/PimlicoSimulations.js.map +1 -1
- package/esm/types/gasPrice.js +0 -18
- package/esm/types/gasPrice.js.map +1 -1
- package/esm/types/interfaces.d.ts +15 -10
- package/esm/types/mempool.d.ts +3 -0
- package/esm/types/schemas.d.ts +13174 -4732
- package/esm/types/schemas.js +113 -25
- package/esm/types/schemas.js.map +1 -1
- package/esm/types/utils.d.ts +2 -5
- package/esm/types/utils.js +16 -18
- package/esm/types/utils.js.map +1 -1
- package/esm/types/validation.d.ts +7646 -6912
- package/esm/types/validation.js +122 -152
- package/esm/types/validation.js.map +1 -1
- package/esm/utils/eip7702.d.ts +2 -1
- package/esm/utils/eip7702.js +14 -8
- package/esm/utils/eip7702.js.map +1 -1
- package/esm/utils/entryPointOverrides.js +18 -4
- package/esm/utils/entryPointOverrides.js.map +1 -1
- package/esm/utils/helpers.d.ts +2 -1
- package/esm/utils/helpers.js +30 -11
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +0 -1
- package/esm/utils/index.js +0 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/metrics.d.ts +2 -1
- package/esm/utils/metrics.js +15 -8
- package/esm/utils/metrics.js.map +1 -1
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js +8 -9
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +24 -2
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +85 -64
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/index.d.ts +2 -2
- package/esm/utils/minMaxQueue/index.js +4 -3
- package/esm/utils/minMaxQueue/index.js.map +1 -1
- package/esm/utils/rpc-reply.d.ts +3 -3
- package/esm/utils/rpc-reply.js.map +1 -1
- package/esm/utils/toViemStateOverrides.js +7 -7
- package/esm/utils/toViemStateOverrides.js.map +1 -1
- package/esm/utils/userop.d.ts +87 -55
- package/esm/utils/userop.js +138 -248
- package/esm/utils/userop.js.map +1 -1
- package/package.json +4 -2
- package/contracts/build-info/7710b5a048396e70.json +0 -1
- package/esm/executor/userOpMonitor.js.map +0 -1
- package/esm/mempool/monitoring.d.ts +0 -15
- package/esm/mempool/monitoring.js +0 -118
- package/esm/mempool/monitoring.js.map +0 -1
- package/esm/store/createMemoryOutstandingStore.js +0 -240
- package/esm/store/createMemoryOutstandingStore.js.map +0 -1
- package/esm/store/createRedisOutstandingStore.d.ts +0 -27
- package/esm/store/createRedisOutstandingStore.js +0 -344
- package/esm/store/createRedisOutstandingStore.js.map +0 -1
- package/esm/store/createRedisStore.d.ts +0 -9
- package/esm/store/createRedisStore.js +0 -131
- package/esm/store/createRedisStore.js.map +0 -1
- package/esm/store/createStore.d.ts +0 -6
- package/esm/store/createStore.js +0 -66
- package/esm/store/createStore.js.map +0 -1
- package/esm/utils/preVerificationGasCalulator.js.map +0 -1
package/esm/executor/executor.js
CHANGED
|
@@ -15,7 +15,7 @@ export class Executor {
|
|
|
15
15
|
this.eventManager = eventManager;
|
|
16
16
|
}
|
|
17
17
|
getBundleGasPrice({ bundle, networkGasPrice, networkBaseFee, totalBeneficiaryFees, bundleGasUsed }) {
|
|
18
|
-
const { bundlerInitialCommission, resubmitMultiplierCeiling, legacyTransactions, chainType,
|
|
18
|
+
const { bundlerInitialCommission, resubmitMultiplierCeiling, legacyTransactions, chainType, arbitrumBaseFeeMultiplier } = this.config;
|
|
19
19
|
// Arbtirum's sequencer orders based on first come first serve.
|
|
20
20
|
// Because of this, maxFee/maxPriorityFee is ignored and the bundler *always* pays the network's baseFee.
|
|
21
21
|
// The bundler need to set a large enough gasBid to account for network baseFee fluctuations.
|
|
@@ -23,8 +23,8 @@ export class Executor {
|
|
|
23
23
|
if (chainType === "arbitrum") {
|
|
24
24
|
const scaledBaseFee = scaleBigIntByPercent(networkBaseFee, 100n + 20n * BigInt(bundle.submissionAttempts));
|
|
25
25
|
return {
|
|
26
|
-
maxFeePerGas: scaledBaseFee
|
|
27
|
-
maxPriorityFeePerGas: scaledBaseFee
|
|
26
|
+
maxFeePerGas: scaleBigIntByPercent(scaledBaseFee, arbitrumBaseFeeMultiplier),
|
|
27
|
+
maxPriorityFeePerGas: scaleBigIntByPercent(scaledBaseFee, arbitrumBaseFeeMultiplier)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
// Increase network gas price for resubmissions to improve tx inclusion
|
|
@@ -63,8 +63,14 @@ export class Executor {
|
|
|
63
63
|
maxPriorityFeePerGas: networkMaxPriorityFeePerGas
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
async sendHandleOpsTransaction({ txParam, gasOpts }) {
|
|
67
|
-
const { executorGasMultiplier, sendHandleOpsRetryCount, transactionUnderpricedMultiplier,
|
|
66
|
+
async sendHandleOpsTransaction({ txParam, gasOpts, childLogger, submissionAttempts }) {
|
|
67
|
+
const { executorGasMultiplier, sendHandleOpsRetryCount, transactionUnderpricedMultiplier, walletClients, publicClient, privateEndpointSubmissionAttempts } = this.config;
|
|
68
|
+
// Use private wallet for configured number of attempts if available, then switch to public
|
|
69
|
+
const usePrivateEndpoint = walletClients.private &&
|
|
70
|
+
submissionAttempts < privateEndpointSubmissionAttempts;
|
|
71
|
+
const walletClient = usePrivateEndpoint
|
|
72
|
+
? walletClients.private
|
|
73
|
+
: walletClients.public;
|
|
68
74
|
const { entryPoint, userOps, account, gas, nonce } = txParam;
|
|
69
75
|
const handleOpsCalldata = encodeHandleOpsCalldata({
|
|
70
76
|
userOps: userOps.map(({ userOp }) => userOp),
|
|
@@ -93,12 +99,22 @@ export class Executor {
|
|
|
93
99
|
multiple: this.config.gasLimitRoundingMultiple
|
|
94
100
|
});
|
|
95
101
|
transactionHash = await walletClient.sendTransaction(request);
|
|
102
|
+
childLogger.info({
|
|
103
|
+
transactionRequest: {
|
|
104
|
+
executor: request.account.address,
|
|
105
|
+
maxFeePerGas: request.maxFeePerGas,
|
|
106
|
+
maxPriorityFeePerGas: request.maxPriorityFeePerGas,
|
|
107
|
+
nonce: request.nonce
|
|
108
|
+
},
|
|
109
|
+
txHash: transactionHash,
|
|
110
|
+
isPrivate: usePrivateEndpoint
|
|
111
|
+
}, "submitted bundle transaction");
|
|
96
112
|
break;
|
|
97
113
|
}
|
|
98
114
|
catch (e) {
|
|
99
115
|
if (e instanceof BaseError) {
|
|
100
116
|
if (isTransactionUnderpricedError(e)) {
|
|
101
|
-
|
|
117
|
+
childLogger.warn("Transaction underpriced, retrying");
|
|
102
118
|
request.nonce = await publicClient.getTransactionCount({
|
|
103
119
|
address: account.address,
|
|
104
120
|
blockTag: "latest"
|
|
@@ -115,7 +131,7 @@ export class Executor {
|
|
|
115
131
|
}
|
|
116
132
|
}
|
|
117
133
|
if (e instanceof FeeCapTooLowError) {
|
|
118
|
-
|
|
134
|
+
childLogger.warn("max fee < basefee, retrying");
|
|
119
135
|
if (request.gasPrice) {
|
|
120
136
|
request.gasPrice = scaleBigIntByPercent(request.gasPrice, 125n);
|
|
121
137
|
}
|
|
@@ -130,21 +146,21 @@ export class Executor {
|
|
|
130
146
|
if (error instanceof TransactionExecutionError) {
|
|
131
147
|
const cause = error.cause;
|
|
132
148
|
if (cause instanceof NonceTooLowError) {
|
|
133
|
-
|
|
149
|
+
childLogger.warn("Nonce too low, retrying");
|
|
134
150
|
request.nonce = await publicClient.getTransactionCount({
|
|
135
151
|
address: request.from,
|
|
136
152
|
blockTag: "latest"
|
|
137
153
|
});
|
|
138
154
|
}
|
|
139
155
|
if (cause instanceof NonceTooHighError) {
|
|
140
|
-
|
|
156
|
+
childLogger.warn("Nonce too high, retrying");
|
|
141
157
|
request.nonce = await publicClient.getTransactionCount({
|
|
142
158
|
address: request.from,
|
|
143
159
|
blockTag: "latest"
|
|
144
160
|
});
|
|
145
161
|
}
|
|
146
162
|
if (cause instanceof IntrinsicGasTooLowError) {
|
|
147
|
-
|
|
163
|
+
childLogger.warn("Intrinsic gas too low, retrying");
|
|
148
164
|
request.gas = scaleBigIntByPercent(request.gas, 150n);
|
|
149
165
|
}
|
|
150
166
|
}
|
|
@@ -162,13 +178,13 @@ export class Executor {
|
|
|
162
178
|
}
|
|
163
179
|
async bundle({ executor, userOpBundle, networkGasPrice, networkBaseFee, nonce }) {
|
|
164
180
|
const { entryPoint, userOps } = userOpBundle;
|
|
165
|
-
const isReplacementTx = userOpBundle.submissionAttempts > 0;
|
|
166
181
|
let childLogger = this.logger.child({
|
|
167
|
-
|
|
182
|
+
submissionAttempts: userOpBundle.submissionAttempts,
|
|
168
183
|
userOperations: getUserOpHashes(userOps),
|
|
169
184
|
entryPoint
|
|
170
185
|
});
|
|
171
186
|
const filterOpsResult = await filterOpsAndEstimateGas({
|
|
187
|
+
checkEip7702AuthNonces: false, // Ignore EIP-7702 auth nonce check to save latency.
|
|
172
188
|
networkBaseFee,
|
|
173
189
|
userOpBundle,
|
|
174
190
|
config: this.config,
|
|
@@ -195,8 +211,8 @@ export class Executor {
|
|
|
195
211
|
const { userOpsToBundle, rejectedUserOps, bundleGasUsed, bundleGasLimit, totalBeneficiaryFees } = filterOpsResult;
|
|
196
212
|
// Update child logger with userOperations being sent for bundling.
|
|
197
213
|
childLogger = this.logger.child({
|
|
198
|
-
|
|
199
|
-
|
|
214
|
+
userOps: getUserOpHashes(userOpsToBundle),
|
|
215
|
+
submissionAttempts: userOpBundle.submissionAttempts,
|
|
200
216
|
entryPoint
|
|
201
217
|
});
|
|
202
218
|
const { maxFeePerGas, maxPriorityFeePerGas } = this.getBundleGasPrice({
|
|
@@ -240,7 +256,9 @@ export class Executor {
|
|
|
240
256
|
userOps: userOpsToBundle,
|
|
241
257
|
entryPoint
|
|
242
258
|
},
|
|
243
|
-
|
|
259
|
+
childLogger,
|
|
260
|
+
gasOpts,
|
|
261
|
+
submissionAttempts: userOpBundle.submissionAttempts
|
|
244
262
|
});
|
|
245
263
|
this.eventManager.emitSubmitted({
|
|
246
264
|
userOpHashes: getUserOpHashes(userOpsToBundle),
|
|
@@ -298,11 +316,6 @@ export class Executor {
|
|
|
298
316
|
nonce
|
|
299
317
|
}
|
|
300
318
|
};
|
|
301
|
-
childLogger.info({
|
|
302
|
-
transactionRequest: bundleResult.transactionRequest,
|
|
303
|
-
txHash: transactionHash,
|
|
304
|
-
opHashes: getUserOpHashes(userOpsBundled)
|
|
305
|
-
}, "submitted bundle transaction");
|
|
306
319
|
return bundleResult;
|
|
307
320
|
}
|
|
308
321
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../executor/executor.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,aAAa,EACb,oBAAoB,EACvB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAEH,SAAS,EACT,8BAA8B,EAC9B,iBAAiB,EAEjB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../executor/executor.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,aAAa,EACb,oBAAoB,EACvB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAEH,SAAS,EACT,8BAA8B,EAC9B,iBAAiB,EAEjB,sBAAsB,EACtB,uBA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BAC3B,WAAW,CAAC,IAAI,CACZ;oBACI,QAAQ,EAAE,QAAQ,CAAC,OAAO;oBAC1B,GAAG,EAAE,uBAAuB,CAAC,GAAG,CAAC;iBACpC,EACD,iCAAiC,CACpC,CAAA;gBACD,OAAO;oBACH,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,oBAAoB;oBAC5B,eAAe;oBACf,cAAc,EAAE,eAAe;iBAClC,CAAA;YACL,CAAC;YAED,WAAW,CAAC,KAAK,CACb;gBACI,GAAG,EAAE,uBAAuB,CAAC,GAAG,CAAC;aACpC,EACD,qCAAqC,CACxC,CAAA;YAED,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,eAAe;gBACvB,eAAe;gBACf,cAAc,EAAE,eAAe;aAClC,CAAA;QACL,CAAC;QAED,MAAM,cAAc,GAAG,eAAe,CAAA;QAEtC,MAAM,YAAY,GAAiB;YAC/B,OAAO,EAAE,IAAI;YACb,cAAc;YACd,eAAe;YACf,eAAe;YACf,kBAAkB,EAAE;gBAChB,YAAY;gBACZ,oBAAoB;gBACpB,KAAK;aACR;SACJ,CAAA;QAED,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import type { GasPriceManager } from "../handlers/index.js";
|
|
2
2
|
import type { Mempool } from "../mempool/index.js";
|
|
3
|
-
import type { BundlingMode, SubmittedBundleInfo, UserOperationBundle } from "../types/index.js";
|
|
4
|
-
import type { GasPriceParameters } from "../types/index.js";
|
|
3
|
+
import type { BundlingMode, GasPriceParameters, SubmittedBundleInfo, UserOperationBundle } from "../types/index.js";
|
|
5
4
|
import { type Metrics } from "../utils/index.js";
|
|
6
5
|
import type { Hex } from "viem";
|
|
7
6
|
import type { AltoConfig } from "../createConfig.js";
|
|
7
|
+
import type { BundleManager } from "./bundleManager.js";
|
|
8
8
|
import type { Executor } from "./executor.js";
|
|
9
9
|
import type { SenderManager } from "./senderManager/index.js";
|
|
10
|
-
import type { UserOpMonitor } from "./userOpMonitor.js";
|
|
11
10
|
export declare class ExecutorManager {
|
|
12
|
-
private senderManager;
|
|
13
|
-
private config;
|
|
14
|
-
private executor;
|
|
15
|
-
private mempool;
|
|
16
|
-
private logger;
|
|
17
|
-
private metrics;
|
|
18
|
-
private gasPriceManager;
|
|
11
|
+
private readonly senderManager;
|
|
12
|
+
private readonly config;
|
|
13
|
+
private readonly executor;
|
|
14
|
+
private readonly mempool;
|
|
15
|
+
private readonly logger;
|
|
16
|
+
private readonly metrics;
|
|
17
|
+
private readonly gasPriceManager;
|
|
18
|
+
private readonly bundleManager;
|
|
19
19
|
private opsCount;
|
|
20
20
|
private bundlingMode;
|
|
21
|
-
private userOpMonitor;
|
|
22
21
|
private unWatch;
|
|
23
22
|
private currentlyHandlingBlock;
|
|
24
|
-
constructor({ config, executor, mempool, metrics, gasPriceManager, senderManager,
|
|
23
|
+
constructor({ config, executor, mempool, metrics, gasPriceManager, senderManager, bundleManager }: {
|
|
25
24
|
config: AltoConfig;
|
|
26
25
|
executor: Executor;
|
|
27
26
|
mempool: Mempool;
|
|
28
27
|
metrics: Metrics;
|
|
29
28
|
gasPriceManager: GasPriceManager;
|
|
30
29
|
senderManager: SenderManager;
|
|
31
|
-
|
|
30
|
+
bundleManager: BundleManager;
|
|
32
31
|
});
|
|
32
|
+
start(): void;
|
|
33
33
|
setBundlingMode(bundleMode: BundlingMode): Promise<void>;
|
|
34
34
|
autoScalingBundling(): Promise<void>;
|
|
35
35
|
startWatchingBlocks(): void;
|
|
@@ -37,7 +37,8 @@ export declare class ExecutorManager {
|
|
|
37
37
|
sendBundleToExecutor(userOpBundle: UserOperationBundle): Promise<Hex | undefined>;
|
|
38
38
|
stopWatchingBlocks(): void;
|
|
39
39
|
private handleBlock;
|
|
40
|
-
potentiallyResubmitBundle({ submittedBundle, networkGasPrice, networkBaseFee }: {
|
|
40
|
+
potentiallyResubmitBundle({ blockReceivedTimestamp, submittedBundle, networkGasPrice, networkBaseFee }: {
|
|
41
|
+
blockReceivedTimestamp: number;
|
|
41
42
|
submittedBundle: SubmittedBundleInfo;
|
|
42
43
|
networkGasPrice: {
|
|
43
44
|
maxFeePerGas: bigint;
|
|
@@ -46,7 +47,8 @@ export declare class ExecutorManager {
|
|
|
46
47
|
networkBaseFee: bigint;
|
|
47
48
|
}): void;
|
|
48
49
|
cancelBundle(submittedBundle: SubmittedBundleInfo): Promise<void>;
|
|
49
|
-
replaceTransaction({ submittedBundle, networkGasPrice, networkBaseFee, reason }: {
|
|
50
|
+
replaceTransaction({ blockReceivedTimestamp, submittedBundle, networkGasPrice, networkBaseFee, reason }: {
|
|
51
|
+
blockReceivedTimestamp: number;
|
|
50
52
|
submittedBundle: SubmittedBundleInfo;
|
|
51
53
|
networkGasPrice: GasPriceParameters;
|
|
52
54
|
networkBaseFee: bigint;
|
|
@@ -10,12 +10,12 @@ export class ExecutorManager {
|
|
|
10
10
|
logger;
|
|
11
11
|
metrics;
|
|
12
12
|
gasPriceManager;
|
|
13
|
+
bundleManager;
|
|
13
14
|
opsCount = [];
|
|
14
15
|
bundlingMode;
|
|
15
|
-
userOpMonitor;
|
|
16
16
|
unWatch;
|
|
17
17
|
currentlyHandlingBlock = false;
|
|
18
|
-
constructor({ config, executor, mempool, metrics, gasPriceManager, senderManager,
|
|
18
|
+
constructor({ config, executor, mempool, metrics, gasPriceManager, senderManager, bundleManager }) {
|
|
19
19
|
this.config = config;
|
|
20
20
|
this.executor = executor;
|
|
21
21
|
this.mempool = mempool;
|
|
@@ -26,7 +26,9 @@ export class ExecutorManager {
|
|
|
26
26
|
this.gasPriceManager = gasPriceManager;
|
|
27
27
|
this.senderManager = senderManager;
|
|
28
28
|
this.bundlingMode = this.config.bundleMode;
|
|
29
|
-
this.
|
|
29
|
+
this.bundleManager = bundleManager;
|
|
30
|
+
}
|
|
31
|
+
start() {
|
|
30
32
|
if (this.bundlingMode === "auto") {
|
|
31
33
|
this.autoScalingBundling();
|
|
32
34
|
}
|
|
@@ -43,7 +45,7 @@ export class ExecutorManager {
|
|
|
43
45
|
async autoScalingBundling() {
|
|
44
46
|
const now = Date.now();
|
|
45
47
|
this.opsCount = this.opsCount.filter((timestamp) => now - timestamp < RPM_WINDOW);
|
|
46
|
-
const bundles = await this.mempool.getBundles();
|
|
48
|
+
const bundles = await this.mempool.getBundles(this.config.maxBundleCount);
|
|
47
49
|
if (bundles.length > 0) {
|
|
48
50
|
// Count total ops and add timestamps
|
|
49
51
|
const totalOps = bundles.reduce((sum, bundle) => sum + bundle.userOps.length, 0);
|
|
@@ -66,16 +68,35 @@ export class ExecutorManager {
|
|
|
66
68
|
if (this.unWatch) {
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
// If preconfirmationTime is set, poll at intervals instead of watching blocks
|
|
72
|
+
if (this.config.flashblocksPreconfirmationTime) {
|
|
73
|
+
// Set up interval to call handleBlock
|
|
74
|
+
const intervalId = setInterval(async () => {
|
|
75
|
+
try {
|
|
76
|
+
await this.handleBlock();
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
this.logger.error({ err }, "error while polling blocks");
|
|
80
|
+
}
|
|
81
|
+
}, this.config.flashblocksPreconfirmationTime);
|
|
82
|
+
// Store cleanup function
|
|
83
|
+
this.unWatch = () => {
|
|
84
|
+
clearInterval(intervalId);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// Default behavior - watch blocks
|
|
89
|
+
this.unWatch = this.config.publicClient.watchBlocks({
|
|
90
|
+
onBlock: async (block) => {
|
|
91
|
+
await this.handleBlock(block);
|
|
92
|
+
},
|
|
93
|
+
onError: (err) => {
|
|
94
|
+
this.logger.error({ err }, "error while watching blocks");
|
|
95
|
+
},
|
|
96
|
+
includeTransactions: false,
|
|
97
|
+
emitMissed: false
|
|
98
|
+
});
|
|
99
|
+
}
|
|
79
100
|
this.logger.debug("started watching blocks");
|
|
80
101
|
}
|
|
81
102
|
async getBaseFee() {
|
|
@@ -119,21 +140,49 @@ export class ExecutorManager {
|
|
|
119
140
|
});
|
|
120
141
|
if (!bundleResult.success) {
|
|
121
142
|
const { rejectedUserOps, recoverableOps, reason } = bundleResult;
|
|
143
|
+
// Recover any userOps that can be resubmitted.
|
|
144
|
+
await this.mempool.resubmitUserOps({
|
|
145
|
+
userOps: recoverableOps,
|
|
146
|
+
entryPoint,
|
|
147
|
+
reason
|
|
148
|
+
});
|
|
149
|
+
// For rejected userOps, we need to check for frontruns
|
|
150
|
+
const shouldCheckFrontrun = rejectedUserOps.some(({ reason }) => reason.includes("AA25 invalid account nonce") ||
|
|
151
|
+
reason.includes("AA10 sender already constructed"));
|
|
152
|
+
if (shouldCheckFrontrun) {
|
|
153
|
+
// Check each rejected userOp for frontrun or included
|
|
154
|
+
const results = await Promise.all(rejectedUserOps.map(async (userOpInfo) => ({
|
|
155
|
+
userOpInfo,
|
|
156
|
+
status: await this.bundleManager.getUserOpStatus({
|
|
157
|
+
userOpInfo,
|
|
158
|
+
entryPoint,
|
|
159
|
+
bundlerTxs: [],
|
|
160
|
+
blockReceivedTimestamp: Date.now()
|
|
161
|
+
})
|
|
162
|
+
})));
|
|
163
|
+
// Drop userOps that were rejected but not frontrun or included
|
|
164
|
+
const notFoundUserOps = results
|
|
165
|
+
.filter(({ status }) => status === "not_found")
|
|
166
|
+
.map(({ userOpInfo }) => userOpInfo);
|
|
167
|
+
await this.mempool.dropUserOps(entryPoint, notFoundUserOps);
|
|
168
|
+
// Stop tracking userOps that were included onchain either due to frontrun or included
|
|
169
|
+
const confirmedUserOps = results
|
|
170
|
+
.filter(({ status }) => ["frontran", "included"].includes(status))
|
|
171
|
+
.map(({ userOpInfo }) => userOpInfo);
|
|
172
|
+
await this.mempool.removeProcessing({
|
|
173
|
+
entryPoint,
|
|
174
|
+
userOps: confirmedUserOps
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.logger.warn({ reason }, "failed to send bundle transaction");
|
|
179
|
+
await this.mempool.dropUserOps(entryPoint, rejectedUserOps);
|
|
180
|
+
}
|
|
122
181
|
// Free wallet as no bundle was sent.
|
|
123
182
|
await this.senderManager.markWalletProcessed(wallet);
|
|
124
|
-
// Drop rejected ops
|
|
125
|
-
await this.mempool.dropUserOps(entryPoint, rejectedUserOps);
|
|
126
183
|
this.metrics.userOpsSubmitted
|
|
127
184
|
.labels({ status: "failed" })
|
|
128
185
|
.inc(rejectedUserOps.length);
|
|
129
|
-
// Handle recoverable ops
|
|
130
|
-
if (recoverableOps.length > 0) {
|
|
131
|
-
await this.mempool.resubmitUserOps({
|
|
132
|
-
userOps: recoverableOps,
|
|
133
|
-
entryPoint,
|
|
134
|
-
reason
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
186
|
if (reason === "filterops_failed" || reason === "generic_error") {
|
|
138
187
|
this.metrics.bundlesSubmitted.labels({ status: "failed" }).inc();
|
|
139
188
|
}
|
|
@@ -160,14 +209,13 @@ export class ExecutorManager {
|
|
|
160
209
|
previousTransactionHashes: [],
|
|
161
210
|
lastReplaced: Date.now()
|
|
162
211
|
};
|
|
163
|
-
|
|
212
|
+
// Track bundle and start loop to watch blocks
|
|
213
|
+
this.bundleManager.trackBundle(submittedBundle);
|
|
214
|
+
this.startWatchingBlocks();
|
|
164
215
|
await this.mempool.markUserOpsAsSubmitted({
|
|
165
216
|
userOps: submittedBundle.bundle.userOps,
|
|
166
|
-
entryPoint: submittedBundle.bundle.entryPoint,
|
|
167
217
|
transactionHash: submittedBundle.transactionHash
|
|
168
218
|
});
|
|
169
|
-
// Start watching blocks after marking operations as submitted
|
|
170
|
-
this.startWatchingBlocks();
|
|
171
219
|
await this.mempool.dropUserOps(entryPoint, rejectedUserOps);
|
|
172
220
|
this.metrics.bundlesSubmitted.labels({ status: "success" }).inc();
|
|
173
221
|
return transactionHash;
|
|
@@ -183,37 +231,41 @@ export class ExecutorManager {
|
|
|
183
231
|
return;
|
|
184
232
|
}
|
|
185
233
|
this.currentlyHandlingBlock = true;
|
|
186
|
-
const
|
|
234
|
+
const blockReceivedTimestamp = Date.now();
|
|
235
|
+
const pendingBundles = this.bundleManager.getPendingBundles();
|
|
187
236
|
if (pendingBundles.length === 0) {
|
|
188
237
|
this.stopWatchingBlocks();
|
|
189
238
|
this.currentlyHandlingBlock = false;
|
|
190
239
|
return;
|
|
191
240
|
}
|
|
192
|
-
const [
|
|
193
|
-
this.
|
|
241
|
+
const [bundleStatuses, networkGasPrice, networkBaseFee] = await Promise.all([
|
|
242
|
+
this.bundleManager.getBundleStatuses(pendingBundles),
|
|
194
243
|
this.gasPriceManager.tryGetNetworkGasPrice().catch(() => ({
|
|
195
244
|
maxFeePerGas: 0n,
|
|
196
245
|
maxPriorityFeePerGas: 0n
|
|
197
246
|
})),
|
|
198
247
|
this.getBaseFee().catch(() => 0n)
|
|
199
248
|
]);
|
|
200
|
-
await Promise.all(
|
|
201
|
-
if (
|
|
202
|
-
await this.
|
|
249
|
+
await Promise.all(bundleStatuses.map(async (bundleStatus, index) => {
|
|
250
|
+
if (bundleStatus.status === "included") {
|
|
251
|
+
await this.bundleManager.processIncludedBundle({
|
|
203
252
|
submittedBundle: pendingBundles[index],
|
|
204
|
-
bundleReceipt:
|
|
253
|
+
bundleReceipt: bundleStatus,
|
|
254
|
+
blockReceivedTimestamp
|
|
205
255
|
});
|
|
206
256
|
}
|
|
207
|
-
if (
|
|
208
|
-
await this.
|
|
257
|
+
if (bundleStatus.status === "reverted") {
|
|
258
|
+
await this.bundleManager.processRevertedBundle({
|
|
259
|
+
blockReceivedTimestamp,
|
|
209
260
|
submittedBundle: pendingBundles[index],
|
|
210
|
-
bundleReceipt:
|
|
261
|
+
bundleReceipt: bundleStatus,
|
|
211
262
|
block
|
|
212
263
|
});
|
|
213
264
|
}
|
|
214
265
|
// can be potentially resubmitted - so we first submit it again to optimize for the speed
|
|
215
|
-
if (
|
|
266
|
+
if (bundleStatus.status === "not_found") {
|
|
216
267
|
this.potentiallyResubmitBundle({
|
|
268
|
+
blockReceivedTimestamp,
|
|
217
269
|
submittedBundle: pendingBundles[index],
|
|
218
270
|
networkGasPrice,
|
|
219
271
|
networkBaseFee
|
|
@@ -222,15 +274,16 @@ export class ExecutorManager {
|
|
|
222
274
|
}));
|
|
223
275
|
this.currentlyHandlingBlock = false;
|
|
224
276
|
}
|
|
225
|
-
potentiallyResubmitBundle({ submittedBundle, networkGasPrice, networkBaseFee }) {
|
|
277
|
+
potentiallyResubmitBundle({ blockReceivedTimestamp, submittedBundle, networkGasPrice, networkBaseFee }) {
|
|
226
278
|
const { transactionRequest, lastReplaced } = submittedBundle;
|
|
227
279
|
const { maxFeePerGas, maxPriorityFeePerGas } = transactionRequest;
|
|
228
280
|
const isGasPriceTooLow = maxFeePerGas < networkGasPrice.maxFeePerGas ||
|
|
229
281
|
maxPriorityFeePerGas < networkGasPrice.maxPriorityFeePerGas;
|
|
230
282
|
const isStuck = Date.now() - lastReplaced > this.config.resubmitStuckTimeout;
|
|
231
283
|
if (isGasPriceTooLow) {
|
|
232
|
-
this.
|
|
284
|
+
this.bundleManager.stopTrackingBundle(submittedBundle);
|
|
233
285
|
this.replaceTransaction({
|
|
286
|
+
blockReceivedTimestamp,
|
|
234
287
|
submittedBundle,
|
|
235
288
|
networkGasPrice,
|
|
236
289
|
networkBaseFee,
|
|
@@ -238,8 +291,9 @@ export class ExecutorManager {
|
|
|
238
291
|
});
|
|
239
292
|
}
|
|
240
293
|
else if (isStuck) {
|
|
241
|
-
this.
|
|
294
|
+
this.bundleManager.stopTrackingBundle(submittedBundle);
|
|
242
295
|
this.replaceTransaction({
|
|
296
|
+
blockReceivedTimestamp,
|
|
243
297
|
submittedBundle,
|
|
244
298
|
networkGasPrice,
|
|
245
299
|
networkBaseFee,
|
|
@@ -249,7 +303,8 @@ export class ExecutorManager {
|
|
|
249
303
|
}
|
|
250
304
|
async cancelBundle(submittedBundle) {
|
|
251
305
|
const { bundle: { userOps }, executor, transactionRequest, transactionHash } = submittedBundle;
|
|
252
|
-
const {
|
|
306
|
+
const { walletClients, publicClient, blockTime } = this.config;
|
|
307
|
+
const walletClient = walletClients.public;
|
|
253
308
|
const logger = this.logger.child({
|
|
254
309
|
userOps: getUserOpHashes(userOps)
|
|
255
310
|
});
|
|
@@ -284,14 +339,14 @@ export class ExecutorManager {
|
|
|
284
339
|
await new Promise((resolve) => setTimeout(resolve, blockTime / 2));
|
|
285
340
|
}
|
|
286
341
|
catch (err) {
|
|
287
|
-
logger.warn({
|
|
342
|
+
logger.warn({ err }, "failed to cancel bundle");
|
|
288
343
|
gasMultiplier += 20n; // Increase gas by additional 20% each retry
|
|
289
344
|
}
|
|
290
345
|
}
|
|
291
346
|
// All retries exhausted
|
|
292
347
|
logger.error({ transactionHash }, "failed to cancel bundle after max retries");
|
|
293
348
|
}
|
|
294
|
-
async replaceTransaction({ submittedBundle, networkGasPrice, networkBaseFee, reason }) {
|
|
349
|
+
async replaceTransaction({ blockReceivedTimestamp, submittedBundle, networkGasPrice, networkBaseFee, reason }) {
|
|
295
350
|
const { bundle, executor, transactionRequest, transactionHash: oldTxHash } = submittedBundle;
|
|
296
351
|
const { entryPoint } = bundle;
|
|
297
352
|
const bundleResult = await this.executor.bundle({
|
|
@@ -314,22 +369,38 @@ export class ExecutorManager {
|
|
|
314
369
|
const shouldCheckFrontrun = rejectedUserOps.some(({ reason }) => reason.includes("AA25 invalid account nonce") ||
|
|
315
370
|
reason.includes("AA10 sender already constructed"));
|
|
316
371
|
if (shouldCheckFrontrun) {
|
|
317
|
-
// Check each rejected userOp for frontrun
|
|
318
|
-
const
|
|
372
|
+
// Check each rejected userOp for frontrun or included
|
|
373
|
+
const results = await Promise.all(rejectedUserOps.map(async (userOpInfo) => ({
|
|
319
374
|
userOpInfo,
|
|
320
|
-
|
|
375
|
+
status: await this.bundleManager.getUserOpStatus({
|
|
376
|
+
userOpInfo,
|
|
377
|
+
entryPoint,
|
|
378
|
+
bundlerTxs: [
|
|
379
|
+
submittedBundle.transactionHash,
|
|
380
|
+
...submittedBundle.previousTransactionHashes
|
|
381
|
+
],
|
|
382
|
+
blockReceivedTimestamp
|
|
383
|
+
})
|
|
321
384
|
})));
|
|
322
|
-
const hasFrontrun =
|
|
385
|
+
const hasFrontrun = results.some(({ status }) => status === "frontran");
|
|
323
386
|
// If one userOp in the bundle was frontrun, we need to cancel the entire bundle
|
|
324
387
|
// as it will fail onchain
|
|
325
388
|
if (hasFrontrun) {
|
|
326
389
|
await this.cancelBundle(submittedBundle);
|
|
327
390
|
}
|
|
328
|
-
// Drop userOps that were rejected but not frontrun
|
|
329
|
-
const
|
|
330
|
-
.filter(({
|
|
391
|
+
// Drop userOps that were rejected but not frontrun or included
|
|
392
|
+
const notFoundUserOps = results
|
|
393
|
+
.filter(({ status }) => status === "not_found")
|
|
331
394
|
.map(({ userOpInfo }) => userOpInfo);
|
|
332
|
-
await this.mempool.dropUserOps(entryPoint,
|
|
395
|
+
await this.mempool.dropUserOps(entryPoint, notFoundUserOps);
|
|
396
|
+
// Stop tracking userOps that were included onchain either due to frontrun or included
|
|
397
|
+
const confirmedUserOps = results
|
|
398
|
+
.filter(({ status }) => ["frontran", "included"].includes(status))
|
|
399
|
+
.map(({ userOpInfo }) => userOpInfo);
|
|
400
|
+
await this.mempool.removeProcessing({
|
|
401
|
+
entryPoint,
|
|
402
|
+
userOps: confirmedUserOps
|
|
403
|
+
});
|
|
333
404
|
}
|
|
334
405
|
else {
|
|
335
406
|
this.logger.warn({ oldTxHash, reason }, "failed to replace transaction");
|
|
@@ -364,7 +435,9 @@ export class ExecutorManager {
|
|
|
364
435
|
submissionAttempts: bundle.submissionAttempts + 1
|
|
365
436
|
}
|
|
366
437
|
};
|
|
367
|
-
|
|
438
|
+
// Track bundle and start loop to watch blocks
|
|
439
|
+
this.bundleManager.trackBundle(newTxInfo);
|
|
440
|
+
this.startWatchingBlocks();
|
|
368
441
|
// Drop all userOperations that were rejected during simulation.
|
|
369
442
|
await this.mempool.dropUserOps(entryPoint, rejectedUserOps);
|
|
370
443
|
this.logger.info({
|
|
@@ -372,7 +445,9 @@ export class ExecutorManager {
|
|
|
372
445
|
newTxHash,
|
|
373
446
|
reason
|
|
374
447
|
}, "replaced transaction");
|
|
375
|
-
|
|
448
|
+
this.metrics.replacedTransactions
|
|
449
|
+
.labels({ reason, status: "success" })
|
|
450
|
+
.inc();
|
|
376
451
|
}
|
|
377
452
|
}
|
|
378
453
|
//# sourceMappingURL=executorManager.js.map
|