From 1f06314d46bea25f52d6eb5d99e369444abc506e Mon Sep 17 00:00:00 2001 From: Utkir S Date: Wed, 21 Feb 2024 19:02:21 +0500 Subject: [PATCH] bifrost fix (#153) --- lerna.json | 2 +- package.json | 2 +- packages/api/package.json | 8 +++---- packages/cli/package.json | 14 +++++------ packages/db/package.json | 4 ++-- packages/executor/package.json | 8 +++---- packages/executor/src/config.ts | 9 ++++++++ packages/executor/src/interfaces.ts | 2 ++ packages/executor/src/modules/skandha.ts | 1 + .../BundlingService/relayers/classic.ts | 23 +++++++++++-------- .../src/services/BundlingService/service.ts | 4 ++-- packages/monitoring/package.json | 4 ++-- packages/node/package.json | 16 ++++++------- packages/params/package.json | 6 ++--- packages/types/package.json | 2 +- packages/types/src/api/interfaces.ts | 1 + packages/utils/package.json | 4 ++-- 17 files changed, 63 insertions(+), 47 deletions(-) diff --git a/lerna.json b/lerna.json index 37f14bf2..381033e9 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ ], "npmClient": "yarn", "useWorkspaces": true, - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "stream": "true", "command": { "version": { diff --git a/package.json b/package.json index 018f6ff1..1c22092d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "root", "private": true, - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "engines": { "node": ">=18.0.0" }, diff --git a/packages/api/package.json b/packages/api/package.json index d25df6b2..ac619492 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "api", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The API module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -35,13 +35,13 @@ "class-transformer": "0.5.1", "class-validator": "0.14.0", "ethers": "5.7.2", - "executor": "^1.0.37-alpha", + "executor": "^1.0.38-alpha", "fastify": "4.14.1", - "monitoring": "^1.0.37-alpha", + "monitoring": "^1.0.38-alpha", "pino": "8.11.0", "pino-pretty": "10.0.0", "reflect-metadata": "0.1.13", - "types": "^1.0.37-alpha" + "types": "^1.0.38-alpha" }, "devDependencies": { "@types/connect": "3.4.35" diff --git a/packages/cli/package.json b/packages/cli/package.json index 344d3cd0..e22018b1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "cli", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "> TODO: description", "author": "zincoshine ", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -38,15 +38,15 @@ "@libp2p/peer-id-factory": "2.0.1", "@libp2p/prometheus-metrics": "1.1.3", "@multiformats/multiaddr": "12.1.3", - "api": "^1.0.37-alpha", - "db": "^1.0.37-alpha", - "executor": "^1.0.37-alpha", + "api": "^1.0.38-alpha", + "db": "^1.0.38-alpha", + "executor": "^1.0.38-alpha", "find-up": "5.0.0", "got": "12.5.3", "js-yaml": "4.1.0", - "monitoring": "^1.0.37-alpha", - "node": "^1.0.37-alpha", - "types": "^1.0.37-alpha", + "monitoring": "^1.0.38-alpha", + "node": "^1.0.38-alpha", + "types": "^1.0.38-alpha", "yargs": "17.6.2" }, "devDependencies": { diff --git a/packages/db/package.json b/packages/db/package.json index d5df35a2..02d2a5b9 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "db", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The DB module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://github.com/etherspot/etherspot-bundler#readme", @@ -33,7 +33,7 @@ "dependencies": { "@chainsafe/ssz": "0.10.1", "@farcaster/rocksdb": "5.5.0", - "types": "^1.0.37-alpha" + "types": "^1.0.38-alpha" }, "devDependencies": { "@types/rocksdb": "3.0.1", diff --git a/packages/executor/package.json b/packages/executor/package.json index 4f47733b..93251c46 100644 --- a/packages/executor/package.json +++ b/packages/executor/package.json @@ -1,6 +1,6 @@ { "name": "executor", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The Relayer module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -34,8 +34,8 @@ "@flashbots/ethers-provider-bundle": "0.6.2", "async-mutex": "0.4.0", "ethers": "5.7.2", - "monitoring": "^1.0.37-alpha", - "params": "^1.0.37-alpha", - "types": "^1.0.37-alpha" + "monitoring": "^1.0.38-alpha", + "params": "^1.0.38-alpha", + "types": "^1.0.38-alpha" } } diff --git a/packages/executor/src/config.ts b/packages/executor/src/config.ts index a0dad6f3..2d395347 100644 --- a/packages/executor/src/config.ts +++ b/packages/executor/src/config.ts @@ -333,6 +333,14 @@ export class Config { ) ); + conf.skipBundleValidation = Boolean( + fromEnvVar( + network, + "SKIP_BUNDLE_VALIDATION", + conf.skipBundleValidation || bundlerDefaultConfigs.skipBundleValidation + ) + ); + // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!conf.whitelistedEntities) { conf.whitelistedEntities = bundlerDefaultConfigs.whitelistedEntities; @@ -391,6 +399,7 @@ const bundlerDefaultConfigs: BundlerConfig = { relayingMode: "classic", pvgMarkup: 0, gasFeeInSimulation: false, + skipBundleValidation: false, }; const NETWORKS_ENV = (): string[] | undefined => { diff --git a/packages/executor/src/interfaces.ts b/packages/executor/src/interfaces.ts index 932b8957..9c99ef69 100644 --- a/packages/executor/src/interfaces.ts +++ b/packages/executor/src/interfaces.ts @@ -148,6 +148,8 @@ export interface NetworkConfig { pvgMarkup: number; // add gas fee in simulated transactions (may be required for some rpc providers) gasFeeInSimulation: boolean; + // skips bundle validation + skipBundleValidation: boolean; } export type BundlerConfig = Omit< diff --git a/packages/executor/src/modules/skandha.ts b/packages/executor/src/modules/skandha.ts index 51c0f43f..c0888622 100644 --- a/packages/executor/src/modules/skandha.ts +++ b/packages/executor/src/modules/skandha.ts @@ -126,6 +126,7 @@ export class Skandha { bundleSize: this.networkConfig.bundleSize, minUnstakeDelay: this.networkConfig.minUnstakeDelay, pvgMarkup: this.networkConfig.pvgMarkup, + skipBundleValidation: this.networkConfig.skipBundleValidation, }; } diff --git a/packages/executor/src/services/BundlingService/relayers/classic.ts b/packages/executor/src/services/BundlingService/relayers/classic.ts index 0c497c8c..036318db 100644 --- a/packages/executor/src/services/BundlingService/relayers/classic.ts +++ b/packages/executor/src/services/BundlingService/relayers/classic.ts @@ -115,16 +115,19 @@ export class ClassicRelayer extends BaseRelayer { // geth-dev's jsonRpcSigner doesn't support signTransaction if (!this.config.testingMode) { // check for execution revert - try { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { gasLimit, ...txWithoutGasLimit } = transactionRequest; - // some chains, like Bifrost, don't allow setting gasLimit in estimateGas - await relayer.estimateGas(txWithoutGasLimit); - } catch (err) { - this.logger.error(err); - await this.mempoolService.removeAll(entries); - this.reportFailedBundle(); - return; + + if (!this.networkConfig.skipBundleValidation) { + try { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { gasLimit, ...txWithoutGasLimit } = transactionRequest; + // some chains, like Bifrost, don't allow setting gasLimit in estimateGas + await relayer.estimateGas(txWithoutGasLimit); + } catch (err) { + this.logger.error(err); + await this.mempoolService.removeAll(entries); + this.reportFailedBundle(); + return; + } } this.logger.debug( diff --git a/packages/executor/src/services/BundlingService/service.ts b/packages/executor/src/services/BundlingService/service.ts index 46e7a194..287515a4 100644 --- a/packages/executor/src/services/BundlingService/service.ts +++ b/packages/executor/src/services/BundlingService/service.ts @@ -341,7 +341,7 @@ export class BundlingService { if (!entries.length) { this.logger.debug("No new entries"); return; - }; + } // remove entries from mempool if submitAttempts are greater than maxAttemps const invalidEntries = entries.filter( (entry) => entry.submitAttempts >= this.maxSubmitAttempts @@ -358,7 +358,7 @@ export class BundlingService { if (!entries.length) { this.logger.debug("No entries left"); return; - }; + } const gasFee = await getGasFee( this.chainId, this.provider, diff --git a/packages/monitoring/package.json b/packages/monitoring/package.json index 380e426a..69b832a6 100644 --- a/packages/monitoring/package.json +++ b/packages/monitoring/package.json @@ -1,6 +1,6 @@ { "name": "monitoring", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The Monitoring module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://github.com/etherspot/etherspot-bundler#readme", @@ -32,6 +32,6 @@ }, "dependencies": { "prom-client": "15.1.0", - "types": "^1.0.37-alpha" + "types": "^1.0.38-alpha" } } diff --git a/packages/node/package.json b/packages/node/package.json index 07bdf7d4..74f60a73 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,6 +1,6 @@ { "name": "node", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The bundler node module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -56,25 +56,25 @@ "@libp2p/tcp": "6.1.0", "@multiformats/multiaddr": "11.4.0", "abstract-leveldown": "7.2.0", - "api": "^1.0.37-alpha", + "api": "^1.0.38-alpha", "datastore-core": "8.0.1", - "db": "^1.0.37-alpha", + "db": "^1.0.38-alpha", "ethers": "5.7.2", - "executor": "^1.0.37-alpha", + "executor": "^1.0.38-alpha", "it-filter": "1.0.2", "it-map": "1.0.5", "it-sort": "1.0.0", "it-take": "1.0.1", "libp2p": "0.42.2", - "monitoring": "^1.0.37-alpha", - "params": "^1.0.37-alpha", + "monitoring": "^1.0.38-alpha", + "params": "^1.0.38-alpha", "prettier": "2.8.4", "snappy": "7.2.2", "snappyjs": "0.7.0", "stream-to-it": "0.2.4", "strict-event-emitter-types": "2.0.0", - "types": "^1.0.37-alpha", - "utils": "^1.0.37-alpha", + "types": "^1.0.38-alpha", + "utils": "^1.0.38-alpha", "varint": "6.0.0", "xxhash-wasm": "1.0.2" }, diff --git a/packages/params/package.json b/packages/params/package.json index d2d25708..83767e63 100644 --- a/packages/params/package.json +++ b/packages/params/package.json @@ -1,6 +1,6 @@ { "name": "params", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "Various bundler parameters", "author": "Etherspot", "homepage": "https://github.com/etherspot/skandha#readme", @@ -26,8 +26,8 @@ "@eth-optimism/sdk": "3.0.0", "@mantleio/sdk": "0.2.1", "ethers": "5.7.2", - "types": "^1.0.37-alpha", - "utils": "^1.0.37-alpha" + "types": "^1.0.38-alpha", + "utils": "^1.0.38-alpha" }, "scripts": { "clean": "rm -rf lib && rm -f *.tsbuildinfo", diff --git a/packages/types/package.json b/packages/types/package.json index 12f37e75..e682fc5f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "types", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "The types of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", diff --git a/packages/types/src/api/interfaces.ts b/packages/types/src/api/interfaces.ts index 42bd8aa5..ab3bf165 100644 --- a/packages/types/src/api/interfaces.ts +++ b/packages/types/src/api/interfaces.ts @@ -77,6 +77,7 @@ export type GetConfigResponse = { bundleSize: number; minUnstakeDelay: number; pvgMarkup: number; + skipBundleValidation: boolean; }; export type SupportedEntryPoints = string[]; diff --git a/packages/utils/package.json b/packages/utils/package.json index 9a941d5e..25bd434c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "utils", - "version": "1.0.37-alpha", + "version": "1.0.38-alpha", "description": "utils of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -37,6 +37,6 @@ "case": "^1.6.3", "pino": "8.11.0", "pino-pretty": "10.0.0", - "types": "^1.0.37-alpha" + "types": "^1.0.38-alpha" } }