Skip to content

Commit

Permalink
fix mantle sepolia gas limit
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride committed May 23, 2024
1 parent 603cff2 commit b27c6c3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/executor/src/entities/MempoolEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class MempoolEntry implements IMempoolEntry {
* @returns boolaen
*/
canReplace(existingEntry: MempoolEntry): boolean {
if (existingEntry.status > MempoolEntryStatus.OnChain) return true;
if (!this.isEqual(existingEntry)) return false;
if (
BigNumber.from(this.userOp.maxPriorityFeePerGas).lt(
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 @@ -60,7 +60,7 @@ export class Eth {
}

// mantle
if ([5000, 5001].includes(this.chainId)) {
if ([5000, 5001, 5003].includes(this.chainId)) {
this.pvgEstimator = estimateMantlePVG(this.provider);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export abstract class BaseRelayer implements IRelayingMode {
if (this.networkConfig.skipBundleValidation) return true;
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { gasLimit, ...txWithoutGasLimit } = transactionRequest;
const { gasLimit: _, ...txWithoutGasLimit } = transactionRequest;
// some chains, like Bifrost, don't allow setting gasLimit in estimateGas
await relayer.estimateGas(txWithoutGasLimit);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ export class ClassicRelayer extends BaseRelayer {
if (!this.config.testingMode) {
// check for execution revert

if (
!(await this.validateBundle(relayer, entries, transactionRequest))
) {
return;
if (this.chainId == 5003) {
const { gasLimit: _, ...txWithoutGasLimit } = transactionRequest;
transaction.gasLimit = await relayer.estimateGas(txWithoutGasLimit);
} else {
if (
!(await this.validateBundle(relayer, entries, transactionRequest))
) {
return;
}
}

this.logger.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ export class EstimationService {
this.provider
);

const errorResult = await entryPointContract.callStatic
.simulateHandleOp(userOp, AddressZero, BytesZero, {
gasLimit: getUserOpGasLimit(
const gasLimit = this.networkConfig.gasFeeInSimulation
? getUserOpGasLimit(
userOp,
constants.Zero,
this.networkConfig.estimationGasLimit
),
)
: undefined;

const errorResult = await entryPointContract.callStatic
.simulateHandleOp(userOp, AddressZero, BytesZero, {
gasLimit,
})
.catch((e: any) => nonGethErrorHandler(entryPointContract, e));

Expand Down Expand Up @@ -97,17 +101,22 @@ export class EstimationService {
forwarderABI,
this.provider
);

const gasLimit = this.networkConfig.gasFeeInSimulation
? getUserOpGasLimit(
userOp,
constants.Zero,
this.networkConfig.estimationGasLimit
)
: undefined;

const data = await this.provider.call({
to: this.networkConfig.entryPointForwarder,
data: forwarder.interface.encodeFunctionData("forward", [
entryPoint,
simulateData,
]),
gasLimit: getUserOpGasLimit(
userOp,
BigNumber.from(105000),
this.networkConfig.estimationGasLimit
),
gasLimit,
});

const error = entryPointContract.interface.parseError(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ export class UnsafeValidationService {
entryPoint,
this.provider
);
const errorResult = await entryPointContract.callStatic
.simulateValidation(userOp, {
gasLimit: getUserOpGasLimit(

const gasLimit = this.networkConfig.gasFeeInSimulation
? getUserOpGasLimit(
userOp,
constants.Zero,
this.networkConfig.estimationGasLimit
),
)
: undefined;

const errorResult = await entryPointContract.callStatic
.simulateValidation(userOp, {
gasLimit,
})
.catch((e: any) => nonGethErrorHandler(entryPointContract, e));
return parseErrorResult(userOp, errorResult);
Expand All @@ -52,17 +57,22 @@ export class UnsafeValidationService {
forwarderABI,
this.provider
);

const gasLimit = this.networkConfig.gasFeeInSimulation
? getUserOpGasLimit(
userOp,
constants.Zero,
this.networkConfig.estimationGasLimit
)
: undefined;

const data = await this.provider.call({
to: this.networkConfig.entryPointForwarder,
data: forwarder.interface.encodeFunctionData("forward", [
entryPoint,
validationData,
]),
gasLimit: getUserOpGasLimit(
userOp,
constants.Zero,
this.networkConfig.estimationGasLimit
),
gasLimit,
});
const error = entryPointContract.interface.parseError(data);
return parseErrorResult(userOp, {
Expand Down
1 change: 1 addition & 0 deletions packages/params/src/gas-price-oracles/oracles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export const oracles: {
8453: getBaseGasFee,
888888888: getAncient8GasFee,
59144: getEthGasPrice,
5003: getMantleGasFee,
};

0 comments on commit b27c6c3

Please sign in to comment.