Skip to content

Commit

Permalink
AA-488 replace by fee reputation (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
drortirosh authored Jan 1, 2025
1 parent 3579626 commit d49018d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/bundler/src/modules/MempoolManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export class MempoolManager {
)
const packedNonce = getPackedNonce(entry.userOp)
const index = this._findBySenderNonce(userOp.sender, packedNonce)
let oldEntry: MempoolEntry | undefined
if (index !== -1) {
const oldEntry = this.mempool[index]
oldEntry = this.mempool[index]
this.checkReplaceUserOp(oldEntry, entry)
debug('replace userOp', userOp.sender, packedNonce)
this.mempool[index] = entry
Expand All @@ -100,19 +101,22 @@ export class MempoolManager {
}
this.mempool.push(entry)
}
if (oldEntry != null) {
this.updateSeenStatus(oldEntry.aggregator, oldEntry.userOp, validationResult.senderInfo, -1)
}
this.updateSeenStatus(validationResult.aggregatorInfo?.addr, userOp, validationResult.senderInfo)
}

private updateSeenStatus (aggregator: string | undefined, userOp: OperationBase, senderInfo: StakeInfo): void {
private updateSeenStatus (aggregator: string | undefined, userOp: OperationBase, senderInfo: StakeInfo, val = 1): void {
try {
this.reputationManager.checkStake('account', senderInfo)
this.reputationManager.updateSeenStatus(userOp.sender)
} catch (e: any) {
if (!(e instanceof RpcError)) throw e
}
this.reputationManager.updateSeenStatus(aggregator)
this.reputationManager.updateSeenStatus(userOp.paymaster)
this.reputationManager.updateSeenStatus(userOp.factory)
this.reputationManager.updateSeenStatus(aggregator, val)
this.reputationManager.updateSeenStatus(userOp.paymaster, val)
this.reputationManager.updateSeenStatus(userOp.factory, val)
}

private checkReputation (
Expand Down

0 comments on commit d49018d

Please sign in to comment.