diff --git a/packages/bundler/src/BundlerServer.ts b/packages/bundler/src/BundlerServer.ts index d98d36f2..a8940ff4 100644 --- a/packages/bundler/src/BundlerServer.ts +++ b/packages/bundler/src/BundlerServer.ts @@ -321,6 +321,10 @@ export class BundlerServer { await this.debugHandler.setBundleInterval(params[0], params[1]) result = 'ok' break + case 'debug_bundler_addUserOps': + await this.debugHandler.addUserOps(params[0]) + result = 'ok' + break case 'debug_bundler_sendBundleNow': result = await this.debugHandler.sendBundleNow() if (result == null) { diff --git a/packages/bundler/src/DebugMethodHandler.ts b/packages/bundler/src/DebugMethodHandler.ts index 8a0b1abf..d8bdbbc6 100644 --- a/packages/bundler/src/DebugMethodHandler.ts +++ b/packages/bundler/src/DebugMethodHandler.ts @@ -3,7 +3,8 @@ import { ReputationDump, ReputationManager } from './modules/ReputationManager' import { MempoolManager } from './modules/MempoolManager' import { SendBundleReturn } from './modules/BundleManager' import { EventsManager } from './modules/EventsManager' -import { StakeInfo } from '@account-abstraction/utils' +import { ReferencedCodeHashes, StakeInfo, UserOperation } from '@account-abstraction/utils' +import { UserOperationStruct } from '@account-abstraction/contracts' export class DebugMethodHandler { constructor ( @@ -76,4 +77,19 @@ export class DebugMethodHandler { }> { return await this.repManager.getStakeStatus(address, entryPoint) } + + addUserOps (userOps: UserOperation[]): void { + userOps.forEach(userOp => { + const refs: ReferencedCodeHashes = { addresses: [], hash: '' } + const userOpHash = '' // used only by removeUserOp() when processing events. + + // we treat sender as "staked", and ignore any factory or paymaster, to bypass any reputation issues + const senderInfo: StakeInfo = { + addr: userOp.sender, + stake: this.repManager.minStake, + unstakeDelaySec: this.repManager.minUnstakeDelay + } + this.mempoolMgr.addUserOp(userOp, userOpHash, refs, senderInfo, undefined, undefined, undefined) + }) + } } diff --git a/packages/bundler/src/modules/MempoolManager.ts b/packages/bundler/src/modules/MempoolManager.ts index ea1c0dcf..906a4ec0 100644 --- a/packages/bundler/src/modules/MempoolManager.ts +++ b/packages/bundler/src/modules/MempoolManager.ts @@ -15,6 +15,14 @@ import { ReputationManager } from './ReputationManager' const debug = Debug('aa.mempool') +export interface MempoolEntry { + userOp: OperationBase + userOpHash: string + referencedContracts: ReferencedCodeHashes + // aggregator, if one was found during simulation + aggregator?: string +} + type MempoolDump = OperationBase[] const THROTTLED_ENTITY_MEMPOOL_COUNT = 4 @@ -64,7 +72,6 @@ export class MempoolManager { skipValidation: boolean, userOp: OperationBase, userOpHash: string, - prefund: BigNumberish, referencedContracts: ReferencedCodeHashes, senderInfo: StakeInfo, paymasterInfo?: StakeInfo, @@ -74,7 +81,6 @@ export class MempoolManager { const entry = new MempoolEntry( userOp, userOpHash, - prefund, referencedContracts, skipValidation, aggregatorInfo?.addr