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 3 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 @@ -242,6 +242,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)
})
}
}
3 changes: 0 additions & 3 deletions packages/bundler/src/modules/MempoolManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const debug = Debug('aa.mempool')
export interface MempoolEntry {
userOp: OperationBase
userOpHash: string
prefund: BigNumberish
referencedContracts: ReferencedCodeHashes
// aggregator, if one was found during simulation
aggregator?: string
Expand Down Expand Up @@ -69,7 +68,6 @@ export class MempoolManager {
addUserOp (
userOp: OperationBase,
userOpHash: string,
prefund: BigNumberish,
referencedContracts: ReferencedCodeHashes,
senderInfo: StakeInfo,
paymasterInfo?: StakeInfo,
Expand All @@ -79,7 +77,6 @@ export class MempoolManager {
const entry: MempoolEntry = {
userOp,
userOpHash,
prefund,
referencedContracts,
aggregator: aggregatorInfo?.addr
}
Expand Down
Loading