Skip to content

Commit

Permalink
feat: whitelist external entities && dont gossip whitelisted userops …
Browse files Browse the repository at this point in the history
…to canonical mempool
  • Loading branch information
0xSulpiride committed Dec 20, 2024
1 parent 3552019 commit d3345d0
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 144 deletions.
9 changes: 7 additions & 2 deletions packages/executor/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export class Config {
/**
* validate whitelist addresses
*/
for (const entity of ["paymaster", "account", "factory"]) {
for (const entity of ["paymaster", "account", "factory", "external"]) {
config.whitelistedEntities[entity as IEntity] = fromEnvVar(
`WL_${entity.toUpperCase()}`,
config.whitelistedEntities[entity as IEntity],
Expand Down Expand Up @@ -403,7 +403,12 @@ const bundlerDefaultConfigs: BundlerConfig = {
enforceGasPriceThreshold: 1000,
eip2930: false,
useropsTTL: 300, // 5 minutes
whitelistedEntities: { paymaster: [], account: [], factory: [] },
whitelistedEntities: {
paymaster: [],
account: [],
factory: [],
external: [],
},
bundleGasLimitMarkup: 25000,
bundleInterval: 10000, // 10 seconds
bundleSize: 4, // max size of bundle (in terms of user ops)
Expand Down
2 changes: 2 additions & 0 deletions packages/executor/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ export interface UserOpValidationResult {
aggregatorInfo?: StakeInfo;
referencedContracts?: ReferencedCodeHashes;
storageMap?: StorageMap;
belongsToCanonicalMempool: boolean;
mempoolId?: string;
}

export interface ExecutionResult {
Expand Down
2 changes: 1 addition & 1 deletion packages/executor/src/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class Eth {

try {
const nodeApi = this.getNodeAPI();
if (nodeApi) {
if (validationResult.belongsToCanonicalMempool && nodeApi) {
const { canonicalEntryPoint, canonicalMempoolId } = this.config;
if (
canonicalEntryPoint.toLowerCase() == entryPoint.toLowerCase() &&
Expand Down
4 changes: 3 additions & 1 deletion packages/executor/src/services/UserOpValidation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function nonGethErrorHandler(

export function parseErrorResult(
userOp: UserOperationStruct,
errorResult: { errorName: string; errorArgs: any }
errorResult: { errorName: string; errorArgs: any },
belongsToCanonicalMempool: boolean = true
): UserOpValidationResult {
if (!errorResult?.errorName?.startsWith("ValidationResult")) {
// parse it as FailedOp
Expand Down Expand Up @@ -106,6 +107,7 @@ export function parseErrorResult(
aggregatorInfo?.actualAggregator,
aggregatorInfo?.stakeInfo
),
belongsToCanonicalMempool,
};
}

Expand Down
Loading

0 comments on commit d3345d0

Please sign in to comment.