Skip to content

Commit

Permalink
Merge pull request #39 from etherspot/disable-eip-1559
Browse files Browse the repository at this point in the history
disable eip1559 for fuse
  • Loading branch information
0xSulpiride authored Jun 12, 2023
2 parents 19ff75e + 372d803 commit 0939623
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 40 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.0.7",
"version": "0.0.8",
"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": "0.0.7",
"version": "0.0.8",
"engines": {
"node": ">=12.9.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.0.7",
"version": "0.0.8",
"description": "The API module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -35,12 +35,12 @@
"class-transformer": "0.5.1",
"class-validator": "0.14.0",
"ethers": "5.7.2",
"executor": "^0.0.7",
"executor": "^0.0.8",
"fastify": "4.14.1",
"pino": "8.11.0",
"pino-pretty": "10.0.0",
"reflect-metadata": "0.1.13",
"types": "^0.0.7"
"types": "^0.0.8"
},
"devDependencies": {
"@types/connect": "3.4.35"
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cli",
"version": "0.0.7",
"version": "0.0.8",
"description": "> TODO: description",
"author": "zincoshine <[email protected]>",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -31,13 +31,13 @@
"url": "https://https://github.com/etherspot/skandha/issues"
},
"dependencies": {
"api": "^0.0.7",
"db": "^0.0.7",
"executor": "^0.0.7",
"api": "^0.0.8",
"db": "^0.0.8",
"executor": "^0.0.8",
"find-up": "5.0.0",
"got": "12.5.3",
"js-yaml": "4.1.0",
"types": "^0.0.7",
"types": "^0.0.8",
"yargs": "17.6.2"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "db",
"version": "0.0.7",
"version": "0.0.8",
"description": "The DB module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
Expand Down Expand Up @@ -37,6 +37,6 @@
"devDependencies": {
"@types/rocksdb": "3.0.1",
"prettier": "^2.8.4",
"types": "^0.0.7"
"types": "^0.0.8"
}
}
6 changes: 3 additions & 3 deletions packages/executor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "executor",
"version": "0.0.7",
"version": "0.0.8",
"description": "The Relayer module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"async-mutex": "0.4.0",
"ethers": "5.7.2",
"params": "^0.0.7",
"types": "^0.0.7"
"params": "^0.0.8",
"types": "^0.0.8"
}
}
3 changes: 2 additions & 1 deletion packages/executor/src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class Executor {
this.provider,
this.reputationService,
this.network,
this.config
this.config,
this.logger
);
this.mempoolService = new MempoolService(
this.db,
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 @@ -80,10 +80,10 @@ export class Eth {
}
const userOpComplemented: UserOperationStruct = {
paymasterAndData: userOp.paymasterAndData ?? "0x",
verificationGasLimit: 10e6,
maxFeePerGas: 0,
maxPriorityFeePerGas: 0,
preVerificationGas: 0,
verificationGasLimit: 10e6,
...userOp,
};
const preVerificationGas = this.calcPreVerificationGas(userOp);
Expand Down
37 changes: 19 additions & 18 deletions packages/executor/src/services/BundlingService.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { BigNumber, ethers, providers } from "ethers";
import { BigNumber, BigNumberish, ethers, providers } from "ethers";
import { NetworkName } from "types/lib";
import { EntryPoint__factory } from "types/lib/executor/contracts/factories";
import { EntryPoint } from "types/lib/executor/contracts/EntryPoint";
import { Mutex } from "async-mutex";
import { SendBundleReturn } from "types/lib/executor";
import { IMulticall3__factory } from "types/lib/executor/contracts/factories/IMulticall3__factory";
import { chainsWithoutEIP1559 } from "params/lib";
import { getAddr } from "../utils";
import { MempoolEntry } from "../entities/MempoolEntry";
import { ReputationStatus } from "../entities/interfaces";
Expand Down Expand Up @@ -71,27 +72,27 @@ export class BundlingService {
"handleOps",
[bundle.map((entry) => entry.userOp), beneficiary]
);
this.logger.debug(
JSON.stringify(
{
to: entryPoint,
data: txRequest,
type: 2,
maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas ?? 0,
maxFeePerGas: gasFee.maxFeePerGas ?? 0,
},
undefined,
2
)
);

const gasLimit = await this.estimateBundleGas(bundle);
const tx = await wallet.sendTransaction({
const transaction = {
to: entryPoint,
data: txRequest,
type: 2,
maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas ?? 0,
maxFeePerGas: gasFee.maxFeePerGas ?? 0,
maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas,
maxFeePerGas: gasFee.maxFeePerGas,
gasPrice: undefined as BigNumberish | undefined,
};
if (chainsWithoutEIP1559.some((network) => network === this.network)) {
transaction.type = 1;
transaction.gasPrice = gasFee.gasPrice;
delete transaction.maxPriorityFeePerGas;
delete transaction.maxFeePerGas;
}

this.logger.debug(JSON.stringify(transaction, undefined, 2));

const gasLimit = await this.estimateBundleGas(bundle);
const tx = await wallet.sendTransaction({
...transaction,
gasLimit,
});

Expand Down
20 changes: 18 additions & 2 deletions packages/executor/src/services/UserOpValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { BannedContracts } from "params/lib";
import { NetworkName } from "types/lib";
import { getAddr } from "../utils";
import { TracerCall, TracerResult } from "../interfaces";
import { Logger, TracerCall, TracerResult } from "../interfaces";
import { Config } from "../config";
import { ReputationService } from "./ReputationService";
import { GethTracer } from "./GethTracer";
Expand Down Expand Up @@ -56,7 +56,8 @@ export class UserOpValidationService {
private provider: providers.Provider,
private reputationService: ReputationService,
private network: NetworkName,
private config: Config
private config: Config,
private logger: Logger
) {
this.gethTracer = new GethTracer(
this.provider as providers.JsonRpcProvider
Expand All @@ -76,12 +77,27 @@ export class UserOpValidationService {
.catch((e: any) => this.nethermindErrorHandler(entryPointContract, e));

if (errorResult.errorName === "FailedOp") {
this.logger.debug({
to: entryPoint,
data: entryPointContract.interface.encodeFunctionData(
"simulateValidation",
[userOp]
),
});
throw new RpcError(
errorResult.errorArgs.at(-1),
RpcErrorCodes.VALIDATION_FAILED
);
}

if (errorResult.errorName !== "ValidationResult") {
this.logger.debug({
to: entryPoint,
data: entryPointContract.interface.encodeFunctionData(
"simulateValidation",
[userOp]
),
});
throw errorResult;
}

Expand Down
5 changes: 5 additions & 0 deletions packages/executor/src/utils/getGasFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NetworkName } from "types/lib";
export type IGetGasFeeResult = {
maxPriorityFeePerGas: BigNumberish | undefined;
maxFeePerGas: BigNumberish | undefined;
gasPrice: BigNumberish | undefined;
};

export const getGasFee = async (
Expand All @@ -23,14 +24,17 @@ export const getGasFee = async (
return {
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ?? 0,
maxFeePerGas: feeData.maxFeePerGas ?? 0,
gasPrice: feeData.gasPrice ?? 0,
};
} catch (err) {
// eslint-disable-next-line no-console
console.error(`Couldn't fetch fee data: ${err}`);
}

return {
maxPriorityFeePerGas: undefined,
maxFeePerGas: undefined,
gasPrice: undefined,
};
};

Expand All @@ -44,5 +48,6 @@ export const getMaticGasFee = async (): Promise<IGetGasFeeResult> => {
return {
maxPriorityFeePerGas: parseGwei(data.fast.maxPriorityFee),
maxFeePerGas: parseGwei(data.fast.maxFee),
gasPrice: parseGwei(data.fast.maxFee),
};
};
4 changes: 2 additions & 2 deletions packages/params/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "params",
"version": "0.0.7",
"version": "0.0.8",
"description": "Various bundler parameters",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/skandha#readme",
Expand All @@ -21,7 +21,7 @@
"url": "https://github.com/etherspot/skandha/issues"
},
"dependencies": {
"types": "^0.0.7"
"types": "^0.0.8"
},
"scripts": {
"clean": "rm -rf lib && rm -f *.tsbuildinfo",
Expand Down
8 changes: 8 additions & 0 deletions packages/params/src/eip1559.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NetworkName } from "types/lib";

export const chainsWithoutEIP1559: NetworkName[] = [
"fuse",
"fuseSparknet",
"bsc",
"bscTest",
];
1 change: 1 addition & 0 deletions packages/params/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./bannedContracts";
export * from "./eip1559";
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "types",
"version": "0.0.7",
"version": "0.0.8",
"description": "The types of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down

0 comments on commit 0939623

Please sign in to comment.