From 24db335f2b51263b31737ed2c9a8038ce8dc4555 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Thu, 28 Mar 2024 15:01:36 +0500 Subject: [PATCH 1/8] wip: echo --- packages/executor/src/modules/eth.ts | 16 +- .../services/BundlingService/relayers/echo.ts | 197 ++++++++++++++++++ 2 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 packages/executor/src/services/BundlingService/relayers/echo.ts diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index 1e82e141..0ec4f0b1 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -175,7 +175,7 @@ export class Eth { .add(this.config.vglMarkup) .toNumber(); - let preVerificationGas: BigNumberish = this.calcPreVerificationGas(userOp); + let preVerificationGas: BigNumberish = this.calcPreVerificationGas(userOpComplemented); userOpComplemented.preVerificationGas = preVerificationGas; let callGasLimit: BigNumber = BigNumber.from(0); @@ -202,14 +202,6 @@ export class Eth { }); //> - // Binary search gas limits - const userOpToEstimate: UserOperationStruct = { - ...userOpComplemented, - preVerificationGas, - verificationGasLimit, - callGasLimit, - }; - const gasFee = await this.skandhaModule.getGasPrice(); if (this.pvgEstimator) { @@ -226,11 +218,11 @@ export class Eth { return { preVerificationGas, - verificationGasLimit: userOpToEstimate.verificationGasLimit, - verificationGas: userOpToEstimate.verificationGasLimit, + verificationGasLimit: verificationGasLimit, + verificationGas: verificationGasLimit, validAfter: validAfter ? BigNumber.from(validAfter) : undefined, validUntil: validUntil ? BigNumber.from(validUntil) : undefined, - callGasLimit: userOpToEstimate.callGasLimit, + callGasLimit: callGasLimit, maxFeePerGas: gasFee.maxFeePerGas, maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas, }; diff --git a/packages/executor/src/services/BundlingService/relayers/echo.ts b/packages/executor/src/services/BundlingService/relayers/echo.ts new file mode 100644 index 00000000..5d744608 --- /dev/null +++ b/packages/executor/src/services/BundlingService/relayers/echo.ts @@ -0,0 +1,197 @@ +import { ethers, providers } from "ethers"; +import { PerChainMetrics } from "monitoring/lib"; +import { Logger, NetworkName } from "types/lib"; +import { IEntryPoint__factory } from "types/lib/executor/contracts"; +import { MempoolEntryStatus } from "types/lib/executor"; +import { Config } from "../../../config"; +import { Bundle, NetworkConfig } from "../../../interfaces"; +import { MempoolService } from "../../MempoolService"; +import { ReputationService } from "../../ReputationService"; +import { estimateBundleGasLimit } from "../utils"; +import { Relayer } from "../interfaces"; +import { now } from "../../../utils"; +import { BaseRelayer } from "./base"; + +export class EchoRelayer extends BaseRelayer { + private submitTimeout = 5 * 60 * 1000; // 5 minutes + + constructor( + logger: Logger, + chainId: number, + network: NetworkName, + provider: providers.JsonRpcProvider, + config: Config, + networkConfig: NetworkConfig, + mempoolService: MempoolService, + reputationService: ReputationService, + metrics: PerChainMetrics | null + ) { + super( + logger, + chainId, + network, + provider, + config, + networkConfig, + mempoolService, + reputationService, + metrics + ); + } + + async sendBundle(bundle: Bundle): Promise { + const availableIndex = this.getAvailableRelayerIndex(); + if (availableIndex == null) return; + + const relayer = this.relayers[availableIndex]; + const mutex = this.mutexes[availableIndex]; + + const { entries } = bundle; + if (!bundle.entries.length) return; + + await mutex.runExclusive(async (): Promise => { + const beneficiary = await this.selectBeneficiary(relayer); + const entryPoint = entries[0]!.entryPoint; + const entryPointContract = IEntryPoint__factory.connect( + entryPoint, + this.provider + ); + + const txRequest = entryPointContract.interface.encodeFunctionData( + "handleOps", + [entries.map((entry) => entry.userOp), beneficiary] + ); + + const transactionRequest: providers.TransactionRequest = { + to: entryPoint, + data: txRequest, + type: 2, + maxPriorityFeePerGas: bundle.maxPriorityFeePerGas, + maxFeePerGas: bundle.maxFeePerGas, + gasLimit: estimateBundleGasLimit( + this.networkConfig.bundleGasLimitMarkup, + bundle.entries + ), + chainId: this.provider._network.chainId, + nonce: await relayer.getTransactionCount(), + }; + + try { + // checking for tx revert + await relayer.estimateGas(transactionRequest); + } catch (err) { + this.logger.debug( + `${entries + .map((entry) => entry.userOpHash) + .join("; ")} failed on chain estimation. deleting...` + ); + this.logger.error(err); + await this.mempoolService.removeAll(entries); + this.reportFailedBundle(); + return; + } + + await this.submitTransaction(relayer, transactionRequest) + .then(async (txHash) => { + this.logger.debug(`Echo: Bundle submitted: ${txHash}`); + this.logger.debug( + `Echo: User op hashes ${entries.map((entry) => entry.userOpHash)}` + ); + await this.mempoolService.setStatus( + entries, + MempoolEntryStatus.Submitted, + txHash + ); + await this.waitForEntries(entries).catch((err) => + this.logger.error(err, "Echo: Could not find transaction") + ); + await this.mempoolService.removeAll(entries); + this.reportSubmittedUserops(txHash, bundle); + }) + .catch(async (err: any) => { + this.reportFailedBundle(); + // Put all userops back to the mempool + // if some userop failed, it will be deleted inside handleUserOpFail() + await this.mempoolService.setStatus(entries, MempoolEntryStatus.New); + if (err === "timeout") { + this.logger.debug("Echo: Timeout"); + return; + } + await this.handleUserOpFail(entries, err); + return; + }); + }); + } + + /** + * signs & sends a transaction + * @param signer wallet + * @param transaction transaction request + * @param storageMap storage map + * @returns transaction hash + */ + private async submitTransaction( + signer: Relayer, + transaction: providers.TransactionRequest + ): Promise { + this.logger.debug(transaction, "Echo: Submitting"); + const echoProvider = new ethers.providers.JsonRpcProvider( + this.networkConfig.rpcEndpointSubmit + ); + + const submitStart = now(); + return new Promise((resolve, reject) => { + let lock = false; + const handler = async (blockNumber: number): Promise => { + if (now() - submitStart > this.submitTimeout) return reject("timeout"); + if (lock) return; + lock = true; + const targetBlock = blockNumber + 1; + const txsSigned = [await signer.signTransaction(transaction)]; + this.logger.debug(`Echo: Trying to submit to block ${targetBlock}`); + try { + const bundleReceipt: EchoSuccessfulResponse = await echoProvider.send( + "eth_sendBundle", + [ + { + txs: txsSigned, + blockNumber: targetBlock, + awaitReceipt: true, + usePublicMempool: false, + }, + ] + ); + lock = false; + if ( + bundleReceipt == null || + bundleReceipt.receiptNotification == null + ) { + return; // try again + } + if (bundleReceipt.receiptNotification.status === "included") { + this.provider.removeListener("block", handler); + resolve(bundleReceipt.bundleHash); + } + if (bundleReceipt.receiptNotification.status === "timedOut") { + return; // try again + } + } catch (err) { + this.provider.removeListener("block", handler); + return reject(err); + } + }; + this.provider.on("block", handler); + }); + } +} + +type EchoSuccessfulResponse = { + bundleHash: string; + receiptNotification: { + status: "included" | "timedOut"; + data: { + blockNumber: number; + elapsedMs: number; + }; + }; +}; From 0ca42d69414172bf10f3a57ebe39aadcac4d47ea Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Fri, 29 Mar 2024 15:43:50 +0500 Subject: [PATCH 2/8] echo integration --- README.md | 2 +- .../executor/src/services/BundlingService/relayers/echo.ts | 6 ++++-- .../src/services/BundlingService/relayers/index.ts | 5 ++++- packages/executor/src/services/BundlingService/service.ts | 4 ++++ packages/types/src/executor/index.ts | 7 ++++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index faac7ac2..7bccf47c 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ For a video tutorial on the above, you can [view this here.](https://www.youtube "account": [] }, "bundleGasLimitMarkup": 25000, # optional, adds some amount of additional gas to a bundle tx - "relayingMode": "classic"; # optional, "flashbots" for Flashbots Builder API, "merkle" for Merkle.io, "kolibri" for kolibr.io + "relayingMode": "classic"; # optional, "flashbots" for Flashbots Builder API, "merkle" for Merkle.io, "kolibri" for kolibr.io, "echo" for Chainbound's Echo "bundleInterval": 10000, # bundle creation interval "bundleSize": 4, # optional, max size of a bundle, 4 userops by default "pvgMarkup": 0 # optional, adds some gas on top of estimated PVG diff --git a/packages/executor/src/services/BundlingService/relayers/echo.ts b/packages/executor/src/services/BundlingService/relayers/echo.ts index 5d744608..502addbf 100644 --- a/packages/executor/src/services/BundlingService/relayers/echo.ts +++ b/packages/executor/src/services/BundlingService/relayers/echo.ts @@ -1,4 +1,4 @@ -import { ethers, providers } from "ethers"; +import { providers } from "ethers"; import { PerChainMetrics } from "monitoring/lib"; import { Logger, NetworkName } from "types/lib"; import { IEntryPoint__factory } from "types/lib/executor/contracts"; @@ -135,7 +135,7 @@ export class EchoRelayer extends BaseRelayer { transaction: providers.TransactionRequest ): Promise { this.logger.debug(transaction, "Echo: Submitting"); - const echoProvider = new ethers.providers.JsonRpcProvider( + const echoProvider = new providers.JsonRpcProvider( this.networkConfig.rpcEndpointSubmit ); @@ -161,6 +161,7 @@ export class EchoRelayer extends BaseRelayer { }, ] ); + this.logger.debug(bundleReceipt, "Echo: received receipt"); lock = false; if ( bundleReceipt == null || @@ -176,6 +177,7 @@ export class EchoRelayer extends BaseRelayer { return; // try again } } catch (err) { + this.logger.error(err, "Echo: received error"); this.provider.removeListener("block", handler); return reject(err); } diff --git a/packages/executor/src/services/BundlingService/relayers/index.ts b/packages/executor/src/services/BundlingService/relayers/index.ts index fe1c95f7..19790911 100644 --- a/packages/executor/src/services/BundlingService/relayers/index.ts +++ b/packages/executor/src/services/BundlingService/relayers/index.ts @@ -2,14 +2,17 @@ import { ClassicRelayer } from "./classic"; import { FlashbotsRelayer } from "./flashbots"; import { MerkleRelayer } from "./merkle"; import { KolibriRelayer } from "./kolibri"; +import { EchoRelayer } from "./echo"; export * from "./classic"; export * from "./flashbots"; export * from "./merkle"; export * from "./kolibri"; +export * from "./echo"; export type RelayerClass = | typeof ClassicRelayer | typeof FlashbotsRelayer | typeof MerkleRelayer - | typeof KolibriRelayer; + | typeof KolibriRelayer + | typeof EchoRelayer; diff --git a/packages/executor/src/services/BundlingService/service.ts b/packages/executor/src/services/BundlingService/service.ts index 915ffc86..a799f8f6 100644 --- a/packages/executor/src/services/BundlingService/service.ts +++ b/packages/executor/src/services/BundlingService/service.ts @@ -30,6 +30,7 @@ import { MerkleRelayer, RelayerClass, KolibriRelayer, + EchoRelayer, } from "./relayers"; import { getUserOpGasLimit } from "./utils"; @@ -69,6 +70,9 @@ export class BundlingService { } else if (relayingMode === "kolibri") { this.logger.debug(`${this.network}: Using kolibri relayer`); Relayer = KolibriRelayer; + } else if (relayingMode === "echo") { + this.logger.debug(`${this.network}: Using kolibri relayer`); + Relayer = EchoRelayer; } else { this.logger.debug(`${this.network}: Using classic relayer`); Relayer = ClassicRelayer; diff --git a/packages/types/src/executor/index.ts b/packages/types/src/executor/index.ts index 97b97c0a..a29e79ba 100644 --- a/packages/types/src/executor/index.ts +++ b/packages/types/src/executor/index.ts @@ -1,4 +1,9 @@ -export type RelayingMode = "merkle" | "flashbots" | "classic" | "kolibri"; +export type RelayingMode = + | "merkle" + | "flashbots" + | "classic" + | "kolibri" + | "echo"; export interface SendBundleReturn { transactionHash: string; userOpHashes: string[]; From 566e34fa55367b96ef8017cb221647f2d8bb99cd Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Fri, 29 Mar 2024 15:50:30 +0500 Subject: [PATCH 3/8] update optimism sdk --- packages/params/package.json | 2 +- yarn.lock | 126 ++++++++++++++++++++--------------- 2 files changed, 73 insertions(+), 55 deletions(-) diff --git a/packages/params/package.json b/packages/params/package.json index d4908eca..7f40c404 100644 --- a/packages/params/package.json +++ b/packages/params/package.json @@ -23,7 +23,7 @@ "dependencies": { "@arbitrum/sdk": "3.1.4", "@chainsafe/ssz": "0.10.1", - "@eth-optimism/sdk": "3.0.0", + "@eth-optimism/sdk": "3.2.3", "@mantleio/sdk": "0.2.1", "ethers": "5.7.2", "types": "^1.0.46-alpha", diff --git a/yarn.lock b/yarn.lock index 6512d175..e99b50e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -541,15 +541,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eth-optimism/contracts-bedrock@0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.15.0.tgz#e4cf596c416de5efb4ca7339be889708868c9d17" - integrity sha512-p6whbEsxENrsJ7OkxtPa39BdgmQVeRRquEjt7Qj4oNCooBSeXcWPbx+AtKO/UkODXekuT3inpeWk7QZqmaH0IQ== - dependencies: - "@eth-optimism/core-utils" "^0.12.1" - "@openzeppelin/contracts" "4.7.3" - "@openzeppelin/contracts-upgradeable" "4.7.3" - ethers "^5.7.0" +"@eth-optimism/contracts-bedrock@0.17.1": + version "0.17.1" + resolved "https://registry.yarnpkg.com/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.17.1.tgz#729b1dc53ec23d02ea9e68181f994955129f7415" + integrity sha512-Hc5peN5PM8kzl9dzqSD5jv6ED3QliO1DF0dXLRJxfrXR7/rmEeyuAYESUwUM0gdJZjkwRYiS5m230BI6bQmnlw== "@eth-optimism/contracts@0.6.0": version "0.6.0" @@ -582,28 +577,10 @@ bufio "^1.0.7" chai "^4.3.4" -"@eth-optimism/core-utils@0.12.1": - version "0.12.1" - resolved "https://registry.yarnpkg.com/@eth-optimism/core-utils/-/core-utils-0.12.1.tgz#2d65601e220d1b697eb9b9fe9c1d2df06c1f559a" - integrity sha512-H2NnH9HTVDJmr9Yzb5R7GrAaYimcyIY4bF5Oud0xM1/DP4pSoNMtWm1kG3ZBpdqHFFYWH9GiSZZC5/cjFdKBEA== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/contracts" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/web" "^5.7.0" - chai "^4.3.4" - -"@eth-optimism/core-utils@^0.12.1": - version "0.12.3" - resolved "https://registry.yarnpkg.com/@eth-optimism/core-utils/-/core-utils-0.12.3.tgz#7799292ee2155d6f5dd67e2ee58e4a1fbcfd87d4" - integrity sha512-NzHai4HCWbHbnuu4HJaDhT8aGGZXyrKqgteHGhOPKGHRl3DTuuisD/baFq1XVck6X0iHjDihQOLuygtxkdL19A== +"@eth-optimism/core-utils@0.13.1": + version "0.13.1" + resolved "https://registry.yarnpkg.com/@eth-optimism/core-utils/-/core-utils-0.13.1.tgz#f15ec207a629c9bbf1a10425c1b4a4c0be544755" + integrity sha512-1FvzbUmCEy9zSKPG1QWg2VfA2Cy90xBA9Wkp11lXXrz91zUPCNCNSRTujXWYIC86ketNsZp7p4njSf6lTycHCw== dependencies: "@ethersproject/abi" "^5.7.0" "@ethersproject/abstract-provider" "^5.7.0" @@ -616,21 +593,22 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/rlp" "^5.7.0" "@ethersproject/web" "^5.7.1" - chai "^4.3.7" + chai "^4.3.9" ethers "^5.7.2" node-fetch "^2.6.7" -"@eth-optimism/sdk@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@eth-optimism/sdk/-/sdk-3.0.0.tgz#cba13b85d7b634a1f1f66e1daca3a8603d8aad64" - integrity sha512-tl5Rh1rRBuohSc0/EZgQFVoICFF9Hv+gHWuf5EcI9+xZXEC0F3gFUbTk7VtkyKW0gHNIRL/H+I7Cu0us9eEu+g== +"@eth-optimism/sdk@3.2.3": + version "3.2.3" + resolved "https://registry.yarnpkg.com/@eth-optimism/sdk/-/sdk-3.2.3.tgz#42aa99ed388355ec85b5cf68589aaa15f0c6c7f6" + integrity sha512-e3XQTbbU+HTzsEv/VIsJpZifK6YZVlzEtF6tj/Vz/VIEDCjZk5JPcnCQOMVcs9ICI4EJyyur+y/+RU7fPa6qtg== dependencies: "@eth-optimism/contracts" "0.6.0" - "@eth-optimism/contracts-bedrock" "0.15.0" - "@eth-optimism/core-utils" "0.12.1" + "@eth-optimism/contracts-bedrock" "0.17.1" + "@eth-optimism/core-utils" "0.13.1" lodash "^4.17.21" - merkletreejs "^0.2.27" + merkletreejs "^0.3.11" rlp "^2.2.7" + semver "^7.6.0" "@ethereumjs/rlp@^4.0.1": version "4.0.1" @@ -3221,16 +3199,6 @@ resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.7.0.tgz#b139c81999c23e3c8d3c0a7234480e945920fc40" integrity sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw== -"@openzeppelin/contracts-upgradeable@4.7.3": - version "4.7.3" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.7.3.tgz#f1d606e2827d409053f3e908ba4eb8adb1dd6995" - integrity sha512-+wuegAMaLcZnLCJIvrVUDzA9z/Wp93f0Dla/4jJvIhijRrPabjQbZe6fWiECLaJyfn5ci9fqf9vTw3xpQOad2A== - -"@openzeppelin/contracts@4.7.3": - version "4.7.3" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.7.3.tgz#939534757a81f8d69cc854c7692805684ff3111e" - integrity sha512-dGRS0agJzu8ybo44pCIf3xBaPQN/65AIXNgK8+4gzKd5kbvlqyxryUYVLJv7fK98Seyd2hDZzVEHSWAh0Bt1Yw== - "@parcel/watcher@2.0.4": version "2.0.4" resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.4.tgz#f300fef4cc38008ff4b8c29d92588eced3ce014b" @@ -4657,7 +4625,7 @@ catering@^2.0.0, catering@^2.1.0: resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== -chai@^4.3.4, chai@^4.3.7: +chai@^4.3.4: version "4.3.8" resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.8.tgz#40c59718ad6928da6629c70496fe990b2bb5b17c" integrity sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ== @@ -4670,6 +4638,19 @@ chai@^4.3.4, chai@^4.3.7: pathval "^1.1.1" type-detect "^4.0.5" +chai@^4.3.9: + version "4.4.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.4.1.tgz#3603fa6eba35425b0f2ac91a009fe924106e50d1" + integrity sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.3" + deep-eql "^4.1.3" + get-func-name "^2.0.2" + loupe "^2.3.6" + pathval "^1.1.1" + type-detect "^4.0.8" + chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -4702,6 +4683,13 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== +check-error@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" + integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== + dependencies: + get-func-name "^2.0.2" + chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -5067,6 +5055,11 @@ crypto-js@^3.1.9-1: resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.3.0.tgz#846dd1cce2f68aacfa156c8578f926a609b7976b" integrity sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q== +crypto-js@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" + integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== + dargs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" @@ -5179,7 +5172,7 @@ dedent@^1.0.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== -deep-eql@^4.1.2: +deep-eql@^4.1.2, deep-eql@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== @@ -5766,7 +5759,7 @@ ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: "@scure/bip32" "1.3.1" "@scure/bip39" "1.2.1" -ethers@5.7.2, ethers@^5.1.0, ethers@^5.6.8, ethers@^5.7.0, ethers@^5.7.2: +ethers@5.7.2, ethers@^5.1.0, ethers@^5.6.8, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -6302,7 +6295,7 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.0: +get-func-name@^2.0.0, get-func-name@^2.0.1, get-func-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== @@ -8331,6 +8324,13 @@ loupe@^2.3.1: dependencies: get-func-name "^2.0.0" +loupe@^2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" + integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== + dependencies: + get-func-name "^2.0.1" + lowercase-keys@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" @@ -8497,6 +8497,17 @@ merkletreejs@^0.2.27: treeify "^1.1.0" web3-utils "^1.3.4" +merkletreejs@^0.3.11: + version "0.3.11" + resolved "https://registry.yarnpkg.com/merkletreejs/-/merkletreejs-0.3.11.tgz#e0de05c3ca1fd368de05a12cb8efb954ef6fc04f" + integrity sha512-LJKTl4iVNTndhL+3Uz/tfkjD0klIWsHlUzgtuNnNrsf7bAlXR30m+xYB7lHr5Z/l6e/yAIsr26Dabx6Buo4VGQ== + dependencies: + bignumber.js "^9.0.1" + buffer-reverse "^1.0.1" + crypto-js "^4.2.0" + treeify "^1.1.0" + web3-utils "^1.3.4" + micro-ftch@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" @@ -10246,6 +10257,13 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.6.0: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -10940,7 +10958,7 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5: +type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5, type-detect@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== From e9e1fec3046793ca15e7b46dc02dc9035201ced6 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Mon, 1 Apr 2024 14:42:35 +0500 Subject: [PATCH 4/8] add echo auth key config & refactor relayers & fix rootstock mainnet issue --- packages/executor/src/config.ts | 1 + packages/executor/src/executor.ts | 19 +------------------ packages/executor/src/interfaces.ts | 2 ++ packages/executor/src/modules/eth.ts | 3 ++- packages/executor/src/modules/skandha.ts | 1 + .../services/BundlingService/relayers/echo.ts | 12 +++++++++--- .../BundlingService/relayers/flashbots.ts | 5 +++++ .../BundlingService/relayers/merkle.ts | 8 ++++++++ .../src/services/BundlingService/service.ts | 2 +- .../UserOpValidation/validators/estimation.ts | 3 ++- .../UserOpValidation/validators/unsafe.ts | 3 ++- 11 files changed, 34 insertions(+), 25 deletions(-) diff --git a/packages/executor/src/config.ts b/packages/executor/src/config.ts index 4d44b574..a9e31894 100644 --- a/packages/executor/src/config.ts +++ b/packages/executor/src/config.ts @@ -455,6 +455,7 @@ const bundlerDefaultConfigs: BundlerConfig = { bundleGasLimit: 25000000, kolibriAuthKey: "", entryPointForwarder: "", + echoAuthKey: "", }; const NETWORKS_ENV = (): string[] | undefined => { diff --git a/packages/executor/src/executor.ts b/packages/executor/src/executor.ts index 16c2d06a..2c33825a 100644 --- a/packages/executor/src/executor.ts +++ b/packages/executor/src/executor.ts @@ -157,28 +157,11 @@ export class Executor { this.bundlingService.setBundlingMode("manual"); this.logger.info(`${this.networkName}: [X] MANUAL BUNDLING`); } + if (this.config.testingMode) { this.bundlingService.setMaxBundleSize(10); } - if (this.networkConfig.relayingMode === "flashbots") { - if (!this.networkConfig.rpcEndpointSubmit) - throw Error( - "If you want to use Flashbots Builder API, please set API url in 'rpcEndpointSubmit' in config file" - ); - this.logger.info(`${this.networkName}: [X] FLASHBOTS BUIDLER API`); - } - if (this.networkConfig.relayingMode === "merkle") { - if ( - !this.networkConfig.rpcEndpointSubmit || - !this.networkConfig.merkleApiURL - ) - throw Error( - "If you want to use Merkle API, please set RPC url in 'rpcEndpointSubmit' and API url in `merkleApiURL` in config file" - ); - this.logger.info(`${this.networkName}: [X] Merkle API`); - } - if (this.networkConfig.conditionalTransactions) { this.logger.info(`${this.networkName}: [x] CONDITIONAL TRANSACTIONS`); } diff --git a/packages/executor/src/interfaces.ts b/packages/executor/src/interfaces.ts index 18109e8d..20a33176 100644 --- a/packages/executor/src/interfaces.ts +++ b/packages/executor/src/interfaces.ts @@ -160,6 +160,8 @@ export interface NetworkConfig { kolibriAuthKey: string; // catches EntryPoint v6 simulation reverts and returns them without revert entryPointForwarder: string; + // api auth key for echo: https://echo.chainbound.io/docs/usage/api-interface#authentication + echoAuthKey: string; } export type BundlerConfig = Omit< diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index 0ec4f0b1..760abdf6 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -175,7 +175,8 @@ export class Eth { .add(this.config.vglMarkup) .toNumber(); - let preVerificationGas: BigNumberish = this.calcPreVerificationGas(userOpComplemented); + let preVerificationGas: BigNumberish = + this.calcPreVerificationGas(userOpComplemented); userOpComplemented.preVerificationGas = preVerificationGas; let callGasLimit: BigNumber = BigNumber.from(0); diff --git a/packages/executor/src/modules/skandha.ts b/packages/executor/src/modules/skandha.ts index 1db95bf9..725cb451 100644 --- a/packages/executor/src/modules/skandha.ts +++ b/packages/executor/src/modules/skandha.ts @@ -30,6 +30,7 @@ export class Skandha { throw new Error("No network config"); } this.networkConfig = networkConfig; + void this.getConfig().then((config) => this.logger.debug(config)); } async getGasPrice(): Promise { diff --git a/packages/executor/src/services/BundlingService/relayers/echo.ts b/packages/executor/src/services/BundlingService/relayers/echo.ts index 502addbf..342cec56 100644 --- a/packages/executor/src/services/BundlingService/relayers/echo.ts +++ b/packages/executor/src/services/BundlingService/relayers/echo.ts @@ -37,6 +37,9 @@ export class EchoRelayer extends BaseRelayer { reputationService, metrics ); + if (this.networkConfig.echoAuthKey.length === 0) { + throw new Error("Echo API key is missing"); + } } async sendBundle(bundle: Bundle): Promise { @@ -135,9 +138,12 @@ export class EchoRelayer extends BaseRelayer { transaction: providers.TransactionRequest ): Promise { this.logger.debug(transaction, "Echo: Submitting"); - const echoProvider = new providers.JsonRpcProvider( - this.networkConfig.rpcEndpointSubmit - ); + const echoProvider = new providers.JsonRpcProvider({ + url: this.networkConfig.rpcEndpointSubmit, + headers: { + "x-api-key": this.networkConfig.echoAuthKey, + }, + }); const submitStart = now(); return new Promise((resolve, reject) => { diff --git a/packages/executor/src/services/BundlingService/relayers/flashbots.ts b/packages/executor/src/services/BundlingService/relayers/flashbots.ts index fef9817d..85c76717 100644 --- a/packages/executor/src/services/BundlingService/relayers/flashbots.ts +++ b/packages/executor/src/services/BundlingService/relayers/flashbots.ts @@ -41,6 +41,11 @@ export class FlashbotsRelayer extends BaseRelayer { reputationService, metrics ); + if (!this.networkConfig.rpcEndpointSubmit) { + throw Error( + "If you want to use Flashbots Builder API, please set API url in 'rpcEndpointSubmit' in config file" + ); + } } async sendBundle(bundle: Bundle): Promise { diff --git a/packages/executor/src/services/BundlingService/relayers/merkle.ts b/packages/executor/src/services/BundlingService/relayers/merkle.ts index 8e085951..09d6699e 100644 --- a/packages/executor/src/services/BundlingService/relayers/merkle.ts +++ b/packages/executor/src/services/BundlingService/relayers/merkle.ts @@ -38,6 +38,14 @@ export class MerkleRelayer extends BaseRelayer { reputationService, metrics ); + if ( + !this.networkConfig.rpcEndpointSubmit || + !this.networkConfig.merkleApiURL + ) { + throw Error( + "If you want to use Merkle API, please set RPC url in 'rpcEndpointSubmit' and API url in `merkleApiURL` in config file" + ); + } } async sendBundle(bundle: Bundle): Promise { diff --git a/packages/executor/src/services/BundlingService/service.ts b/packages/executor/src/services/BundlingService/service.ts index a799f8f6..0b2b06df 100644 --- a/packages/executor/src/services/BundlingService/service.ts +++ b/packages/executor/src/services/BundlingService/service.ts @@ -71,7 +71,7 @@ export class BundlingService { this.logger.debug(`${this.network}: Using kolibri relayer`); Relayer = KolibriRelayer; } else if (relayingMode === "echo") { - this.logger.debug(`${this.network}: Using kolibri relayer`); + this.logger.debug(`${this.network}: Using echo relayer`); Relayer = EchoRelayer; } else { this.logger.debug(`${this.network}: Using classic relayer`); diff --git a/packages/executor/src/services/UserOpValidation/validators/estimation.ts b/packages/executor/src/services/UserOpValidation/validators/estimation.ts index 2c44d1ce..ba4f1119 100644 --- a/packages/executor/src/services/UserOpValidation/validators/estimation.ts +++ b/packages/executor/src/services/UserOpValidation/validators/estimation.ts @@ -99,7 +99,8 @@ export class EstimationService { const forwarder = new Contract( this.networkConfig.entryPointForwarder, - forwarderABI + forwarderABI, + this.provider ); const data = await this.provider.call({ to: this.networkConfig.entryPointForwarder, diff --git a/packages/executor/src/services/UserOpValidation/validators/unsafe.ts b/packages/executor/src/services/UserOpValidation/validators/unsafe.ts index 9a70d57b..00eeca78 100644 --- a/packages/executor/src/services/UserOpValidation/validators/unsafe.ts +++ b/packages/executor/src/services/UserOpValidation/validators/unsafe.ts @@ -48,7 +48,8 @@ export class UnsafeValidationService { const forwarder = new Contract( this.networkConfig.entryPointForwarder, - forwarderABI + forwarderABI, + this.provider ); const data = await this.provider.call({ to: this.networkConfig.entryPointForwarder, From 791168f23a05962e6ab64139af5cd387dcdbc9b1 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Mon, 1 Apr 2024 16:04:22 +0500 Subject: [PATCH 5/8] fix: duplicate userop removal --- packages/api/src/modules/debug.ts | 2 +- packages/executor/src/services/BundlingService/relayers/echo.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/api/src/modules/debug.ts b/packages/api/src/modules/debug.ts index 00732347..23ca6d33 100644 --- a/packages/api/src/modules/debug.ts +++ b/packages/api/src/modules/debug.ts @@ -3,7 +3,7 @@ import { Debug } from "executor/lib/modules"; import { IsEthereumAddress } from "class-validator"; import { BundlingMode } from "types/lib/api/interfaces"; import { GetStakeStatus } from "executor/lib/interfaces"; -import { MempoolEntrySerialized } from "executor/src/entities/interfaces"; +import { MempoolEntrySerialized } from "executor/lib/entities/interfaces"; import { RpcMethodValidator } from "../utils/RpcMethodValidator"; import { SetReputationArgs, diff --git a/packages/executor/src/services/BundlingService/relayers/echo.ts b/packages/executor/src/services/BundlingService/relayers/echo.ts index 342cec56..86ec94ef 100644 --- a/packages/executor/src/services/BundlingService/relayers/echo.ts +++ b/packages/executor/src/services/BundlingService/relayers/echo.ts @@ -108,7 +108,6 @@ export class EchoRelayer extends BaseRelayer { await this.waitForEntries(entries).catch((err) => this.logger.error(err, "Echo: Could not find transaction") ); - await this.mempoolService.removeAll(entries); this.reportSubmittedUserops(txHash, bundle); }) .catch(async (err: any) => { From 08cd1746a64f74b746b812262081266c7cfa51ff Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Mon, 1 Apr 2024 16:09:48 +0500 Subject: [PATCH 6/8] chore: release 1.0.48-alpha --- lerna.json | 2 +- package.json | 2 +- packages/api/package.json | 8 ++++---- packages/cli/package.json | 14 +++++++------- packages/contracts/package.json | 2 +- packages/db/package.json | 4 ++-- packages/executor/package.json | 8 ++++---- packages/monitoring/package.json | 4 ++-- packages/node/package.json | 16 ++++++++-------- packages/params/package.json | 6 +++--- packages/types/package.json | 2 +- packages/utils/package.json | 4 ++-- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lerna.json b/lerna.json index d4fe4167..6376955b 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ ], "npmClient": "yarn", "useWorkspaces": true, - "version": "1.0.46-alpha", + "version": "1.0.48-alpha", "stream": "true", "command": { "version": { diff --git a/package.json b/package.json index 79b4e003..c46302a3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "root", "private": true, - "version": "1.0.46-alpha", + "version": "1.0.48-alpha", "engines": { "node": ">=18.0.0" }, diff --git a/packages/api/package.json b/packages/api/package.json index a3d1fcb0..8ce73f88 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "api", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha", + "executor": "^1.0.48-alpha", "fastify": "4.14.1", - "monitoring": "^1.0.46-alpha", + "monitoring": "^1.0.48-alpha", "pino": "8.11.0", "pino-pretty": "10.0.0", "reflect-metadata": "0.1.13", - "types": "^1.0.46-alpha" + "types": "^1.0.48-alpha" }, "devDependencies": { "@types/connect": "3.4.35" diff --git a/packages/cli/package.json b/packages/cli/package.json index ec01b1af..3b79283c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "cli", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha", - "db": "^1.0.46-alpha", - "executor": "^1.0.46-alpha", + "api": "^1.0.48-alpha", + "db": "^1.0.48-alpha", + "executor": "^1.0.48-alpha", "find-up": "5.0.0", "got": "12.5.3", "js-yaml": "4.1.0", - "monitoring": "^1.0.46-alpha", - "node": "^1.0.46-alpha", - "types": "^1.0.46-alpha", + "monitoring": "^1.0.48-alpha", + "node": "^1.0.48-alpha", + "types": "^1.0.48-alpha", "yargs": "17.6.2" }, "devDependencies": { diff --git a/packages/contracts/package.json b/packages/contracts/package.json index cfd224f0..04fe3921 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "contracts", - "version": "1.0.46-alpha", + "version": "1.0.48-alpha", "description": "Smart contracts of Etherspot bundler client", "author": "Etherspot", "homepage": "https://https://github.com/etherspot/skandha#readme", diff --git a/packages/db/package.json b/packages/db/package.json index 9290d969..66ff7e12 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "db", - "version": "1.0.46-alpha", + "version": "1.0.47-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.46-alpha" + "types": "^1.0.47-alpha" }, "devDependencies": { "@types/rocksdb": "3.0.1", diff --git a/packages/executor/package.json b/packages/executor/package.json index d80435af..d8a0f6fd 100644 --- a/packages/executor/package.json +++ b/packages/executor/package.json @@ -1,6 +1,6 @@ { "name": "executor", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha", - "params": "^1.0.46-alpha", - "types": "^1.0.46-alpha" + "monitoring": "^1.0.48-alpha", + "params": "^1.0.48-alpha", + "types": "^1.0.48-alpha" } } diff --git a/packages/monitoring/package.json b/packages/monitoring/package.json index e88d8ee3..5052e0e7 100644 --- a/packages/monitoring/package.json +++ b/packages/monitoring/package.json @@ -1,6 +1,6 @@ { "name": "monitoring", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha" + "types": "^1.0.48-alpha" } } diff --git a/packages/node/package.json b/packages/node/package.json index b41518cb..13ea7761 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,6 +1,6 @@ { "name": "node", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha", + "api": "^1.0.48-alpha", "datastore-core": "8.0.1", - "db": "^1.0.46-alpha", + "db": "^1.0.48-alpha", "ethers": "5.7.2", - "executor": "^1.0.46-alpha", + "executor": "^1.0.48-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.46-alpha", - "params": "^1.0.46-alpha", + "monitoring": "^1.0.48-alpha", + "params": "^1.0.48-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.46-alpha", - "utils": "^1.0.46-alpha", + "types": "^1.0.48-alpha", + "utils": "^1.0.48-alpha", "varint": "6.0.0", "xxhash-wasm": "1.0.2" }, diff --git a/packages/params/package.json b/packages/params/package.json index 7f40c404..d29e8987 100644 --- a/packages/params/package.json +++ b/packages/params/package.json @@ -1,6 +1,6 @@ { "name": "params", - "version": "1.0.46-alpha", + "version": "1.0.48-alpha", "description": "Various bundler parameters", "author": "Etherspot", "homepage": "https://github.com/etherspot/skandha#readme", @@ -26,8 +26,8 @@ "@eth-optimism/sdk": "3.2.3", "@mantleio/sdk": "0.2.1", "ethers": "5.7.2", - "types": "^1.0.46-alpha", - "utils": "^1.0.46-alpha" + "types": "^1.0.48-alpha", + "utils": "^1.0.48-alpha" }, "scripts": { "clean": "rm -rf lib && rm -f *.tsbuildinfo", diff --git a/packages/types/package.json b/packages/types/package.json index 62e3524b..c8fbef91 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "types", - "version": "1.0.46-alpha", + "version": "1.0.48-alpha", "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 e98e0d63..7f4fbc39 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "utils", - "version": "1.0.46-alpha", + "version": "1.0.48-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.46-alpha" + "types": "^1.0.48-alpha" } } From 34af3061f37e99a19035cb5dc6371a6335033b14 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Mon, 1 Apr 2024 16:18:06 +0500 Subject: [PATCH 7/8] fix db version --- packages/db/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/db/package.json b/packages/db/package.json index 66ff7e12..f033b32d 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "db", - "version": "1.0.47-alpha", + "version": "1.0.48-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.47-alpha" + "types": "^1.0.48-alpha" }, "devDependencies": { "@types/rocksdb": "3.0.1", From a269faf7feea05c7d8f9d29bb94ff787a7d32d5f Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Mon, 1 Apr 2024 16:55:25 +0500 Subject: [PATCH 8/8] getUserOpByHash - fetch userop from mempool too --- packages/executor/src/modules/eth.ts | 14 ++++++++++++++ packages/types/src/api/interfaces.ts | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index 760abdf6..4dd4650e 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -307,6 +307,20 @@ export class Eth { async getUserOperationByHash( hash: string ): Promise { + const entry = await this.mempoolService.getEntryByHash(hash); + if (entry) { + let transaction: Partial = {}; + if (entry.transaction) { + transaction = await this.provider.getTransaction(entry.transaction); + } + return { + userOperation: entry.userOp, + entryPoint: entry.entryPoint, + transactionHash: transaction.hash, + blockHash: transaction.blockHash, + blockNumber: transaction.blockNumber, + }; + } const [entryPoint, event] = await this.getUserOperationEvent(hash); if (!entryPoint || !event) { return null; diff --git a/packages/types/src/api/interfaces.ts b/packages/types/src/api/interfaces.ts index d6960252..cb2e437b 100644 --- a/packages/types/src/api/interfaces.ts +++ b/packages/types/src/api/interfaces.ts @@ -16,9 +16,9 @@ export type EstimatedUserOperationGas = export type UserOperationByHashResponse = { userOperation: UserOperationStruct; entryPoint: string; - blockNumber: number; - blockHash: string; - transactionHash: string; + blockNumber?: number; + blockHash?: string; + transactionHash?: string; }; export type GetGasPriceResponse = {