Skip to content

Commit f36bbd6

Browse files
authored
Merge pull request #750 from bcnmy/fix/gnosis-mainnet
fix(eth_senduseroperation): allow 0 for request ID & support gas limit markup
2 parents f86efcf + 85fe68e commit f36bbd6

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

config/default.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,9 @@
11651165
},
11661166
"disableFeeValidation": [],
11671167
"adminAddresses": [],
1168+
"callGasLimitMarkup": {
1169+
"100": 20000
1170+
},
11681171
"hardcodedGasLimits": {
11691172
"84532": {
11701173
"verificationGasLimit": 2000000,

src/server/api/v2/eth_sendUserOperation/handler.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
userOperationDao,
77
userOperationStateDao,
88
} from "../../../../common/service-manager";
9+
import config from "config";
910
import {
1011
getPaymasterFromPaymasterAndData,
1112
parseError,
@@ -34,7 +35,7 @@ const log = logger.child({
3435
* @returns The response object
3536
*/
3637
export const eth_sendUserOperation = async (req: Request, res: Response) => {
37-
const requestId = req.body.id || uniqueRequestId();
38+
const requestId = req.body.id != null ? req.body.id : uniqueRequestId();
3839
const { chainId, dappAPIKey } = req.params;
3940
const chainIdNumber = parseInt(chainId, 10);
4041
const transactionId = uniqueTransactonId();
@@ -100,6 +101,15 @@ export const eth_sendUserOperation = async (req: Request, res: Response) => {
100101
gasLimit += 5e9;
101102
}
102103

104+
// Add a markup to the gas limit if specified in the config
105+
const configKey = `callGasLimitMarkup.${chainId}`;
106+
if (config.has(configKey)) {
107+
_log.info(
108+
`Adding gas limit markup of ${config.get<number>(configKey)}`,
109+
);
110+
gasLimit += config.get<number>(configKey);
111+
}
112+
103113
const response = routeTransactionToRelayerMap[chainIdNumber][
104114
TransactionType.BUNDLER
105115
].sendUserOperation({

0 commit comments

Comments
 (0)