Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug_bundler_addUserOperations #211

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/bundler/src/BundlerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 17 additions & 1 deletion packages/bundler/src/DebugMethodHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
})
}
}
10 changes: 8 additions & 2 deletions packages/bundler/src/modules/MempoolManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,7 +72,6 @@ export class MempoolManager {
skipValidation: boolean,
userOp: OperationBase,
userOpHash: string,
prefund: BigNumberish,
referencedContracts: ReferencedCodeHashes,
senderInfo: StakeInfo,
paymasterInfo?: StakeInfo,
Expand All @@ -74,7 +81,6 @@ export class MempoolManager {
const entry = new MempoolEntry(
userOp,
userOpHash,
prefund,
referencedContracts,
skipValidation,
aggregatorInfo?.addr
Expand Down
Loading