Skip to content

Commit

Permalink
Check localsigner availability (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride authored Oct 30, 2024
1 parent 4d9e478 commit b573a04
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 40 deletions.
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.27",
"version": "1.5.28",
"stream": "true",
"command": {
"version": {
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.27",
"version": "1.5.28",
"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.27",
"@skandha/monitoring": "^1.5.27",
"@skandha/types": "^1.5.27",
"@skandha/utils": "^1.5.27",
"@skandha/executor": "^1.5.28",
"@skandha/monitoring": "^1.5.28",
"@skandha/types": "^1.5.28",
"@skandha/utils": "^1.5.28",
"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.27",
"version": "1.5.28",
"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.27",
"@skandha/db": "^1.5.27",
"@skandha/executor": "^1.5.27",
"@skandha/monitoring": "^1.5.27",
"@skandha/node": "^1.5.27",
"@skandha/types": "^1.5.27",
"@skandha/api": "^1.5.28",
"@skandha/db": "^1.5.28",
"@skandha/executor": "^1.5.28",
"@skandha/monitoring": "^1.5.28",
"@skandha/node": "^1.5.28",
"@skandha/types": "^1.5.28",
"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.27",
"version": "1.5.28",
"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.27",
"version": "1.5.28",
"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.27"
"@skandha/types": "^1.5.28"
},
"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.27",
"version": "1.5.28",
"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.27",
"@skandha/params": "^1.5.27",
"@skandha/types": "^1.5.27",
"@skandha/utils": "^1.5.27",
"@skandha/monitoring": "^1.5.28",
"@skandha/params": "^1.5.28",
"@skandha/types": "^1.5.28",
"@skandha/utils": "^1.5.28",
"async-mutex": "0.4.0",
"ethers": "5.7.2",
"strict-event-emitter-types": "2.0.0",
Expand Down
14 changes: 12 additions & 2 deletions packages/executor/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ export class Config {
redirectRpc: boolean;
config: NetworkConfig;
chainId: number;
localSigner?: providers.JsonRpcSigner;

constructor(options: ConfigOptions) {
this.testingMode = options.testingMode ?? false;
this.unsafeMode = options.unsafeMode ?? false;
this.redirectRpc = options.redirectRpc ?? false;
this.config = this.getDefaultNetworkConfig(options.config);
this.chainId = 0;
this.localSigner = options.localSigner;
}

static async init(configOptions: ConfigOptions): Promise<Config> {
Expand All @@ -28,6 +30,14 @@ export class Config {
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
await config.fetchChainId();
}
if (config.testingMode) {
const localSigner = config.getNetworkProvider().getSigner();
try {
void (await localSigner.getAddress());
config.localSigner = localSigner;
// eslint-disable-next-line no-empty
} catch (_) {}
}
return config;
}

Expand All @@ -38,8 +48,8 @@ export class Config {
getRelayers(): Wallet[] | providers.JsonRpcSigner[] | null {
const provider = this.getNetworkProvider();

if (this.testingMode) {
return [provider.getSigner()];
if (this.testingMode && this.localSigner) {
return [this.localSigner];
}

const wallets = [];
Expand Down
3 changes: 2 additions & 1 deletion packages/executor/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumber, BigNumberish, BytesLike } from "ethers";
import { BigNumber, BigNumberish, BytesLike, providers } from "ethers";
import {
IWhitelistedEntities,
RelayingMode,
Expand Down Expand Up @@ -188,6 +188,7 @@ export interface ConfigOptions {
testingMode?: boolean;
unsafeMode: boolean;
redirectRpc: boolean;
localSigner?: providers.JsonRpcSigner;
}

export interface SlotMap {
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.27",
"version": "1.5.28",
"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.27",
"@skandha/types": "^1.5.28",
"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.27",
"version": "1.5.28",
"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.27",
"@skandha/db": "^1.5.27",
"@skandha/executor": "^1.5.27",
"@skandha/monitoring": "^1.5.27",
"@skandha/params": "^1.5.27",
"@skandha/types": "^1.5.27",
"@skandha/utils": "^1.5.27",
"@skandha/api": "^1.5.28",
"@skandha/db": "^1.5.28",
"@skandha/executor": "^1.5.28",
"@skandha/monitoring": "^1.5.28",
"@skandha/params": "^1.5.28",
"@skandha/types": "^1.5.28",
"@skandha/utils": "^1.5.28",
"@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.27",
"version": "1.5.28",
"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.27",
"@skandha/utils": "^1.5.27",
"@skandha/types": "^1.5.28",
"@skandha/utils": "^1.5.28",
"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.27",
"version": "1.5.28",
"description": "The types of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
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.27",
"version": "1.5.28",
"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.27",
"@skandha/types": "^1.5.28",
"any-signal": "3.0.1",
"bigint-buffer": "1.1.5",
"case": "^1.6.3",
Expand Down

0 comments on commit b573a04

Please sign in to comment.