@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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { getNonceKeyAndSequence, isDeployment, isVersion07 } from "../../utils/userop.js";
|
|
2
|
+
const senderNonceSlot = (userOp) => {
|
|
3
|
+
const sender = userOp.sender;
|
|
4
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
5
|
+
return `${sender}-${nonceKey}`;
|
|
6
|
+
};
|
|
7
|
+
export class MemoryOutstanding {
|
|
8
|
+
pendingOps = new Map();
|
|
9
|
+
hashLookup = new Map();
|
|
10
|
+
logger;
|
|
11
|
+
config;
|
|
12
|
+
priorityQueue = [];
|
|
13
|
+
constructor(config) {
|
|
14
|
+
// Setup args for getting userOpHash
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.logger = config.getLogger({ module: "memory-outstanding-queue" }, {
|
|
17
|
+
level: config.logLevel
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
dump() {
|
|
21
|
+
return [...Array.from(this.pendingOps.values()).flat()];
|
|
22
|
+
}
|
|
23
|
+
// Adds userOp to queue and maintains sorting by gas price.
|
|
24
|
+
addToPriorityQueue(userOpInfo) {
|
|
25
|
+
this.priorityQueue.push(userOpInfo);
|
|
26
|
+
this.priorityQueue.sort((a, b) => {
|
|
27
|
+
const userOpA = a.userOp;
|
|
28
|
+
const userOpB = b.userOp;
|
|
29
|
+
return Number(userOpA.maxFeePerGas - userOpB.maxFeePerGas);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
validateQueuedLimit(userOp) {
|
|
33
|
+
const outstandingOps = this.dump();
|
|
34
|
+
const parallelUserOpsCount = outstandingOps.filter((userOpInfo) => {
|
|
35
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
36
|
+
return mempoolUserOp.sender === userOp.sender;
|
|
37
|
+
}).length;
|
|
38
|
+
if (parallelUserOpsCount > this.config.mempoolMaxQueuedOps) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
validateParallelLimit(userOp) {
|
|
44
|
+
const outstandingOps = this.dump();
|
|
45
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
46
|
+
const queuedUserOpsCount = outstandingOps.filter((userOpInfo) => {
|
|
47
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
48
|
+
const [opNonceKey] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
49
|
+
return (mempoolUserOp.sender === userOp.sender &&
|
|
50
|
+
opNonceKey === nonceKey);
|
|
51
|
+
}).length;
|
|
52
|
+
if (queuedUserOpsCount > this.config.mempoolMaxParallelOps) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
async popConflicting(userOp) {
|
|
58
|
+
const outstandingOps = this.dump();
|
|
59
|
+
for (const existingUserOpInfo of outstandingOps) {
|
|
60
|
+
const { userOp: existingUserOp, userOpHash: existingUserOpHash } = existingUserOpInfo;
|
|
61
|
+
const isSameSender = existingUserOp.sender === userOp.sender;
|
|
62
|
+
// Check each conflict type.
|
|
63
|
+
const isConflictingNonce = isSameSender && existingUserOp.nonce === userOp.nonce;
|
|
64
|
+
const isConflictingEip7702Auth = isSameSender && userOp.eip7702Auth && existingUserOp.eip7702Auth;
|
|
65
|
+
const isConflictingDeployment = isSameSender &&
|
|
66
|
+
isDeployment(userOp) &&
|
|
67
|
+
isDeployment(existingUserOp);
|
|
68
|
+
if (isConflictingNonce) {
|
|
69
|
+
const removed = await this.remove([existingUserOpHash]);
|
|
70
|
+
if (removed.length > 0) {
|
|
71
|
+
return {
|
|
72
|
+
conflictReason: "conflicting_nonce",
|
|
73
|
+
userOpInfo: removed[0]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (isConflictingEip7702Auth) {
|
|
78
|
+
const removed = await this.remove([existingUserOpHash]);
|
|
79
|
+
if (removed.length > 0) {
|
|
80
|
+
return {
|
|
81
|
+
conflictReason: "conflicting_7702_auth",
|
|
82
|
+
userOpInfo: removed[0]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (isConflictingDeployment) {
|
|
87
|
+
const removed = await this.remove([existingUserOpHash]);
|
|
88
|
+
if (removed.length > 0) {
|
|
89
|
+
return {
|
|
90
|
+
conflictReason: "conflicting_deployment",
|
|
91
|
+
userOpInfo: removed[0]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
async contains(userOpHash) {
|
|
99
|
+
return this.hashLookup.has(userOpHash);
|
|
100
|
+
}
|
|
101
|
+
pop(count) {
|
|
102
|
+
const results = [];
|
|
103
|
+
for (let i = 0; i < count; i++) {
|
|
104
|
+
const userOpInfo = this.priorityQueue.shift();
|
|
105
|
+
if (!userOpInfo) {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
109
|
+
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
110
|
+
// This should never throw.
|
|
111
|
+
if (!backlogOps?.shift()) {
|
|
112
|
+
throw new Error("FATAL: No pending userOps for sender");
|
|
113
|
+
}
|
|
114
|
+
// Move next pending userOp into priorityQueue if exist.
|
|
115
|
+
if (backlogOps.length > 0) {
|
|
116
|
+
this.addToPriorityQueue(backlogOps[0]);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Cleanup if no more ops for this slot
|
|
120
|
+
this.pendingOps.delete(pendingOpsSlot);
|
|
121
|
+
}
|
|
122
|
+
// Remove from hash lookup
|
|
123
|
+
this.hashLookup.delete(userOpInfo.userOpHash);
|
|
124
|
+
results.push(userOpInfo);
|
|
125
|
+
}
|
|
126
|
+
return Promise.resolve(results);
|
|
127
|
+
}
|
|
128
|
+
async add(userOpInfos) {
|
|
129
|
+
if (userOpInfos.length === 0)
|
|
130
|
+
return;
|
|
131
|
+
for (const userOpInfo of userOpInfos) {
|
|
132
|
+
const { userOp, userOpHash } = userOpInfo;
|
|
133
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
134
|
+
const pendingOpsSlot = senderNonceSlot(userOp);
|
|
135
|
+
const backlogOps = (() => {
|
|
136
|
+
if (this.pendingOps.has(pendingOpsSlot)) {
|
|
137
|
+
return this.pendingOps.get(pendingOpsSlot);
|
|
138
|
+
}
|
|
139
|
+
this.pendingOps.set(pendingOpsSlot, []);
|
|
140
|
+
return this.pendingOps.get(pendingOpsSlot);
|
|
141
|
+
})();
|
|
142
|
+
if (!backlogOps) {
|
|
143
|
+
throw new Error("FATAL: No pending operations found for userOpHash");
|
|
144
|
+
}
|
|
145
|
+
// Note: the userOpInfo is always added to backlogOps, because we are pushing to a reference
|
|
146
|
+
backlogOps.push(userOpInfo);
|
|
147
|
+
// Add to hash lookup for O(1) contains checks
|
|
148
|
+
this.hashLookup.set(userOpHash, userOpInfo);
|
|
149
|
+
// Sort backlogOps by nonce sequence
|
|
150
|
+
backlogOps.sort((a, b) => {
|
|
151
|
+
const [, aNonceSeq] = getNonceKeyAndSequence(a.userOp.nonce);
|
|
152
|
+
const [, bNonceSeq] = getNonceKeyAndSequence(b.userOp.nonce);
|
|
153
|
+
return Number(aNonceSeq - bNonceSeq);
|
|
154
|
+
});
|
|
155
|
+
const lowestUserOpHash = backlogOps[0].userOpHash;
|
|
156
|
+
// If lowest, remove any existing userOp with same sender and nonceKey and add current userOp to priorityQueue.
|
|
157
|
+
if (lowestUserOpHash === userOpHash) {
|
|
158
|
+
this.priorityQueue = this.priorityQueue.filter((userOpInfo) => {
|
|
159
|
+
const pendingUserOp = userOpInfo.userOp;
|
|
160
|
+
const isSameSender = pendingUserOp.sender === userOp.sender;
|
|
161
|
+
const isSameNonceKey = getNonceKeyAndSequence(pendingUserOp.nonce)[0] ===
|
|
162
|
+
nonceKey;
|
|
163
|
+
return !(isSameSender && isSameNonceKey);
|
|
164
|
+
});
|
|
165
|
+
this.addToPriorityQueue(userOpInfo);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async getQueuedUserOps(userOp) {
|
|
170
|
+
const [nonceKey, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
171
|
+
const outstandingOps = this.dump();
|
|
172
|
+
const outstanding = outstandingOps.filter((userOpInfo) => {
|
|
173
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
174
|
+
const [mempoolNonceKey, mempoolNonceSequence] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
175
|
+
const isSameSender = mempoolUserOp.sender === userOp.sender;
|
|
176
|
+
const isSameNonceKey = mempoolNonceKey === nonceKey;
|
|
177
|
+
const isSameNonce = mempoolNonceSequence === nonceSequence;
|
|
178
|
+
// Skip the same userOp.
|
|
179
|
+
if (isSameSender && isSameNonceKey && isSameNonce) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
// Include userOps from same sender with lower nonce.
|
|
183
|
+
if (isSameSender && isSameNonceKey) {
|
|
184
|
+
return mempoolNonceSequence < nonceSequence;
|
|
185
|
+
}
|
|
186
|
+
// For v0.7+, include ops with same paymaster (unless ignored).
|
|
187
|
+
if (isVersion07(userOp) && isVersion07(mempoolUserOp)) {
|
|
188
|
+
const hasSamePaymaster = userOp.paymaster !== null &&
|
|
189
|
+
mempoolUserOp.paymaster !== null &&
|
|
190
|
+
mempoolUserOp.paymaster === userOp.paymaster;
|
|
191
|
+
const isPaymasterIgnored = userOp.paymaster !== null &&
|
|
192
|
+
this.config.ignoredPaymasters.includes(userOp.paymaster);
|
|
193
|
+
return hasSamePaymaster && !isPaymasterIgnored;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
});
|
|
197
|
+
return outstanding
|
|
198
|
+
.sort((a, b) => {
|
|
199
|
+
const aUserOp = a.userOp;
|
|
200
|
+
const bUserOp = b.userOp;
|
|
201
|
+
const [, aNonceValue] = getNonceKeyAndSequence(aUserOp.nonce);
|
|
202
|
+
const [, bNonceValue] = getNonceKeyAndSequence(bUserOp.nonce);
|
|
203
|
+
return Number(aNonceValue - bNonceValue);
|
|
204
|
+
})
|
|
205
|
+
.map((userOpInfo) => userOpInfo.userOp);
|
|
206
|
+
}
|
|
207
|
+
async remove(userOpHashes) {
|
|
208
|
+
if (userOpHashes.length === 0) {
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
211
|
+
const removedOps = [];
|
|
212
|
+
for (const userOpHash of userOpHashes) {
|
|
213
|
+
// Look up userOp in hash lookup first
|
|
214
|
+
const userOpInfo = this.hashLookup.get(userOpHash);
|
|
215
|
+
if (!userOpInfo) {
|
|
216
|
+
this.logger.info(`tried to remove non-existent user op from mempool: ${userOpHash}`);
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
220
|
+
// Find and remove from pending ops
|
|
221
|
+
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
222
|
+
if (!backlogOps) {
|
|
223
|
+
throw new Error(`FATAL: No pending operations found for userOpHash ${userOpHash}`);
|
|
224
|
+
}
|
|
225
|
+
const backlogIndex = backlogOps.findIndex((info) => info.userOpHash === userOpHash);
|
|
226
|
+
if (backlogIndex === -1) {
|
|
227
|
+
throw new Error(`FATAL: UserOp with hash ${userOpHash} not found in backlog`);
|
|
228
|
+
}
|
|
229
|
+
backlogOps.splice(backlogIndex, 1);
|
|
230
|
+
// Remove from priority queue if present
|
|
231
|
+
const priorityQueueIndex = this.priorityQueue.findIndex((info) => info.userOpHash === userOpHash);
|
|
232
|
+
if (priorityQueueIndex !== -1) {
|
|
233
|
+
this.priorityQueue.splice(priorityQueueIndex, 1);
|
|
234
|
+
}
|
|
235
|
+
// Remove from hash lookup
|
|
236
|
+
this.hashLookup.delete(userOpHash);
|
|
237
|
+
// If this was the first operation and there are more in the backlog,
|
|
238
|
+
// add the new first operation to the priority queue
|
|
239
|
+
if (backlogIndex === 0 && backlogOps.length > 0) {
|
|
240
|
+
this.addToPriorityQueue(backlogOps[0]);
|
|
241
|
+
}
|
|
242
|
+
// Clean up empty slot
|
|
243
|
+
if (backlogOps.length === 0) {
|
|
244
|
+
this.pendingOps.delete(pendingOpsSlot);
|
|
245
|
+
}
|
|
246
|
+
removedOps.push(userOpInfo);
|
|
247
|
+
}
|
|
248
|
+
return removedOps;
|
|
249
|
+
}
|
|
250
|
+
async dumpLocal() {
|
|
251
|
+
return this.dump();
|
|
252
|
+
}
|
|
253
|
+
async clear() {
|
|
254
|
+
this.priorityQueue = [];
|
|
255
|
+
this.pendingOps.clear();
|
|
256
|
+
this.hashLookup.clear();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export const createMemoryOutstandingQueue = ({ config, logger }) => {
|
|
260
|
+
logger.info("Using memory for outstanding mempool");
|
|
261
|
+
return new MemoryOutstanding(config);
|
|
262
|
+
};
|
|
263
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../store/outstanding/memory.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACd,MAAM,oBAAoB,CAAA;AAG3B,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAE,EAAE;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IAC5B,MAAM,CAAC,QAAQ,CAAC,GAAG,sBAAsB,CAAC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AAC,CAAA;YACpD,CAAC;YAED,0BAA0B;YAC1B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;YAElC,qEAAqE;YACrE,oDAAoD;YACpD,IAAI,YAAY,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;YAC1C,CAAC;YAED,sBAAsB;YACtB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO,UAAU,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IAC3B,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EACzC,MAAM,EACN,MAAM,EAIT,EAAoB,EAAE;IACnB,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IACnD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Address } from "../../types/index.js";
|
|
2
|
+
import type { Logger } from "pino";
|
|
3
|
+
import type { AltoConfig } from "../../createConfig.js";
|
|
4
|
+
import type { OutstandingStore } from "./types.js";
|
|
5
|
+
export declare const createRedisOutstandingQueue: ({ config, entryPoint, redisEndpoint, logger }: {
|
|
6
|
+
config: AltoConfig;
|
|
7
|
+
entryPoint: Address;
|
|
8
|
+
redisEndpoint: string;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
}) => OutstandingStore;
|
|
11
|
+
//# sourceMappingURL=redis.d.ts.map
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { userOpInfoSchema } from "../../types/index.js";
|
|
2
|
+
import { getNonceKeyAndSequence, isDeployment } from "../../utils/index.js";
|
|
3
|
+
import { Redis } from "ioredis";
|
|
4
|
+
import { toHex } from "viem/utils";
|
|
5
|
+
const serialize = (userOpInfo) => {
|
|
6
|
+
return JSON.stringify(userOpInfo, (_, value) => typeof value === "bigint" ? toHex(value) : value);
|
|
7
|
+
};
|
|
8
|
+
const deserialize = (data) => {
|
|
9
|
+
const parsed = JSON.parse(data);
|
|
10
|
+
return userOpInfoSchema.parse(parsed);
|
|
11
|
+
};
|
|
12
|
+
class RedisOutstandingQueue {
|
|
13
|
+
redis;
|
|
14
|
+
senderNonceKeyPrefix; // sender + nonceKey -> userOpHash
|
|
15
|
+
readyQueue; // Queue of userOpHashes (sorted by composite of userOp.nonceSeq + userOp.maxFeePerGas)
|
|
16
|
+
userOpHashMap; // userOpHash -> boolean
|
|
17
|
+
deploymentHashMap; // sender -> deployment userOpHash
|
|
18
|
+
eip7702AuthHashMap; // sender -> eip7702Auth userOpHash
|
|
19
|
+
senderNonceQueueTtl; // TTL for sender nonce queues in seconds
|
|
20
|
+
constructor({ config, entryPoint, redisEndpoint, logger }) {
|
|
21
|
+
this.redis = new Redis(redisEndpoint, {});
|
|
22
|
+
// Initialize Redis key names
|
|
23
|
+
const redisPrefix = `${config.redisKeyPrefix}:${config.chainId}:${entryPoint}:outstanding`;
|
|
24
|
+
this.readyQueue = `${redisPrefix}:ready-queue`;
|
|
25
|
+
this.senderNonceKeyPrefix = `${redisPrefix}:sender`;
|
|
26
|
+
this.userOpHashMap = `${redisPrefix}:userop-hash`;
|
|
27
|
+
this.deploymentHashMap = `${redisPrefix}:deployment-senders`;
|
|
28
|
+
this.eip7702AuthHashMap = `${redisPrefix}:eip7702-auth-senders`;
|
|
29
|
+
// Calculate TTL for sender nonce queues (10 blocks worth of time)
|
|
30
|
+
this.senderNonceQueueTtl = config.blockTime * 10;
|
|
31
|
+
logger.info({
|
|
32
|
+
readyQueueKey: this.readyQueue
|
|
33
|
+
}, "Using redis for outstanding mempool.");
|
|
34
|
+
}
|
|
35
|
+
// Returns queue index for this sender + nonceKey.
|
|
36
|
+
getSenderNonceQueue(userOp) {
|
|
37
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
38
|
+
return `${this.senderNonceKeyPrefix}:${userOp.sender}:${nonceKey}`;
|
|
39
|
+
}
|
|
40
|
+
// OutstandingStore methods
|
|
41
|
+
async contains(userOpHash) {
|
|
42
|
+
const exists = await this.redis.hexists(this.userOpHashMap, userOpHash);
|
|
43
|
+
return exists === 1;
|
|
44
|
+
}
|
|
45
|
+
async popConflicting(userOp) {
|
|
46
|
+
const { sender, nonce } = userOp;
|
|
47
|
+
const [nonceSeq] = getNonceKeyAndSequence(nonce);
|
|
48
|
+
const senderNonceQueue = this.getSenderNonceQueue(userOp);
|
|
49
|
+
const isDeploymentOp = isDeployment(userOp);
|
|
50
|
+
const hasEip7702Auth = !!userOp.eip7702Auth;
|
|
51
|
+
// Check all conflicts in a single round trip
|
|
52
|
+
const pipeline = this.redis.pipeline();
|
|
53
|
+
pipeline.zrangebyscore(senderNonceQueue, Number(nonceSeq), Number(nonceSeq));
|
|
54
|
+
pipeline.hget(this.deploymentHashMap, sender);
|
|
55
|
+
pipeline.hget(this.eip7702AuthHashMap, sender);
|
|
56
|
+
const results = await pipeline.exec();
|
|
57
|
+
if (!results)
|
|
58
|
+
return undefined;
|
|
59
|
+
const [nonceResult, deploymentResult, eip7702AuthResult] = results;
|
|
60
|
+
const conflictingNonceHashes = nonceResult?.[1] || [];
|
|
61
|
+
const existingDeploymentHash = deploymentResult?.[1];
|
|
62
|
+
const existingEip7702AuthHash = eip7702AuthResult?.[1];
|
|
63
|
+
// Check for conflicting nonce
|
|
64
|
+
if (conflictingNonceHashes.length > 0) {
|
|
65
|
+
const conflictingHash = conflictingNonceHashes[0];
|
|
66
|
+
const removedUserOps = await this.remove([conflictingHash]);
|
|
67
|
+
if (removedUserOps.length > 0) {
|
|
68
|
+
return {
|
|
69
|
+
conflictReason: "conflicting_nonce",
|
|
70
|
+
userOpInfo: removedUserOps[0]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Check for conflicting deployment
|
|
75
|
+
if (isDeploymentOp && existingDeploymentHash) {
|
|
76
|
+
const removedUserOps = await this.remove([existingDeploymentHash]);
|
|
77
|
+
if (removedUserOps.length > 0) {
|
|
78
|
+
return {
|
|
79
|
+
conflictReason: "conflicting_deployment",
|
|
80
|
+
userOpInfo: removedUserOps[0]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Check for conflicting EIP-7702 auth
|
|
85
|
+
if (hasEip7702Auth && existingEip7702AuthHash) {
|
|
86
|
+
const removedUserOps = await this.remove([existingEip7702AuthHash]);
|
|
87
|
+
if (removedUserOps.length > 0) {
|
|
88
|
+
return {
|
|
89
|
+
conflictReason: "conflicting_7702_auth",
|
|
90
|
+
userOpInfo: removedUserOps[0]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
async add(userOpInfos) {
|
|
97
|
+
if (userOpInfos.length === 0)
|
|
98
|
+
return;
|
|
99
|
+
// Use pipeline for atomic operations
|
|
100
|
+
const pipeline = this.redis.pipeline();
|
|
101
|
+
for (const userOpInfo of userOpInfos) {
|
|
102
|
+
const { userOp } = userOpInfo;
|
|
103
|
+
const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
104
|
+
const userOpHash = userOpInfo.userOpHash;
|
|
105
|
+
// Create composite score: nonceSequence in upper 32 bits, maxFeePerGas in lower 32 bits.
|
|
106
|
+
const score = (nonceSequence << 32n) | (userOp.maxFeePerGas & 0xffffffffn);
|
|
107
|
+
// Serialize userOpInfo for storage.
|
|
108
|
+
const serializedUserOp = serialize(userOpInfo);
|
|
109
|
+
// Add to main ready queue.
|
|
110
|
+
pipeline.zadd(this.readyQueue, Number(score), userOpHash);
|
|
111
|
+
// Add to sender+nonceKey index for fast lookup.
|
|
112
|
+
const senderNonceQueue = this.getSenderNonceQueue(userOp);
|
|
113
|
+
pipeline.zadd(senderNonceQueue, Number(nonceSequence), userOpHash);
|
|
114
|
+
pipeline.expire(senderNonceQueue, this.senderNonceQueueTtl);
|
|
115
|
+
// Add to userOpHash map.
|
|
116
|
+
pipeline.hset(this.userOpHashMap, userOpHash, serializedUserOp);
|
|
117
|
+
// Add sender to deployment hash if this is a deployment.
|
|
118
|
+
if (isDeployment(userOp)) {
|
|
119
|
+
pipeline.hset(this.deploymentHashMap, userOp.sender, userOpHash);
|
|
120
|
+
}
|
|
121
|
+
// Add sender to eip7702Auth hash if this has eip7702Auth.
|
|
122
|
+
if (userOp.eip7702Auth) {
|
|
123
|
+
pipeline.hset(this.eip7702AuthHashMap, userOp.sender, userOpHash);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
await pipeline.exec();
|
|
127
|
+
}
|
|
128
|
+
// Removes userOps given their hashes and returns the userOpInfo objects.
|
|
129
|
+
async remove(userOpHashes) {
|
|
130
|
+
if (userOpHashes.length === 0)
|
|
131
|
+
return [];
|
|
132
|
+
// Get all serialized data in parallel.
|
|
133
|
+
const pipeline = this.redis.pipeline();
|
|
134
|
+
for (const hash of userOpHashes) {
|
|
135
|
+
pipeline.hget(this.userOpHashMap, hash);
|
|
136
|
+
}
|
|
137
|
+
const serializedResults = await pipeline.exec();
|
|
138
|
+
const removedUserOps = [];
|
|
139
|
+
const removalPipeline = this.redis.pipeline();
|
|
140
|
+
// Process each userOp that exists.
|
|
141
|
+
for (let i = 0; i < userOpHashes.length; i++) {
|
|
142
|
+
const serialized = serializedResults?.[i]?.[1];
|
|
143
|
+
if (!serialized)
|
|
144
|
+
continue;
|
|
145
|
+
const userOpHash = userOpHashes[i];
|
|
146
|
+
const userOpInfo = deserialize(serialized);
|
|
147
|
+
const { userOp } = userOpInfo;
|
|
148
|
+
const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
149
|
+
const senderNonceQueue = this.getSenderNonceQueue(userOp);
|
|
150
|
+
const isDeploymentOp = isDeployment(userOp);
|
|
151
|
+
// Remove from ready queue.
|
|
152
|
+
removalPipeline.zrem(this.readyQueue, userOpHash);
|
|
153
|
+
// Remove from sender nonceKey queue.
|
|
154
|
+
removalPipeline.zremrangebyscore(senderNonceQueue, Number(nonceSequence), Number(nonceSequence));
|
|
155
|
+
// Remove from hash lookup.
|
|
156
|
+
removalPipeline.hdel(this.userOpHashMap, userOpHash);
|
|
157
|
+
// Remove sender from deployment hash if this was a deployment.
|
|
158
|
+
if (isDeploymentOp) {
|
|
159
|
+
removalPipeline.hdel(this.deploymentHashMap, userOp.sender);
|
|
160
|
+
}
|
|
161
|
+
// Remove sender from eip7702Auth hash if this had eip7702Auth.
|
|
162
|
+
if (userOp.eip7702Auth) {
|
|
163
|
+
removalPipeline.hdel(this.eip7702AuthHashMap, userOp.sender);
|
|
164
|
+
}
|
|
165
|
+
removedUserOps.push(userOpInfo);
|
|
166
|
+
}
|
|
167
|
+
// Execute all removals.
|
|
168
|
+
await removalPipeline.exec();
|
|
169
|
+
return removedUserOps;
|
|
170
|
+
}
|
|
171
|
+
async pop(count) {
|
|
172
|
+
// Pop from ready queue
|
|
173
|
+
const results = await this.redis.zpopmax(this.readyQueue, count);
|
|
174
|
+
if (!results || results.length === 0) {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
// Extract hashes from results (zpopmax returns [member, score, member, score, ...])
|
|
178
|
+
const userOpHashes = [];
|
|
179
|
+
for (let i = 0; i < results.length; i += 2) {
|
|
180
|
+
userOpHashes.push(results[i]);
|
|
181
|
+
}
|
|
182
|
+
// Remove all userOps in batch
|
|
183
|
+
return await this.remove(userOpHashes);
|
|
184
|
+
}
|
|
185
|
+
async getQueuedUserOps(userOp) {
|
|
186
|
+
const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
187
|
+
const senderNonceQueue = this.getSenderNonceQueue(userOp);
|
|
188
|
+
// Get all userOpHashes with nonce sequence lower than the input
|
|
189
|
+
// ZRANGEBYSCORE returns elements with scores between min and max
|
|
190
|
+
// We want scores from 0 to (nonceSequence - 1)
|
|
191
|
+
const userOpHashes = await this.redis.zrangebyscore(senderNonceQueue, 0, Number(nonceSequence) - 1);
|
|
192
|
+
if (userOpHashes.length === 0)
|
|
193
|
+
return [];
|
|
194
|
+
// Fetch serialized data for each hash
|
|
195
|
+
const pipeline = this.redis.pipeline();
|
|
196
|
+
for (const hash of userOpHashes) {
|
|
197
|
+
pipeline.hget(this.userOpHashMap, hash);
|
|
198
|
+
}
|
|
199
|
+
const results = await pipeline.exec();
|
|
200
|
+
// Deserialize and extract userOps
|
|
201
|
+
return (results || [])
|
|
202
|
+
.map((result) => result?.[1])
|
|
203
|
+
.filter((serialized) => serialized !== null)
|
|
204
|
+
.map((serialized) => deserialize(serialized).userOp);
|
|
205
|
+
}
|
|
206
|
+
// These methods aren't implemented
|
|
207
|
+
async dumpLocal() {
|
|
208
|
+
return []; // We can't dump from redis as the latency is too high
|
|
209
|
+
}
|
|
210
|
+
clear() {
|
|
211
|
+
throw new Error("Not implemented: clear");
|
|
212
|
+
}
|
|
213
|
+
// Skip limit checks when using Redis
|
|
214
|
+
validateQueuedLimit() {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
validateParallelLimit() {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
export const createRedisOutstandingQueue = ({ config, entryPoint, redisEndpoint, logger }) => {
|
|
222
|
+
return new RedisOutstandingQueue({
|
|
223
|
+
config,
|
|
224
|
+
entryPoint,
|
|
225
|
+
redisEndpoint,
|
|
226
|
+
logger
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=redis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.js","sourceRoot":"","sources":["../../../store/outstanding/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,gBAAgB,EACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIlC,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAU,EAAE;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAC3C,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACnD,CAAA;AACL,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,IAAY,EAAc,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,qBAAqB;IACN,KAAK,CAAO;IAEZ,oBAAoB,CAAQ,CAAC,kCAAkC;IAC/D,UAAU,CAAQ,CAAC,uFAAuF;IAC1G,aAAa,CAAQ,CAAC,wBAAwB;IAC9C,iBAAiB,CAAQ,CAAC,kCAAkC;IAC5D,kBAAkB,CAAQ,CAAC,mCAAmC;IAC9D,mBAAmB,CAAQ,CAAC,yCAAyC;IAEtF,YAAY,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,MAAM,EAMT;QACG,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,C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AAE;IACnB,OAAO,IAAI,qBAAqB,CAAC;QAC7B,MAAM;QACN,UAAU;QACV,aAAa;QACb,MAAM;KACT,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HexData32, UserOpInfo, UserOperation } from "../../types/index.js";
|
|
2
|
+
import type { ConflictType } from "../types.js";
|
|
3
|
+
export type ConflictingOutstandingType = {
|
|
4
|
+
conflictReason: ConflictType;
|
|
5
|
+
userOpInfo: UserOpInfo;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export interface OutstandingStore {
|
|
8
|
+
contains(userOpHash: HexData32): Promise<boolean>;
|
|
9
|
+
pop(count: number): Promise<UserOpInfo[]>;
|
|
10
|
+
popConflicting(userOp: UserOperation): Promise<ConflictingOutstandingType>;
|
|
11
|
+
add(userOpInfos: UserOpInfo[]): Promise<void>;
|
|
12
|
+
remove(userOpHash: HexData32[]): Promise<UserOpInfo[]>;
|
|
13
|
+
getQueuedUserOps(userOp: UserOperation): Promise<UserOperation[]>;
|
|
14
|
+
dumpLocal(): Promise<UserOpInfo[]>;
|
|
15
|
+
clear(): Promise<void>;
|
|
16
|
+
validateQueuedLimit(userOp: UserOperation): boolean;
|
|
17
|
+
validateParallelLimit(userOp: UserOperation): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../store/outstanding/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { AltoConfig } from "../../createConfig.js";
|
|
3
|
+
import { type ProcessingStore } from "../index.js";
|
|
4
|
+
export declare function createProcessingStore({ config, entryPoint }: {
|
|
5
|
+
config: AltoConfig;
|
|
6
|
+
entryPoint: Address;
|
|
7
|
+
}): ProcessingStore;
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
export * from "./memory.js";
|
|
10
|
+
export * from "./redis.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InMemoryProcessingStore, RedisProcessingStore } from "../index.js";
|
|
2
|
+
// Holds all userOps that have been removed from outstanding pool and are being processed.
|
|
3
|
+
// UserOps are are removed from this store when they have successfully landed onchain or when they are cancelled.
|
|
4
|
+
export function createProcessingStore({ config, entryPoint }) {
|
|
5
|
+
if (config.enableHorizontalScaling && config.redisEndpoint) {
|
|
6
|
+
return new RedisProcessingStore({
|
|
7
|
+
config,
|
|
8
|
+
entryPoint,
|
|
9
|
+
redisEndpoint: config.redisEndpoint
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return new InMemoryProcessingStore();
|
|
13
|
+
}
|
|
14
|
+
export * from "./types.js";
|
|
15
|
+
export * from "./memory.js";
|
|
16
|
+
export * from "./redis.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../store/processing/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,uBAAuB,EAEvB,oBAAoB,EACvB,MAAM,aAAa,CAAA;AAEpB,0FAA0F;AAC1F,iHAAiH;AACjH,MAAM,UAAU,qBAAqB,CAAC,EAClC,MAAM,EACN,UAAU,EAIb;IACG,IAAI,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzD,OAAO,IAAI,oBAAoB,CAAC;YAC5B,MAAM;YACN,UAAU;YACV,aAAa,EAAE,MAAM,CAAC,aAAa;SACtC,CAAC,CAAA;IACN,CAAC;IACD,OAAO,IAAI,uBAAuB,EAAE,CAAA;AACxC,CAAC;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UserOpInfo, UserOperation } from "../../types/index.js";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { ConflictType } from "../types.js";
|
|
4
|
+
import type { ProcessingStore } from "./types.js";
|
|
5
|
+
export declare class InMemoryProcessingStore implements ProcessingStore {
|
|
6
|
+
private readonly processingUserOpsSet;
|
|
7
|
+
private readonly processingSenderNonceSet;
|
|
8
|
+
private readonly processingDeploymentSet;
|
|
9
|
+
private readonly processingEip7702AuthSet;
|
|
10
|
+
private readonly processingUserOps;
|
|
11
|
+
private encodeSenderNonceId;
|
|
12
|
+
addProcessing(userOpInfos: UserOpInfo[]): Promise<void>;
|
|
13
|
+
removeProcessing(userOpInfos: UserOpInfo[]): Promise<void>;
|
|
14
|
+
isProcessing(userOpHash: Hex): Promise<boolean>;
|
|
15
|
+
wouldConflict(userOp: UserOperation): Promise<ConflictType | undefined>;
|
|
16
|
+
flush(): Promise<UserOpInfo[]>;
|
|
17
|
+
clearAllProcessing(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=memory.d.ts.map
|