@pimlico/alto 0.0.19 → 0.0.21
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/{880955d5786bfdae.json → 031b289b93191224.json} +1 -1
- package/contracts/build-info/181f3522c3744403.json +1 -0
- package/contracts/build-info/a2db592afab5c9de.json +1 -0
- 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 +17 -6
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +459 -321
- package/esm/cli/config/bundler.js +125 -91
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +4 -1
- package/esm/cli/config/options.js +233 -106
- 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 +76 -80
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/multiRpcTransport.d.ts +7 -0
- package/esm/cli/multiRpcTransport.js +52 -0
- package/esm/cli/multiRpcTransport.js.map +1 -0
- package/esm/cli/setupServer.js +92 -70
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.d.ts +20 -0
- package/esm/cli/shutDown.js +285 -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} +56 -37
- package/esm/executor/bundleManager.js +393 -0
- package/esm/executor/bundleManager.js.map +1 -0
- package/esm/executor/executor.d.ts +4 -3
- package/esm/executor/executor.js +47 -23
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +20 -15
- package/esm/executor/executorManager.js +248 -67
- 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/getBundleStatus.d.ts +5 -1
- package/esm/executor/getBundleStatus.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 +45 -26
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/executor/senderManager/flushOnStartUp.js +7 -5
- 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 +268 -85
- package/esm/executor/senderManager/validateAndRefill.js.map +1 -1
- package/esm/executor/utils.d.ts +8 -3
- package/esm/executor/utils.js +59 -27
- 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/citreaManager.d.ts +10 -0
- package/esm/handlers/citreaManager.js +17 -0
- package/esm/handlers/citreaManager.js.map +1 -0
- 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 +17 -10
- package/esm/handlers/gasPriceManager.js +245 -99
- 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 +61 -22
- package/esm/mempool/mempool.js +223 -133
- 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} +134 -48
- 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 +56 -53
- package/esm/rpc/estimation/utils.js.map +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.d.ts +304 -0
- package/esm/rpc/methods/boost_sendUserOperation.js +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.js.map +1 -1
- 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 +61 -30
- 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 +34 -34
- package/esm/rpc/methods/eth_getUserOperationReceipt.js +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.d.ts +307 -3
- package/esm/rpc/methods/eth_sendUserOperation.js +153 -48
- 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 +338 -34
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +26 -29
- 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 +38 -26
- package/esm/rpc/rpcHandler.js +97 -44
- 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 +76 -41
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +79 -140
- 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 +19 -0
- package/esm/store/processing/memory.js +83 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +26 -0
- package/esm/store/processing/redis.js +123 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +12 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +52 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.js.map +1 -0
- package/esm/types/contracts/Multicall3.d.ts +34 -0
- package/esm/types/contracts/Multicall3.js +31 -0
- package/esm/types/contracts/Multicall3.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/contracts/index.d.ts +1 -1
- package/esm/types/contracts/index.js +1 -1
- package/esm/types/contracts/index.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 +13184 -4741
- package/esm/types/schemas.js +116 -27
- 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 +7 -1
- package/esm/utils/helpers.js +36 -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 +4 -1
- package/esm/utils/metrics.js +34 -7
- 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 +110 -56
- package/esm/utils/userop.js +161 -249
- 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 +0 -326
- package/esm/executor/userOpMonitor.js.map +0 -1
- package/esm/executor/utilityWalletMonitor.d.ts +0 -19
- package/esm/executor/utilityWalletMonitor.js +0 -38
- package/esm/executor/utilityWalletMonitor.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/types/contracts/CallEngine.d.ts +0 -28
- package/esm/types/contracts/CallEngine.js +0 -37
- package/esm/types/contracts/CallEngine.js.map +0 -1
- package/esm/utils/preVerificationGasCalulator.js.map +0 -1
package/esm/mempool/mempool.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { EntryPointV06Abi, EntryPointV07Abi, RpcError
|
|
2
|
-
import { getAAError, getAddressFromInitCodeOrPaymasterAndData,
|
|
1
|
+
import { ERC7769Errors, EntryPointV06Abi, EntryPointV07Abi, RpcError } from "../types/index.js";
|
|
2
|
+
import { getAAError, getAddressFromInitCodeOrPaymasterAndData, getViemEntryPointVersion, isVersion06, isVersion07, jsonStringifyWithBigint, scaleBigIntByPercent } from "../utils/index.js";
|
|
3
3
|
import { getAddress, getContract } from "viem";
|
|
4
|
-
import { generatePrivateKey, privateKeyToAddress } from "viem/accounts";
|
|
5
4
|
import { calculateAA95GasFloor } from "../executor/utils.js";
|
|
5
|
+
import { getEip7702AuthAddress } from "../utils/eip7702.js";
|
|
6
6
|
import { ReputationStatuses } from "./reputationManager.js";
|
|
7
7
|
export class Mempool {
|
|
8
8
|
config;
|
|
9
9
|
metrics;
|
|
10
|
-
|
|
10
|
+
statusManager;
|
|
11
11
|
reputationManager;
|
|
12
|
-
store;
|
|
13
12
|
throttledEntityBundleCount;
|
|
14
13
|
logger;
|
|
15
14
|
validator;
|
|
16
15
|
eventManager;
|
|
17
|
-
|
|
16
|
+
isShuttingDown = false;
|
|
17
|
+
store;
|
|
18
|
+
constructor({ config, metrics, statusManager, reputationManager, validator, store, eventManager }) {
|
|
18
19
|
this.metrics = metrics;
|
|
19
20
|
this.store = store;
|
|
20
21
|
this.config = config;
|
|
21
22
|
this.reputationManager = reputationManager;
|
|
22
|
-
this.
|
|
23
|
+
this.statusManager = statusManager;
|
|
23
24
|
this.validator = validator;
|
|
24
25
|
this.logger = config.getLogger({ module: "mempool" }, {
|
|
25
26
|
level: config.logLevel
|
|
@@ -28,34 +29,59 @@ export class Mempool {
|
|
|
28
29
|
this.eventManager = eventManager;
|
|
29
30
|
}
|
|
30
31
|
// === Methods for handling changing userOp state === //
|
|
31
|
-
async markUserOpsAsSubmitted({ userOps,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
status: "submitted",
|
|
38
|
-
transactionHash
|
|
39
|
-
});
|
|
40
|
-
}));
|
|
32
|
+
async markUserOpsAsSubmitted({ userOps, transactionHash }) {
|
|
33
|
+
const userOpHashes = userOps.map((userOpInfo) => userOpInfo.userOpHash);
|
|
34
|
+
await this.statusManager.set(userOpHashes, {
|
|
35
|
+
status: "submitted",
|
|
36
|
+
transactionHash
|
|
37
|
+
});
|
|
41
38
|
this.metrics.userOpsSubmitted
|
|
42
39
|
.labels({ status: "success" })
|
|
43
40
|
.inc(userOps.length);
|
|
44
41
|
}
|
|
45
42
|
async resubmitUserOps({ userOps, entryPoint, reason }) {
|
|
46
43
|
await Promise.all(userOps.map(async (userOpInfo) => {
|
|
47
|
-
const { userOpHash,
|
|
44
|
+
const { userOpHash, submissionAttempts } = userOpInfo;
|
|
45
|
+
const maxResubmits = this.config.maxResubmits;
|
|
46
|
+
// Check if max resubmits has been reached
|
|
47
|
+
if (maxResubmits !== undefined &&
|
|
48
|
+
submissionAttempts >= maxResubmits) {
|
|
49
|
+
this.logger.warn({
|
|
50
|
+
userOpHash,
|
|
51
|
+
submissionAttempts,
|
|
52
|
+
maxResubmits
|
|
53
|
+
}, "dropping userOp: max resubmits reached");
|
|
54
|
+
const rejectedUserOp = {
|
|
55
|
+
...userOpInfo,
|
|
56
|
+
reason: "max resubmits reached"
|
|
57
|
+
};
|
|
58
|
+
await this.dropUserOps(entryPoint, [rejectedUserOp]);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
48
61
|
this.logger.warn({
|
|
49
62
|
userOpHash,
|
|
63
|
+
submissionAttempts,
|
|
50
64
|
reason
|
|
51
65
|
}, "resubmitting user operation");
|
|
52
|
-
|
|
53
|
-
await this.store.
|
|
54
|
-
|
|
66
|
+
// Complete processing before re-adding to outstanding pool.
|
|
67
|
+
await this.store.removeProcessing({
|
|
68
|
+
entryPoint,
|
|
69
|
+
userOpInfos: [userOpInfo]
|
|
70
|
+
});
|
|
71
|
+
// Count this resubmit cycle, otherwise userOps that keep
|
|
72
|
+
// failing before being broadcast never hit maxResubmits.
|
|
73
|
+
const resubmittedUserOp = {
|
|
74
|
+
...userOpInfo,
|
|
75
|
+
submissionAttempts: submissionAttempts + 1
|
|
76
|
+
};
|
|
77
|
+
const [success, failureReason] = await this.add({
|
|
78
|
+
userOpInfo: resubmittedUserOp,
|
|
79
|
+
entryPoint
|
|
80
|
+
});
|
|
55
81
|
if (!success) {
|
|
56
82
|
this.logger.error({ userOpHash, failureReason }, "Failed to resubmit user operation");
|
|
57
83
|
const rejectedUserOp = {
|
|
58
|
-
...
|
|
84
|
+
...resubmittedUserOp,
|
|
59
85
|
reason: failureReason
|
|
60
86
|
};
|
|
61
87
|
this.dropUserOps(entryPoint, [rejectedUserOp]);
|
|
@@ -66,13 +92,17 @@ export class Mempool {
|
|
|
66
92
|
async dropUserOps(entryPoint, rejectedUserOps) {
|
|
67
93
|
await Promise.all(rejectedUserOps.map(async (rejectedUserOp) => {
|
|
68
94
|
const { userOp, reason, userOpHash } = rejectedUserOp;
|
|
69
|
-
|
|
70
|
-
await this.store.
|
|
95
|
+
// Complete processing since userOp is dropped.
|
|
96
|
+
await this.store.removeProcessing({
|
|
97
|
+
entryPoint,
|
|
98
|
+
userOpInfos: [rejectedUserOp]
|
|
99
|
+
});
|
|
71
100
|
this.eventManager.emitDropped(userOpHash, reason, getAAError(reason));
|
|
72
|
-
await this.
|
|
101
|
+
await this.statusManager.set([userOpHash], {
|
|
73
102
|
status: "rejected",
|
|
74
103
|
transactionHash: null
|
|
75
104
|
});
|
|
105
|
+
this.metrics.userOpsDropped.labels({ reason }).inc();
|
|
76
106
|
this.logger.warn({
|
|
77
107
|
userOperation: jsonStringifyWithBigint(userOp),
|
|
78
108
|
userOpHash,
|
|
@@ -80,30 +110,34 @@ export class Mempool {
|
|
|
80
110
|
}, "user operation rejected");
|
|
81
111
|
}));
|
|
82
112
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
// Remove userOps from processing store.
|
|
114
|
+
// should be called when userOps are included onchain.
|
|
115
|
+
async removeProcessing({ userOps, entryPoint }) {
|
|
116
|
+
await this.store.removeProcessing({
|
|
117
|
+
entryPoint,
|
|
118
|
+
userOpInfos: userOps
|
|
119
|
+
});
|
|
87
120
|
}
|
|
88
121
|
// === Methods for dropping mempool entries === //
|
|
89
122
|
async dumpOutstanding(entryPoint) {
|
|
90
123
|
return await this.store.dumpOutstanding(entryPoint);
|
|
91
124
|
}
|
|
92
|
-
async
|
|
93
|
-
return await this.store.
|
|
125
|
+
async flushProcessing(entryPoint) {
|
|
126
|
+
return await this.store.flushProcessing(entryPoint);
|
|
94
127
|
}
|
|
95
|
-
|
|
96
|
-
|
|
128
|
+
startShutdown() {
|
|
129
|
+
this.isShuttingDown = true;
|
|
130
|
+
this.logger.info("[SHUTDOWN] Mempool entered shutdown mode. No new bundles will be created");
|
|
97
131
|
}
|
|
98
132
|
// === Methods for entity management === //
|
|
99
133
|
async checkEntityMultipleRoleViolation(entryPoint, op) {
|
|
100
134
|
if (!this.config.safeMode) {
|
|
101
|
-
return
|
|
135
|
+
return;
|
|
102
136
|
}
|
|
103
137
|
const knownEntities = await this.getKnownEntities(entryPoint);
|
|
104
138
|
if (knownEntities.paymasters.has(op.sender) ||
|
|
105
139
|
knownEntities.factories.has(op.sender)) {
|
|
106
|
-
throw new RpcError(`The sender address "${op.sender}" is used as a different entity in another UserOperation currently in mempool`,
|
|
140
|
+
throw new RpcError(`The sender address "${op.sender}" is used as a different entity in another UserOperation currently in mempool`, ERC7769Errors.OpcodeValidation);
|
|
107
141
|
}
|
|
108
142
|
let paymaster = null;
|
|
109
143
|
let factory = null;
|
|
@@ -116,12 +150,11 @@ export class Mempool {
|
|
|
116
150
|
factory = op.factory;
|
|
117
151
|
}
|
|
118
152
|
if (paymaster && knownEntities.sender.has(paymaster)) {
|
|
119
|
-
throw new RpcError(`A Paymaster at ${paymaster} in this UserOperation is used as a sender entity in another UserOperation currently in mempool.`,
|
|
153
|
+
throw new RpcError(`A Paymaster at ${paymaster} in this UserOperation is used as a sender entity in another UserOperation currently in mempool.`, ERC7769Errors.OpcodeValidation);
|
|
120
154
|
}
|
|
121
155
|
if (factory && knownEntities.sender.has(factory)) {
|
|
122
|
-
throw new RpcError(`A Factory at ${factory} in this UserOperation is used as a sender entity in another UserOperation currently in mempool.`,
|
|
156
|
+
throw new RpcError(`A Factory at ${factory} in this UserOperation is used as a sender entity in another UserOperation currently in mempool.`, ERC7769Errors.OpcodeValidation);
|
|
123
157
|
}
|
|
124
|
-
return Promise.resolve();
|
|
125
158
|
}
|
|
126
159
|
async getKnownEntities(entryPoint) {
|
|
127
160
|
// TODO: this won't work with redis
|
|
@@ -151,21 +184,13 @@ export class Mempool {
|
|
|
151
184
|
return entities;
|
|
152
185
|
}
|
|
153
186
|
// === Methods for adding userOps / creating bundles === //
|
|
154
|
-
async add(
|
|
155
|
-
const userOpHash =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
chainId: this.config.chainId,
|
|
159
|
-
publicClient: this.config.publicClient
|
|
160
|
-
});
|
|
161
|
-
// Check if the exact same userOperation is already in the mempool.
|
|
162
|
-
if (await this.store.isInMempool({ userOpHash, entryPoint })) {
|
|
163
|
-
return [false, "Already known"];
|
|
164
|
-
}
|
|
165
|
-
// Check if there is a conflicting userOp already being processed
|
|
166
|
-
const validation = await this.store.validateSubmittedOrProcessing({
|
|
187
|
+
async add({ userOpInfo, entryPoint }) {
|
|
188
|
+
const { userOp, userOpHash } = userOpInfo;
|
|
189
|
+
// Check if the userOp is already known or conflicts with existing operations
|
|
190
|
+
const validation = await this.store.checkDuplicatesAndConflicts({
|
|
167
191
|
entryPoint,
|
|
168
|
-
userOp
|
|
192
|
+
userOp,
|
|
193
|
+
userOpHash
|
|
169
194
|
});
|
|
170
195
|
if (!validation.valid) {
|
|
171
196
|
return [false, validation.reason];
|
|
@@ -176,7 +201,7 @@ export class Mempool {
|
|
|
176
201
|
userOp
|
|
177
202
|
});
|
|
178
203
|
if (conflicting) {
|
|
179
|
-
const { userOpInfo,
|
|
204
|
+
const { userOpInfo, conflictReason } = conflicting;
|
|
180
205
|
const conflictingUserOp = userOpInfo.userOp;
|
|
181
206
|
const hasHigherPriorityFee = userOp.maxPriorityFeePerGas >=
|
|
182
207
|
scaleBigIntByPercent(conflictingUserOp.maxPriorityFeePerGas, 110n);
|
|
@@ -184,13 +209,23 @@ export class Mempool {
|
|
|
184
209
|
scaleBigIntByPercent(conflictingUserOp.maxFeePerGas, 110n);
|
|
185
210
|
const hasHigherFees = hasHigherPriorityFee && hasHigherMaxFee;
|
|
186
211
|
if (!hasHigherFees) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
212
|
+
let message;
|
|
213
|
+
if (conflictReason === "conflicting_deployment") {
|
|
214
|
+
message =
|
|
215
|
+
"AA10 sender already constructed: A conflicting userOperation with initCode for this sender is already in the mempool";
|
|
216
|
+
}
|
|
217
|
+
else if (conflictReason === "conflicting_7702_auth") {
|
|
218
|
+
message =
|
|
219
|
+
"AA10 sender already constructed: Sender already has an inflight EIP-7702 authorization";
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
message =
|
|
223
|
+
"AA25 invalid account nonce: User operation already present in mempool";
|
|
224
|
+
}
|
|
190
225
|
// Re-add to outstanding as it wasn't replaced
|
|
191
226
|
await this.store.addOutstanding({
|
|
192
227
|
entryPoint,
|
|
193
|
-
|
|
228
|
+
userOpInfos: [conflicting.userOpInfo]
|
|
194
229
|
});
|
|
195
230
|
return [false, `${message}, bump the gas price by minimum 10%`];
|
|
196
231
|
}
|
|
@@ -199,15 +234,9 @@ export class Mempool {
|
|
|
199
234
|
await this.reputationManager.increaseUserOpSeenStatus(userOp, entryPoint);
|
|
200
235
|
await this.store.addOutstanding({
|
|
201
236
|
entryPoint,
|
|
202
|
-
|
|
203
|
-
userOp,
|
|
204
|
-
userOpHash,
|
|
205
|
-
referencedContracts,
|
|
206
|
-
addedToMempool: Date.now(),
|
|
207
|
-
submissionAttempts: 0
|
|
208
|
-
}
|
|
237
|
+
userOpInfos: [userOpInfo]
|
|
209
238
|
});
|
|
210
|
-
await this.
|
|
239
|
+
await this.statusManager.set([userOpHash], {
|
|
211
240
|
status: "not_submitted",
|
|
212
241
|
transactionHash: null
|
|
213
242
|
});
|
|
@@ -215,7 +244,33 @@ export class Mempool {
|
|
|
215
244
|
return [true, ""];
|
|
216
245
|
}
|
|
217
246
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
218
|
-
async shouldSkip({ userOpInfo, paymasterDeposit, stakedEntityCount, knownEntities, senders, storageMap, entryPoint }) {
|
|
247
|
+
async shouldSkip({ userOpInfo, paymasterDeposit, touchedEip7702Auth, stakedEntityCount, knownEntities, senders, storageMap, entryPoint }) {
|
|
248
|
+
const { userOp, userOpHash, referencedContracts } = userOpInfo;
|
|
249
|
+
// Check conflicting EIP-7702 auths (same sender, different delegate address)
|
|
250
|
+
if (userOp.eip7702Auth) {
|
|
251
|
+
const auth = getEip7702AuthAddress(userOp.eip7702Auth);
|
|
252
|
+
const existingAuth = touchedEip7702Auth.get(userOp.sender);
|
|
253
|
+
if (existingAuth && existingAuth !== auth) {
|
|
254
|
+
this.logger.warn({
|
|
255
|
+
userOpHash,
|
|
256
|
+
conflictingAuth: auth,
|
|
257
|
+
existingAuth
|
|
258
|
+
}, "Conflicting EIP-7702 auths");
|
|
259
|
+
return {
|
|
260
|
+
skip: true,
|
|
261
|
+
removeOutstanding: false,
|
|
262
|
+
paymasterDeposit,
|
|
263
|
+
touchedEip7702Auth,
|
|
264
|
+
stakedEntityCount,
|
|
265
|
+
knownEntities,
|
|
266
|
+
senders,
|
|
267
|
+
storageMap
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (!existingAuth) {
|
|
271
|
+
touchedEip7702Auth.set(userOp.sender, auth);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
219
274
|
if (!this.config.safeMode) {
|
|
220
275
|
return {
|
|
221
276
|
skip: false,
|
|
@@ -223,10 +278,10 @@ export class Mempool {
|
|
|
223
278
|
stakedEntityCount,
|
|
224
279
|
knownEntities,
|
|
225
280
|
senders,
|
|
226
|
-
storageMap
|
|
281
|
+
storageMap,
|
|
282
|
+
touchedEip7702Auth
|
|
227
283
|
};
|
|
228
284
|
}
|
|
229
|
-
const { userOp, userOpHash, referencedContracts } = userOpInfo;
|
|
230
285
|
const isUserOpV06 = isVersion06(userOp);
|
|
231
286
|
const paymaster = isUserOpV06
|
|
232
287
|
? getAddressFromInitCodeOrPaymasterAndData(userOp.paymasterAndData)
|
|
@@ -245,7 +300,8 @@ export class Mempool {
|
|
|
245
300
|
stakedEntityCount,
|
|
246
301
|
knownEntities,
|
|
247
302
|
senders,
|
|
248
|
-
storageMap
|
|
303
|
+
storageMap,
|
|
304
|
+
touchedEip7702Auth
|
|
249
305
|
};
|
|
250
306
|
}
|
|
251
307
|
if (paymasterStatus === ReputationStatuses.throttled &&
|
|
@@ -261,7 +317,8 @@ export class Mempool {
|
|
|
261
317
|
stakedEntityCount,
|
|
262
318
|
knownEntities,
|
|
263
319
|
senders,
|
|
264
|
-
storageMap
|
|
320
|
+
storageMap,
|
|
321
|
+
touchedEip7702Auth
|
|
265
322
|
};
|
|
266
323
|
}
|
|
267
324
|
if (factoryStatus === ReputationStatuses.throttled &&
|
|
@@ -277,7 +334,8 @@ export class Mempool {
|
|
|
277
334
|
stakedEntityCount,
|
|
278
335
|
knownEntities,
|
|
279
336
|
senders,
|
|
280
|
-
storageMap
|
|
337
|
+
storageMap,
|
|
338
|
+
touchedEip7702Auth
|
|
281
339
|
};
|
|
282
340
|
}
|
|
283
341
|
if (senders.has(userOp.sender) &&
|
|
@@ -292,14 +350,15 @@ export class Mempool {
|
|
|
292
350
|
stakedEntityCount,
|
|
293
351
|
knownEntities,
|
|
294
352
|
senders,
|
|
295
|
-
storageMap
|
|
353
|
+
storageMap,
|
|
354
|
+
touchedEip7702Auth
|
|
296
355
|
};
|
|
297
356
|
}
|
|
298
357
|
let validationResult;
|
|
299
358
|
try {
|
|
300
359
|
let queuedUserOps = [];
|
|
301
360
|
if (!isUserOpV06) {
|
|
302
|
-
queuedUserOps = await this.
|
|
361
|
+
queuedUserOps = await this.getQueuedOutstandingUserOps({
|
|
303
362
|
userOp,
|
|
304
363
|
entryPoint
|
|
305
364
|
});
|
|
@@ -316,7 +375,7 @@ export class Mempool {
|
|
|
316
375
|
userOpHash,
|
|
317
376
|
error: JSON.stringify(e)
|
|
318
377
|
}, "2nd Validation error");
|
|
319
|
-
this.store.removeOutstanding({ entryPoint, userOpHash });
|
|
378
|
+
await this.store.removeOutstanding({ entryPoint, userOpHash });
|
|
320
379
|
this.reputationManager.decreaseUserOpSeenStatus(userOp, entryPoint, e instanceof RpcError ? e.message : JSON.stringify(e));
|
|
321
380
|
return {
|
|
322
381
|
skip: true,
|
|
@@ -324,7 +383,8 @@ export class Mempool {
|
|
|
324
383
|
stakedEntityCount,
|
|
325
384
|
knownEntities,
|
|
326
385
|
senders,
|
|
327
|
-
storageMap
|
|
386
|
+
storageMap,
|
|
387
|
+
touchedEip7702Auth
|
|
328
388
|
};
|
|
329
389
|
}
|
|
330
390
|
for (const storageAddress of Object.keys(validationResult.storageMap)) {
|
|
@@ -341,7 +401,8 @@ export class Mempool {
|
|
|
341
401
|
stakedEntityCount,
|
|
342
402
|
knownEntities,
|
|
343
403
|
senders,
|
|
344
|
-
storageMap
|
|
404
|
+
storageMap,
|
|
405
|
+
touchedEip7702Auth
|
|
345
406
|
};
|
|
346
407
|
}
|
|
347
408
|
}
|
|
@@ -369,7 +430,8 @@ export class Mempool {
|
|
|
369
430
|
stakedEntityCount,
|
|
370
431
|
knownEntities,
|
|
371
432
|
senders,
|
|
372
|
-
storageMap
|
|
433
|
+
storageMap,
|
|
434
|
+
touchedEip7702Auth
|
|
373
435
|
};
|
|
374
436
|
}
|
|
375
437
|
stakedEntityCount[paymaster] =
|
|
@@ -386,15 +448,18 @@ export class Mempool {
|
|
|
386
448
|
stakedEntityCount,
|
|
387
449
|
knownEntities,
|
|
388
450
|
senders,
|
|
389
|
-
storageMap
|
|
451
|
+
storageMap,
|
|
452
|
+
touchedEip7702Auth
|
|
390
453
|
};
|
|
391
454
|
}
|
|
392
455
|
async getBundles(maxBundleCount) {
|
|
456
|
+
if (this.isShuttingDown) {
|
|
457
|
+
return [];
|
|
458
|
+
}
|
|
393
459
|
const bundlePromises = this.config.entrypoints.map(async (entryPoint) => {
|
|
394
460
|
return await this.process({
|
|
395
461
|
entryPoint,
|
|
396
462
|
maxGasLimit: this.config.maxGasPerBundle,
|
|
397
|
-
minOpsPerBundle: 1,
|
|
398
463
|
maxBundleCount
|
|
399
464
|
});
|
|
400
465
|
});
|
|
@@ -403,34 +468,48 @@ export class Mempool {
|
|
|
403
468
|
return bundles;
|
|
404
469
|
}
|
|
405
470
|
// Returns a bundle of userOperations in array format.
|
|
406
|
-
async process({ maxGasLimit, entryPoint,
|
|
407
|
-
|
|
408
|
-
const firstOp = await this.store.peekOutstanding(entryPoint);
|
|
409
|
-
if (!firstOp) {
|
|
471
|
+
async process({ maxGasLimit, entryPoint, maxBundleCount }) {
|
|
472
|
+
if (this.isShuttingDown) {
|
|
410
473
|
return [];
|
|
411
474
|
}
|
|
412
|
-
// Get EntryPoint version
|
|
413
475
|
const bundles = [];
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
476
|
+
const batchSize = this.config.mempoolPopBatchSize;
|
|
477
|
+
// Pop batch of userOps.
|
|
478
|
+
const poppedUserOps = await this.store.popOutstanding(entryPoint, batchSize);
|
|
479
|
+
if (poppedUserOps.length === 0) {
|
|
480
|
+
return [];
|
|
481
|
+
}
|
|
482
|
+
// Track popped userOps as processing immediately to prevent loss on shutdown
|
|
483
|
+
await this.store.addProcessing({
|
|
484
|
+
entryPoint,
|
|
485
|
+
userOpInfos: poppedUserOps
|
|
486
|
+
});
|
|
487
|
+
// Keep track of unused ops from the batch
|
|
488
|
+
const unusedUserOps = [...poppedUserOps];
|
|
489
|
+
while (unusedUserOps.length > 0) {
|
|
490
|
+
// If maxBundles is set and we reached the limit, put back all unused ops and break.
|
|
419
491
|
if (maxBundleCount && bundles.length >= maxBundleCount) {
|
|
492
|
+
if (unusedUserOps.length > 0) {
|
|
493
|
+
// Remove from processing before putting back to outstanding
|
|
494
|
+
await this.store.removeProcessing({
|
|
495
|
+
entryPoint,
|
|
496
|
+
userOpInfos: unusedUserOps
|
|
497
|
+
});
|
|
498
|
+
await this.store.addOutstanding({
|
|
499
|
+
entryPoint,
|
|
500
|
+
userOpInfos: unusedUserOps
|
|
501
|
+
});
|
|
502
|
+
unusedUserOps.length = 0;
|
|
503
|
+
}
|
|
420
504
|
break;
|
|
421
505
|
}
|
|
422
|
-
//
|
|
423
|
-
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
version = "0.6";
|
|
432
|
-
}
|
|
433
|
-
// Setup for next bundle
|
|
506
|
+
// Peek next userOp from unused batch.
|
|
507
|
+
const nextUserOp = unusedUserOps[0];
|
|
508
|
+
if (!nextUserOp)
|
|
509
|
+
break;
|
|
510
|
+
// Derive version.
|
|
511
|
+
const version = getViemEntryPointVersion(nextUserOp.userOp, entryPoint);
|
|
512
|
+
// Setup next bundle.
|
|
434
513
|
const currentBundle = {
|
|
435
514
|
entryPoint,
|
|
436
515
|
version,
|
|
@@ -438,33 +517,21 @@ export class Mempool {
|
|
|
438
517
|
submissionAttempts: 0
|
|
439
518
|
};
|
|
440
519
|
let gasUsed = 0n;
|
|
520
|
+
let touchedEip7702Auth = new Map();
|
|
441
521
|
let paymasterDeposit = {};
|
|
442
522
|
let stakedEntityCount = {};
|
|
443
523
|
let senders = new Set();
|
|
444
524
|
let knownEntities = await this.getKnownEntities(entryPoint);
|
|
445
525
|
let storageMap = {};
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
// Keep adding ops to current bundle
|
|
450
|
-
while (await this.store.peekOutstanding(entryPoint)) {
|
|
451
|
-
const userOpInfo = await this.store.popOutstanding(entryPoint);
|
|
452
|
-
if (!userOpInfo) {
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
if (seenOps.has(userOpInfo.userOpHash)) {
|
|
456
|
-
breakLoop = true;
|
|
457
|
-
await this.store.addOutstanding({
|
|
458
|
-
entryPoint,
|
|
459
|
-
userOpInfo
|
|
460
|
-
});
|
|
526
|
+
while (unusedUserOps.length > 0) {
|
|
527
|
+
const currentUserOp = unusedUserOps.shift();
|
|
528
|
+
if (!currentUserOp)
|
|
461
529
|
break;
|
|
462
|
-
}
|
|
463
|
-
seenOps.add(userOpInfo.userOpHash);
|
|
464
|
-
const { userOp } = userOpInfo;
|
|
530
|
+
const { userOp } = currentUserOp;
|
|
465
531
|
// Check if we should skip this operation
|
|
466
532
|
const skipResult = await this.shouldSkip({
|
|
467
|
-
userOpInfo,
|
|
533
|
+
userOpInfo: currentUserOp,
|
|
534
|
+
touchedEip7702Auth,
|
|
468
535
|
paymasterDeposit,
|
|
469
536
|
stakedEntityCount,
|
|
470
537
|
knownEntities,
|
|
@@ -473,26 +540,33 @@ export class Mempool {
|
|
|
473
540
|
entryPoint
|
|
474
541
|
});
|
|
475
542
|
if (skipResult.skip) {
|
|
543
|
+
// Remove from processing since it's going back to outstanding or being dropped
|
|
544
|
+
await this.store.removeProcessing({
|
|
545
|
+
entryPoint,
|
|
546
|
+
userOpInfos: [currentUserOp]
|
|
547
|
+
});
|
|
476
548
|
// Re-add to outstanding
|
|
477
549
|
if (!skipResult.removeOutstanding) {
|
|
478
550
|
await this.store.addOutstanding({
|
|
479
551
|
entryPoint,
|
|
480
|
-
|
|
552
|
+
userOpInfos: [currentUserOp]
|
|
481
553
|
});
|
|
482
554
|
}
|
|
555
|
+
// Continue with next op from batch
|
|
483
556
|
continue;
|
|
484
557
|
}
|
|
485
|
-
const beneficiary = this.config.utilityPrivateKey?.address ||
|
|
486
|
-
privateKeyToAddress(generatePrivateKey());
|
|
487
558
|
gasUsed += calculateAA95GasFloor({
|
|
488
559
|
userOps: [userOp],
|
|
489
|
-
beneficiary
|
|
560
|
+
beneficiary: this.config.utilityWalletAddress
|
|
490
561
|
});
|
|
491
|
-
//
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
562
|
+
// Check bundle gasLimit if bundle is not empty.
|
|
563
|
+
// The executor scales the bundle's tx.gasLimit by
|
|
564
|
+
// executorGasMultiplier, compare against the scaled value
|
|
565
|
+
// so the final transaction stays within maxGasLimit.
|
|
566
|
+
if (currentBundle.userOps.length > 0 &&
|
|
567
|
+
scaleBigIntByPercent(gasUsed, this.config.executorGasMultiplier) > maxGasLimit) {
|
|
568
|
+
// Put current op back to front of unused for next bundle
|
|
569
|
+
unusedUserOps.unshift(currentUserOp);
|
|
496
570
|
break;
|
|
497
571
|
}
|
|
498
572
|
// Update state based on skip result
|
|
@@ -501,10 +575,20 @@ export class Mempool {
|
|
|
501
575
|
knownEntities = skipResult.knownEntities;
|
|
502
576
|
senders = skipResult.senders;
|
|
503
577
|
storageMap = skipResult.storageMap;
|
|
578
|
+
touchedEip7702Auth = skipResult.touchedEip7702Auth;
|
|
504
579
|
this.reputationManager.decreaseUserOpCount(userOp);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
580
|
+
// Add userOp to current bundle.
|
|
581
|
+
currentBundle.userOps.push(currentUserOp);
|
|
582
|
+
// Try to fetch more userOps if we've exhausted this batch.
|
|
583
|
+
if (unusedUserOps.length === 0) {
|
|
584
|
+
const morePoppedOps = await this.store.popOutstanding(entryPoint, batchSize);
|
|
585
|
+
// Track newly popped userOps as processing immediately
|
|
586
|
+
await this.store.addProcessing({
|
|
587
|
+
entryPoint,
|
|
588
|
+
userOpInfos: morePoppedOps
|
|
589
|
+
});
|
|
590
|
+
unusedUserOps.push(...morePoppedOps);
|
|
591
|
+
}
|
|
508
592
|
}
|
|
509
593
|
if (currentBundle.userOps.length > 0) {
|
|
510
594
|
bundles.push(currentBundle);
|
|
@@ -512,12 +596,18 @@ export class Mempool {
|
|
|
512
596
|
}
|
|
513
597
|
return bundles;
|
|
514
598
|
}
|
|
599
|
+
async clearProcessing() {
|
|
600
|
+
for (const entryPoint of this.config.entrypoints) {
|
|
601
|
+
await this.store.clearAllProcessing(entryPoint);
|
|
602
|
+
this.logger.info({ entryPoint }, "[SHUTDOWN] Cleared processing state during startup");
|
|
603
|
+
}
|
|
604
|
+
}
|
|
515
605
|
clear() {
|
|
516
606
|
for (const entryPoint of this.config.entrypoints) {
|
|
517
607
|
this.store.clearOutstanding(entryPoint);
|
|
518
608
|
}
|
|
519
609
|
}
|
|
520
|
-
async
|
|
610
|
+
async getQueuedOutstandingUserOps(args) {
|
|
521
611
|
return await this.store.getQueuedOutstandingUserOps(args);
|
|
522
612
|
}
|
|
523
613
|
}
|