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

Blockscout integration #247

Merged
merged 2 commits into from
Sep 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages/*"
],
"npmClient": "yarn",
"version": "1.5.24",
"version": "1.5.25",
"stream": "true",
"command": {
"version": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "root",
"private": true,
"version": "1.5.24",
"version": "1.5.25",
"engines": {
"node": ">=18.0.0"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The API module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -34,10 +34,10 @@
"dependencies": {
"@fastify/cors": "9.0.1",
"@fastify/websocket": "10.0.1",
"@skandha/executor": "^1.5.24",
"@skandha/monitoring": "^1.5.24",
"@skandha/types": "^1.5.24",
"@skandha/utils": "^1.5.24",
"@skandha/executor": "^1.5.25",
"@skandha/monitoring": "^1.5.25",
"@skandha/types": "^1.5.25",
"@skandha/utils": "^1.5.25",
"class-transformer": "0.5.1",
"class-validator": "0.14.1",
"ethers": "5.7.2",
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "> TODO: description",
"author": "zincoshine <[email protected]>",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -40,12 +40,12 @@
"@libp2p/peer-id-factory": "2.0.1",
"@libp2p/prometheus-metrics": "1.1.3",
"@multiformats/multiaddr": "12.1.3",
"@skandha/api": "^1.5.24",
"@skandha/db": "^1.5.24",
"@skandha/executor": "^1.5.24",
"@skandha/monitoring": "^1.5.24",
"@skandha/node": "^1.5.24",
"@skandha/types": "^1.5.24",
"@skandha/api": "^1.5.25",
"@skandha/db": "^1.5.25",
"@skandha/executor": "^1.5.25",
"@skandha/monitoring": "^1.5.25",
"@skandha/node": "^1.5.25",
"@skandha/types": "^1.5.25",
"find-up": "5.0.0",
"got": "12.5.3",
"js-yaml": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "Smart contracts of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down
4 changes: 2 additions & 2 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The DB module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
Expand Down Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@chainsafe/ssz": "0.10.1",
"@farcaster/rocksdb": "5.5.0",
"@skandha/types": "^1.5.24"
"@skandha/types": "^1.5.25"
},
"devDependencies": {
"@types/rocksdb": "3.0.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The Relayer module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -35,10 +35,10 @@
},
"dependencies": {
"@flashbots/ethers-provider-bundle": "0.6.2",
"@skandha/monitoring": "^1.5.24",
"@skandha/params": "^1.5.24",
"@skandha/types": "^1.5.24",
"@skandha/utils": "^1.5.24",
"@skandha/monitoring": "^1.5.25",
"@skandha/params": "^1.5.25",
"@skandha/types": "^1.5.25",
"@skandha/utils": "^1.5.25",
"async-mutex": "0.4.0",
"ethers": "5.7.2",
"strict-event-emitter-types": "2.0.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/executor/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@ export class Config {
)
);

config.blockscoutUrl = String(
fromEnvVar(
"BLOCKSCOUT_URL",
config.blockscoutUrl || bundlerDefaultConfigs.blockscoutUrl
)
);

config.blockscoutApiKeys = fromEnvVar(
"BLOCKSCOUT_API_KEYS",
config.blockscoutApiKeys != undefined
? config.blockscoutApiKeys
: bundlerDefaultConfigs.blockscoutApiKeys,
true
) as string[];

// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (!config.whitelistedEntities) {
config.whitelistedEntities = bundlerDefaultConfigs.whitelistedEntities;
Expand Down Expand Up @@ -401,6 +416,8 @@ const bundlerDefaultConfigs: BundlerConfig = {
echoAuthKey: "",
archiveDuration: 24 * 3600,
fastlaneValidators: [],
blockscoutUrl: "",
blockscoutApiKeys: [],
};

function getEnvVar<T>(envVar: string, fallback: T): T | string {
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 @@ -174,6 +174,8 @@ export interface NetworkConfig {
// default: 24 hours
archiveDuration: number;
fastlaneValidators: string[];
blockscoutUrl: string;
blockscoutApiKeys: string[];
}

export type BundlerConfig = Omit<
Expand Down
16 changes: 16 additions & 0 deletions packages/executor/src/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { Logger } from "@skandha/types/lib";
import { PerChainMetrics } from "@skandha/monitoring/lib";
import { deepHexlify } from "@skandha/utils/lib/hexlify";
import { BlockscoutAPI } from "@skandha/utils/lib/third-party";
import { packUserOp } from "../utils";
import { UserOpValidationService, MempoolService } from "../services";
import { GetNodeAPI, Log, NetworkConfig } from "../interfaces";
Expand All @@ -36,6 +37,7 @@ import { Skandha } from "./skandha";

export class Eth {
private pvgEstimator: IPVGEstimator | null = null;
private blockscoutApi: BlockscoutAPI | null = null;

constructor(
private chainId: number,
Expand All @@ -62,6 +64,15 @@ export class Eth {
if ([5000, 5001, 5003].includes(this.chainId)) {
this.pvgEstimator = estimateMantlePVG(this.provider);
}

if (this.config.blockscoutUrl) {
this.blockscoutApi = new BlockscoutAPI(
this.provider,
this.logger,
this.config.blockscoutUrl,
this.config.blockscoutApiKeys
);
}
}

/**
Expand Down Expand Up @@ -340,6 +351,8 @@ export class Eth {
}
const [entryPoint, event] = await this.getUserOperationEvent(hash);
if (!entryPoint || !event) {
if (this.blockscoutApi)
return await this.blockscoutApi.getUserOperationByHash(hash);
return null;
}
const tx = await event.getTransaction();
Expand Down Expand Up @@ -405,6 +418,8 @@ export class Eth {
): Promise<UserOperationReceipt | null> {
const [entryPoint, event] = await this.getUserOperationEvent(hash);
if (!event || !entryPoint) {
if (this.blockscoutApi)
return await this.blockscoutApi.getUserOperationReceipt(hash);
return null;
}
const receipt = await event.getTransactionReceipt();
Expand Down Expand Up @@ -531,6 +546,7 @@ export class Eth {
);
}
}

return [null, null];
}

Expand Down
2 changes: 2 additions & 0 deletions packages/executor/src/modules/skandha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export class Skandha {
pvgMarkupPercent: this.networkConfig.pvgMarkupPercent,
cglMarkupPercent: this.networkConfig.cglMarkupPercent,
vglMarkupPercent: this.networkConfig.vglMarkupPercent,
blockscoutUrl: this.networkConfig.blockscoutUrl,
blockscoutApiKeys: this.networkConfig.blockscoutApiKeys.length,
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/monitoring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The Monitoring module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
Expand Down Expand Up @@ -32,7 +32,7 @@
"check-readme": "typescript-docs-verifier"
},
"dependencies": {
"@skandha/types": "^1.5.24",
"@skandha/types": "^1.5.25",
"prom-client": "^14.2.0"
}
}
16 changes: 8 additions & 8 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The bundler node module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -56,13 +56,13 @@
"@libp2p/prometheus-metrics": "1.1.3",
"@libp2p/tcp": "6.1.0",
"@multiformats/multiaddr": "11.4.0",
"@skandha/api": "^1.5.24",
"@skandha/db": "^1.5.24",
"@skandha/executor": "^1.5.24",
"@skandha/monitoring": "^1.5.24",
"@skandha/params": "^1.5.24",
"@skandha/types": "^1.5.24",
"@skandha/utils": "^1.5.24",
"@skandha/api": "^1.5.25",
"@skandha/db": "^1.5.25",
"@skandha/executor": "^1.5.25",
"@skandha/monitoring": "^1.5.25",
"@skandha/params": "^1.5.25",
"@skandha/types": "^1.5.25",
"@skandha/utils": "^1.5.25",
"@types/varint": "6.0.1",
"abstract-leveldown": "7.2.0",
"datastore-core": "8.0.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/params/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "Various bundler parameters",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/skandha#readme",
Expand All @@ -28,8 +28,8 @@
"@arbitrum/sdk": "3.1.4",
"@chainsafe/ssz": "0.10.1",
"@mantleio/sdk": "0.2.1",
"@skandha/types": "^1.5.24",
"@skandha/utils": "^1.5.24",
"@skandha/types": "^1.5.25",
"@skandha/utils": "^1.5.25",
"ethers": "5.7.2"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "The types of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/api/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export type GetConfigResponse = {
pvgMarkupPercent: number;
cglMarkupPercent: number;
vglMarkupPercent: number;
blockscoutUrl: string;
blockscoutApiKeys: number;
};

export type SupportedEntryPoints = string[];
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.5.24",
"version": "1.5.25",
"description": "utils of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@chainsafe/as-sha256": "0.3.1",
"@skandha/types": "^1.5.24",
"@skandha/types": "^1.5.25",
"any-signal": "3.0.1",
"bigint-buffer": "1.1.5",
"case": "^1.6.3",
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from "./errors";
export * from "./shuffle";
export * from "./sortBy";
export * from "./timeout";
export * from "./third-party";
Loading
Loading