From 2291e0b3739df4971c0c85b63ef0c3a4d7a8867d Mon Sep 17 00:00:00 2001 From: Utkir S Date: Fri, 14 Jun 2024 18:55:32 +0500 Subject: [PATCH] Xdc (#205) --- lerna.json | 2 +- package.json | 2 +- packages/api/package.json | 10 +++++----- packages/cli/package.json | 14 +++++++------- packages/db/package.json | 4 ++-- packages/executor/package.json | 10 +++++----- packages/executor/src/config.ts | 5 +++++ packages/executor/src/executor.ts | 3 ++- packages/executor/src/interfaces.ts | 2 ++ .../services/BundlingService/relayers/classic.ts | 1 + .../BundlingService/relayers/fastlane.ts | 1 + .../src/services/BundlingService/service.ts | 1 + .../services/EntryPointService/versions/0.0.7.ts | 2 ++ packages/monitoring/package.json | 4 ++-- packages/node/package.json | 16 ++++++++-------- packages/params/package.json | 6 +++--- packages/params/src/eip1559.ts | 1 + packages/types/package.json | 2 +- packages/utils/package.json | 4 ++-- 19 files changed, 52 insertions(+), 38 deletions(-) diff --git a/lerna.json b/lerna.json index 4270e402..d9e24820 100644 --- a/lerna.json +++ b/lerna.json @@ -3,7 +3,7 @@ "packages/*" ], "npmClient": "yarn", - "version": "2.0.3", + "version": "2.0.4", "stream": "true", "command": { "version": { diff --git a/package.json b/package.json index 36f6700f..98d7802e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "root", "private": true, - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=18.0.0" }, diff --git a/packages/api/package.json b/packages/api/package.json index d39f2465..86015614 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The API module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -34,10 +34,10 @@ "dependencies": { "@fastify/cors": "9.0.1", "@fastify/websocket": "10.0.1", - "@skandha/executor": "^2.0.3", - "@skandha/monitoring": "^2.0.3", - "@skandha/types": "^2.0.3", - "@skandha/utils": "^2.0.3", + "@skandha/executor": "^2.0.4", + "@skandha/monitoring": "^2.0.4", + "@skandha/types": "^2.0.4", + "@skandha/utils": "^2.0.4", "class-transformer": "0.5.1", "class-validator": "0.14.1", "ethers": "5.7.2", diff --git a/packages/cli/package.json b/packages/cli/package.json index 4f787179..efadb3af 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "> TODO: description", "author": "zincoshine ", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -40,12 +40,12 @@ "@libp2p/peer-id-factory": "2.0.1", "@libp2p/prometheus-metrics": "1.1.3", "@multiformats/multiaddr": "12.1.3", - "@skandha/api": "^2.0.3", - "@skandha/db": "^2.0.3", - "@skandha/executor": "^2.0.3", - "@skandha/monitoring": "^2.0.3", - "@skandha/node": "^2.0.3", - "@skandha/types": "^2.0.3", + "@skandha/api": "^2.0.4", + "@skandha/db": "^2.0.4", + "@skandha/executor": "^2.0.4", + "@skandha/monitoring": "^2.0.4", + "@skandha/node": "^2.0.4", + "@skandha/types": "^2.0.4", "find-up": "5.0.0", "got": "12.5.3", "js-yaml": "4.1.0", diff --git a/packages/db/package.json b/packages/db/package.json index 3349e7ce..7043efc1 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The DB module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://github.com/etherspot/etherspot-bundler#readme", @@ -34,7 +34,7 @@ "dependencies": { "@chainsafe/ssz": "0.10.1", "@farcaster/rocksdb": "5.5.0", - "@skandha/types": "^2.0.3" + "@skandha/types": "^2.0.4" }, "devDependencies": { "@types/rocksdb": "3.0.1", diff --git a/packages/executor/package.json b/packages/executor/package.json index 4c7283cf..4a861bc3 100644 --- a/packages/executor/package.json +++ b/packages/executor/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The Relayer module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -35,10 +35,10 @@ }, "dependencies": { "@flashbots/ethers-provider-bundle": "0.6.2", - "@skandha/monitoring": "^2.0.3", - "@skandha/params": "^2.0.3", - "@skandha/types": "^2.0.3", - "@skandha/utils": "^2.0.3", + "@skandha/monitoring": "^2.0.4", + "@skandha/params": "^2.0.4", + "@skandha/types": "^2.0.4", + "@skandha/utils": "^2.0.4", "async-mutex": "0.4.0", "ethers": "5.7.2", "strict-event-emitter-types": "2.0.0", diff --git a/packages/executor/src/config.ts b/packages/executor/src/config.ts index e0173222..f70629e6 100644 --- a/packages/executor/src/config.ts +++ b/packages/executor/src/config.ts @@ -319,6 +319,10 @@ export class Config { ) ); + config.eip1559 = Boolean( + fromEnvVar("EIP1559", config.eip1559 || bundlerDefaultConfigs.eip1559) + ); + // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!config.whitelistedEntities) { config.whitelistedEntities = bundlerDefaultConfigs.whitelistedEntities; @@ -392,6 +396,7 @@ const bundlerDefaultConfigs: BundlerConfig = { pvgMarkupPercent: 0, cglMarkupPercent: 0, vglMarkupPercent: 3000, // 30% + eip1559: true, }; function getEnvVar(envVar: string, fallback: T): T | string { diff --git a/packages/executor/src/executor.ts b/packages/executor/src/executor.ts index cd8f6fc0..e9ac21c9 100644 --- a/packages/executor/src/executor.ts +++ b/packages/executor/src/executor.ts @@ -203,7 +203,8 @@ export class Executor { // can't use eip2930 in unsafeMode and on chains that dont support 1559 if ( - (this.config.unsafeMode || + (!this.networkConfig.eip1559 || + this.config.unsafeMode || chainsWithoutEIP1559.some((chainId) => chainId === this.chainId)) && this.networkConfig.eip2930 ) { diff --git a/packages/executor/src/interfaces.ts b/packages/executor/src/interfaces.ts index 9f8c1cef..150ea97b 100644 --- a/packages/executor/src/interfaces.ts +++ b/packages/executor/src/interfaces.ts @@ -174,6 +174,8 @@ export interface NetworkConfig { pvgMarkupPercent: number; cglMarkupPercent: number; vglMarkupPercent: number; + // enables / disabled eip1559 + eip1559: boolean; } export type BundlerConfig = Omit< diff --git a/packages/executor/src/services/BundlingService/relayers/classic.ts b/packages/executor/src/services/BundlingService/relayers/classic.ts index dda5d543..c75f99f2 100644 --- a/packages/executor/src/services/BundlingService/relayers/classic.ts +++ b/packages/executor/src/services/BundlingService/relayers/classic.ts @@ -59,6 +59,7 @@ export class ClassicRelayer extends BaseRelayer { } if ( + !this.networkConfig.eip1559 || chainsWithoutEIP1559.some((chainId: number) => chainId === this.chainId) ) { transactionRequest.gasPrice = bundle.maxFeePerGas; diff --git a/packages/executor/src/services/BundlingService/relayers/fastlane.ts b/packages/executor/src/services/BundlingService/relayers/fastlane.ts index ef2bc770..24d6b962 100644 --- a/packages/executor/src/services/BundlingService/relayers/fastlane.ts +++ b/packages/executor/src/services/BundlingService/relayers/fastlane.ts @@ -100,6 +100,7 @@ export class FastlaneRelayer extends BaseRelayer { } if ( + !this.networkConfig.eip1559 || chainsWithoutEIP1559.some((chainId: number) => chainId === this.chainId) ) { transactionRequest.gasPrice = bundle.maxFeePerGas; diff --git a/packages/executor/src/services/BundlingService/service.ts b/packages/executor/src/services/BundlingService/service.ts index 28583fb0..9e11bb34 100644 --- a/packages/executor/src/services/BundlingService/service.ts +++ b/packages/executor/src/services/BundlingService/service.ts @@ -157,6 +157,7 @@ export class BundlingService { let { maxPriorityFeePerGas, maxFeePerGas } = gasFee; const { enforceGasPriceThreshold } = this.networkConfig; if ( + !this.networkConfig.eip1559 || chainsWithoutEIP1559.some( (chainId: number) => chainId === this.chainId ) diff --git a/packages/executor/src/services/EntryPointService/versions/0.0.7.ts b/packages/executor/src/services/EntryPointService/versions/0.0.7.ts index 71da024e..057d2630 100644 --- a/packages/executor/src/services/EntryPointService/versions/0.0.7.ts +++ b/packages/executor/src/services/EntryPointService/versions/0.0.7.ts @@ -95,6 +95,7 @@ export class EntryPointV7Service implements IEntryPointService { ); return res[0]; } catch (error: any) { + console.log(error); const err = decodeRevertReason(error); if (err != null) { throw new RpcError(err, RpcErrorCodes.EXECUTION_REVERTED); @@ -115,6 +116,7 @@ export class EntryPointV7Service implements IEntryPointService { .catch((err) => this.nonGethErrorHandler(err)); return this.parseValidationResult(userOp, errorResult); } catch (err: any) { + console.log(err); const decodedError = decodeRevertReason(err); if (decodedError != null) { throw new RpcError(decodedError, RpcErrorCodes.VALIDATION_FAILED); diff --git a/packages/monitoring/package.json b/packages/monitoring/package.json index 0d804bdb..6c0e1fb0 100644 --- a/packages/monitoring/package.json +++ b/packages/monitoring/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The Monitoring module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://github.com/etherspot/etherspot-bundler#readme", @@ -32,7 +32,7 @@ "check-readme": "typescript-docs-verifier" }, "dependencies": { - "@skandha/types": "^2.0.3", + "@skandha/types": "^2.0.4", "prom-client": "15.1.0" } } diff --git a/packages/node/package.json b/packages/node/package.json index abc221f5..31e21fa1 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The bundler node module of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -56,13 +56,13 @@ "@libp2p/prometheus-metrics": "1.1.3", "@libp2p/tcp": "6.1.0", "@multiformats/multiaddr": "11.4.0", - "@skandha/api": "^2.0.3", - "@skandha/db": "^2.0.3", - "@skandha/executor": "^2.0.3", - "@skandha/monitoring": "^2.0.3", - "@skandha/params": "^2.0.3", - "@skandha/types": "^2.0.3", - "@skandha/utils": "^2.0.3", + "@skandha/api": "^2.0.4", + "@skandha/db": "^2.0.4", + "@skandha/executor": "^2.0.4", + "@skandha/monitoring": "^2.0.4", + "@skandha/params": "^2.0.4", + "@skandha/types": "^2.0.4", + "@skandha/utils": "^2.0.4", "abstract-leveldown": "7.2.0", "datastore-core": "8.0.1", "ethers": "5.7.2", diff --git a/packages/params/package.json b/packages/params/package.json index 190a37c3..be42f27e 100644 --- a/packages/params/package.json +++ b/packages/params/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "Various bundler parameters", "author": "Etherspot", "homepage": "https://github.com/etherspot/skandha#readme", @@ -28,8 +28,8 @@ "@arbitrum/sdk": "3.1.4", "@chainsafe/ssz": "0.10.1", "@mantleio/sdk": "0.2.1", - "@skandha/types": "^2.0.3", - "@skandha/utils": "^2.0.3", + "@skandha/types": "^2.0.4", + "@skandha/utils": "^2.0.4", "ethers": "5.7.2" }, "scripts": { diff --git a/packages/params/src/eip1559.ts b/packages/params/src/eip1559.ts index 4621a7a3..f7f2882b 100644 --- a/packages/params/src/eip1559.ts +++ b/packages/params/src/eip1559.ts @@ -10,4 +10,5 @@ export const chainsWithoutEIP1559: number[] = [ 534351, // "scrollSepolia" 31, // rootstock testnet 30, // rootstock mainnet + 51, // XDC Apothem Network ]; diff --git a/packages/types/package.json b/packages/types/package.json index 23aff510..f8276ff8 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "The types of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", diff --git a/packages/utils/package.json b/packages/utils/package.json index 72c7bcc3..94f8dd18 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "2.0.3", + "version": "2.0.4", "description": "utils of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", @@ -33,7 +33,7 @@ }, "dependencies": { "@chainsafe/as-sha256": "0.3.1", - "@skandha/types": "^2.0.3", + "@skandha/types": "^2.0.4", "any-signal": "3.0.1", "bigint-buffer": "1.1.5", "case": "^1.6.3",