diff --git a/docs/p2p.md b/docs/p2p.md index 9a786e2a..9fdc4d87 100644 --- a/docs/p2p.md +++ b/docs/p2p.md @@ -66,3 +66,44 @@ Example: ``` ./skandha node --redirectRpc --executor.bundlingMode manual --dataDir ./db2 --api.port 14339 --p2p.port 4339 --p2p.enrPort 4339 --p2p.bootEnrs [enr] ``` + +## Use Fastlane relayer + +Use this config values to switch to fastlane relayer which protects bundles from MEV on Polygon + +```json +{ + "entryPoints": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" + ], + "relayers": [ + "0xYOUR_PRIVATE_KEY" + ], + "rpcEndpoint": "https://polygon.blockpi.network/v1/rpc/public ", + "canonicalMempoolId": "QmRJ1EPhmRDb8SKrPLRXcUBi2weUN8VJ8X9zUtXByC7eJg", + "canonicalEntryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "relayingMode": "fastlane", + "conditionalTransactions": true, + "rpcEndpointSubmit": "https://polygon-test-rpc.fastlane.xyz", + "fastlaneValidators": [ + "0x127685D6dD6683085Da4B6a041eFcef1681E5C9C" + ], + "bundleInterval": 2500 +} + +``` + +`canonicalMempoolId` - is the mempool id to which you want to connect\ +`canonicalEntryPoint` - entry point that corresponds to canonical mempool id\ +`rpcEndpointSubmit` - rpc endpoint provided by fastlane that supports `pfl_sendRawTransactionConditional` rpc method\ +`fastlaneValidators` - addresses of validators that support `pfl_sendRawTransactionConditional` rpc method\ +`bundleInterval` - this should be about the same value as block time on Polygon. On each interval Skandha will check if the current proposer matches `fastlaneValidators`, and if so submits the bundle + + +### Notes of Fastlane + +Right now a very limited number of validators are participating in this, so in order to submit bundles Skandha has to wait for the right validator's turn, which usually takes hours and may take even longer. + +### The list of fastlane validators + +- `0x127685D6dD6683085Da4B6a041eFcef1681E5C9C` \ No newline at end of file diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 2dec069d..b7aea014 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -35,7 +35,6 @@ "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js", "lint:sol-logic": "solhint -c .solhint.json 'src/**/*.sol' 'script/**/*.sol'", "lint:sol-tests": "solhint -c .solhint.tests.json 'test/**/*.sol'", - "test": "forge test -vvv", "test:integration": "forge test --match-contract Integration -vvv", "test:unit": "forge test --match-contract Unit -vvv", "test:unit:deep": "FOUNDRY_FUZZ_RUNS=5000 yarn test:unit" diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index 3e63d993..64868d46 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -286,6 +286,8 @@ export class Eth { validAfter: BigNumber.from(validAfter), validUntil: BigNumber.from(validUntil), callGasLimit, + maxFeePerGas: 0, + maxPriorityFeePerGas: 0, }; } diff --git a/packages/executor/test/constants.ts b/packages/executor/test/constants.ts index 9d936382..c0a96c1e 100644 --- a/packages/executor/test/constants.ts +++ b/packages/executor/test/constants.ts @@ -1,9 +1,11 @@ import { constants } from "ethers"; import { StakeInfo } from "../src/interfaces"; -export const TestAccountMnemonic = "test test test test test test test test test test test junk"; +export const TestAccountMnemonic = + "test test test test test test test test test test test junk"; export const EntryPointAddress = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"; -export const SimpleFactoryAddress = "0x6Cf2534C6AA425F20fb6A15FC836C8DD7e8f14e3"; +export const SimpleFactoryAddress = + "0x6Cf2534C6AA425F20fb6A15FC836C8DD7e8f14e3"; export const DefaultRpcUrl = "http://127.0.0.1:8545"; export const NetworkName = "anvil"; export const ChainId = 31337; diff --git a/packages/executor/test/fixtures/getClient.ts b/packages/executor/test/fixtures/getClient.ts index df47170f..a5631195 100644 --- a/packages/executor/test/fixtures/getClient.ts +++ b/packages/executor/test/fixtures/getClient.ts @@ -1,14 +1,19 @@ -import { exec } from "child_process"; -import { now, wait } from "../../src/utils"; +import { exec } from "node:child_process"; import { BytesLike, hexConcat, hexZeroPad, hexlify } from "ethers/lib/utils"; -import { IEntryPoint__factory, SimpleAccountFactory__factory } from "@skandha/types/src/executor/contracts"; -import { DefaultRpcUrl, EntryPointAddress } from "../constants"; +import { + IEntryPoint__factory, + SimpleAccountFactory__factory, +} from "@skandha/types/src/executor/contracts"; import { Wallet, constants, providers, utils } from "ethers"; +import { DefaultRpcUrl, EntryPointAddress } from "../constants"; +import { now, wait } from "../../src/utils"; import { testAccounts } from "./accounts"; let provider: providers.JsonRpcProvider; +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getClient() { + // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (provider) return provider; await runAnvil(); provider = new providers.JsonRpcProvider(DefaultRpcUrl); @@ -17,17 +22,19 @@ export async function getClient() { return provider; } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getWallet(index: number = 0) { const client = await getClient(); return new Wallet(testAccounts[index], client); } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type async function runAnvil() { exec("anvil"); const time = now(); while (now() < time + 5000) { try { - let provider = new providers.JsonRpcProvider(DefaultRpcUrl); + const provider = new providers.JsonRpcProvider(DefaultRpcUrl); (await provider.getNetwork()).chainId; return; } catch (err) { @@ -36,17 +43,23 @@ async function runAnvil() { } } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function deployEntryPointAndFactory() { await deployContractDeterministically(IEntryPoint__factory.bytecode); - await deployContractDeterministically((new SimpleAccountFactory__factory()).getDeployTransaction(EntryPointAddress).data!); + await deployContractDeterministically( + new SimpleAccountFactory__factory().getDeployTransaction(EntryPointAddress) + .data! + ); } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function deployDetermisticDeployer() { - const contractAddress = '0x4e59b44847b379578588920ca78fbf26c0b4956c' - const factoryTx = '0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222' - const factoryDeployer = '0x3fab184622dc19b6109349b94811493bf2a45362' - const deploymentGasPrice = 100e9 - const deploymentGasLimit = 100000 + const contractAddress = "0x4e59b44847b379578588920ca78fbf26c0b4956c"; + const factoryTx = + "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222"; + const factoryDeployer = "0x3fab184622dc19b6109349b94811493bf2a45362"; + const deploymentGasPrice = 100e9; + const deploymentGasLimit = 100000; const factoryDeploymentFee = deploymentGasPrice * deploymentGasLimit; const deployedBytecode = await provider.getCode(contractAddress); @@ -56,18 +69,21 @@ export async function deployDetermisticDeployer() { let tx = await wallet.sendTransaction({ to: factoryDeployer, value: BigInt(factoryDeploymentFee), - nonce: await wallet.getTransactionCount() - }) + nonce: await wallet.getTransactionCount(), + }); await tx.wait(); tx = await provider.sendTransaction(factoryTx); await tx.wait(); - } catch (err) {} + } catch (err) { + /* empty */ + } } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function deployContractDeterministically(bytecode: BytesLike) { const salt = constants.HashZero; const saltBytes32 = hexZeroPad(hexlify(salt), 32); - const deployerAddress = '0x4e59b44847b379578588920ca78fbf26c0b4956c'; + const deployerAddress = "0x4e59b44847b379578588920ca78fbf26c0b4956c"; const bytecodeHash = utils.keccak256(bytecode); const address = utils.getCreate2Address(deployerAddress, salt, bytecodeHash); const deployedBytecode = await provider.getCode(address); @@ -77,9 +93,11 @@ export async function deployContractDeterministically(bytecode: BytesLike) { const tx = await wallet.sendTransaction({ to: deployerAddress, data: hexConcat([saltBytes32, bytecode]), - nonce: await wallet.getTransactionCount() + nonce: await wallet.getTransactionCount(), }); await tx.wait(); - } catch (err) { } + } catch (err) { + /* empty */ + } return address; } diff --git a/packages/executor/test/fixtures/getConfig.ts b/packages/executor/test/fixtures/getConfig.ts index ff5c2649..a471d1ba 100644 --- a/packages/executor/test/fixtures/getConfig.ts +++ b/packages/executor/test/fixtures/getConfig.ts @@ -64,7 +64,9 @@ let config: Config, configUnsafe: Config, networkConfigUnsafe: NetworkConfig; +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getConfigs() { + // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!config) { config = await Config.init(BaseConfig); networkConfig = config.getNetworkConfig(); diff --git a/packages/executor/test/fixtures/modules.ts b/packages/executor/test/fixtures/modules.ts index a37103cf..0bafdde7 100644 --- a/packages/executor/test/fixtures/modules.ts +++ b/packages/executor/test/fixtures/modules.ts @@ -5,6 +5,7 @@ import { logger } from "../mocks/logger"; import { Web3, Debug, Eth } from "../../src/modules"; import { getServices } from "./services"; +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getModules(config: Config, networkConfig: NetworkConfig) { const provider = config.getNetworkProvider()!; const { diff --git a/packages/executor/test/fixtures/services.ts b/packages/executor/test/fixtures/services.ts index 5aeaf78e..75fa469d 100644 --- a/packages/executor/test/fixtures/services.ts +++ b/packages/executor/test/fixtures/services.ts @@ -15,6 +15,7 @@ import { ChainId } from "../constants"; import { logger } from "../mocks/logger"; import { Skandha } from "../../src/modules"; +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getServices( config: Config, networkConfig: NetworkConfig diff --git a/packages/executor/test/fixtures/userOp.ts b/packages/executor/test/fixtures/userOp.ts index 758cc32c..8f387af6 100644 --- a/packages/executor/test/fixtures/userOp.ts +++ b/packages/executor/test/fixtures/userOp.ts @@ -1,8 +1,31 @@ -import { IEntryPoint__factory, SimpleAccountFactory__factory, SimpleAccount__factory } from "@skandha/types/src/executor/contracts" -import { ChainId, DefaultRpcUrl, EntryPointAddress, SimpleFactoryAddress } from "../constants" -import { BigNumber, BigNumberish, Contract, Wallet, ethers, providers, utils } from "ethers"; -import { arrayify, defaultAbiCoder, hexConcat, keccak256 } from "ethers/lib/utils"; +import { + IEntryPoint__factory, + SimpleAccountFactory__factory, + SimpleAccount__factory, +} from "@skandha/types/src/executor/contracts"; +import { + BigNumber, + BigNumberish, + Contract, + Wallet, + ethers, + providers, + utils, +} from "ethers"; +import { + arrayify, + defaultAbiCoder, + hexConcat, + keccak256, +} from "ethers/lib/utils"; import { UserOperationStruct } from "@skandha/types/src/executor/contracts/EntryPoint"; +import { EstimatedUserOperationGas } from "@skandha/types/src/api/interfaces"; +import { + ChainId, + DefaultRpcUrl, + EntryPointAddress, + SimpleFactoryAddress, +} from "../constants"; import { applyEstimatedUserOp, randomAddress } from "../utils"; import { packUserOp } from "../../src/utils"; import { Eth } from "../../src/modules"; @@ -14,13 +37,18 @@ export async function createRandomUnsignedUserOp( ): Promise { const accountAddress = await getCounterFactualAddress(ownerAddress, salt); const isDeployed = await isAccountDeployed(ownerAddress, salt); - const initCode = isDeployed ? '0x' : _getAccountInitCode(ownerAddress, salt); + const initCode = isDeployed ? "0x" : _getAccountInitCode(ownerAddress, salt); const verificationGasLimit = isDeployed ? 100000 : 200000; // random value, double if not deployed const maxFeePerGas = 1; // TODO: fetch gas prices from skandhaService const maxPriorityFeePerGas = 1; // generate random calldata - const callData = _encodeExecute(accountAddress, randomAddress().address, utils.parseUnits('1', 9), '0x'); + const callData = _encodeExecute( + accountAddress, + randomAddress().address, + utils.parseUnits("1", 9), + "0x" + ); const callGasLimit = 35000; return { @@ -33,23 +61,27 @@ export async function createRandomUnsignedUserOp( maxFeePerGas, maxPriorityFeePerGas, preVerificationGas: 45000, - signature: '0x', - paymasterAndData: '0x' - } + signature: "0x", + paymasterAndData: "0x", + }; } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function createSignedUserOp(eth: Eth, wallet: Wallet) { let unsignedUserOp = await createRandomUnsignedUserOp(wallet.address); - const response = await eth.estimateUserOperationGas({ + const response = (await eth.estimateUserOperationGas({ userOp: unsignedUserOp, - entryPoint: EntryPointAddress - }); + entryPoint: EntryPointAddress, + })) as EstimatedUserOperationGas; unsignedUserOp = applyEstimatedUserOp(unsignedUserOp, response); const userOp = await signUserOp(wallet, unsignedUserOp); return userOp; } -export async function signUserOp(wallet: Wallet, userOp: UserOperationStruct): Promise { +export async function signUserOp( + wallet: Wallet, + userOp: UserOperationStruct +): Promise { const userOpHash = getUserOpHash(userOp); const signature = await _signUserOpHash(wallet, userOpHash); return { @@ -58,41 +90,63 @@ export async function signUserOp(wallet: Wallet, userOp: UserOperationStruct): P }; } -export async function getCounterFactualAddress(ownerAddress: string, salt: number = 0): Promise { +export async function getCounterFactualAddress( + ownerAddress: string, + salt: number = 0 +): Promise { try { const provider = new providers.JsonRpcProvider(DefaultRpcUrl); - const initCode = await _getAccountInitCode(ownerAddress, salt); - const entryPoint = IEntryPoint__factory.connect(EntryPointAddress, provider); + const initCode = _getAccountInitCode(ownerAddress, salt); + const entryPoint = IEntryPoint__factory.connect( + EntryPointAddress, + provider + ); await entryPoint.callStatic.getSenderAddress(initCode); throw new Error("getSenderAddress: unexpected result"); } catch (error: any) { const addr = error?.errorArgs?.sender; if (!addr) throw error; - if (addr === ethers.constants.AddressZero) throw new Error('Unsupported chain_id/walletFactoryAddress'); + if (addr === ethers.constants.AddressZero) + throw new Error("Unsupported chain_id/walletFactoryAddress"); return addr; } } -async function isAccountDeployed(ownerAddress: string, salt: number = 0): Promise { +async function isAccountDeployed( + ownerAddress: string, + salt: number = 0 +): Promise { const provider = new providers.JsonRpcProvider(DefaultRpcUrl); - const senderAddressCode = await provider.getCode(getCounterFactualAddress(ownerAddress, salt)); + const senderAddressCode = await provider.getCode( + getCounterFactualAddress(ownerAddress, salt) + ); return senderAddressCode.length > 2; } export function getUserOpHash(userOp: UserOperationStruct): string { const userOpHash = keccak256(packUserOp(userOp, true)); - const enc = defaultAbiCoder.encode(['bytes32', 'address', 'uint256'], [userOpHash, EntryPointAddress, ChainId]); + const enc = defaultAbiCoder.encode( + ["bytes32", "address", "uint256"], + [userOpHash, EntryPointAddress, ChainId] + ); return keccak256(enc); } -async function _signUserOpHash(wallet: Wallet, userOpHash: string): Promise { +async function _signUserOpHash( + wallet: Wallet, + userOpHash: string +): Promise { return await wallet.signMessage(arrayify(userOpHash)); } function _getAccountContract(accountAddress: string): Contract { const provider = new providers.JsonRpcProvider(DefaultRpcUrl); - return new ethers.Contract(accountAddress, SimpleAccount__factory.abi, provider); + return new ethers.Contract( + accountAddress, + SimpleAccount__factory.abi, + provider + ); } async function _getNonce(accountAddress: string): Promise { @@ -100,24 +154,46 @@ async function _getNonce(accountAddress: string): Promise { return await accountContract.getNonce(); } -function _encodeExecute(accountAddress: string, target: string, value: BigNumberish, data: string): string { - const accountContract = new ethers.Contract(accountAddress, SimpleAccount__factory.abi); - return accountContract.interface.encodeFunctionData('execute', [target, value, data]); +function _encodeExecute( + accountAddress: string, + target: string, + value: BigNumberish, + data: string +): string { + const accountContract = new ethers.Contract( + accountAddress, + SimpleAccount__factory.abi + ); + return accountContract.interface.encodeFunctionData("execute", [ + target, + value, + data, + ]); } -function _encodeBatch(accountAddress: string, targets: string[], datas: string[]): string { - const accountContract = new ethers.Contract(accountAddress, SimpleAccount__factory.abi); - return accountContract.interface.encodeFunctionData('executeBatch', [targets, datas]); +function _encodeBatch( + accountAddress: string, + targets: string[], + datas: string[] +): string { + const accountContract = new ethers.Contract( + accountAddress, + SimpleAccount__factory.abi + ); + return accountContract.interface.encodeFunctionData("executeBatch", [ + targets, + datas, + ]); } function _getAccountInitCode(ownerAddress: string, salt: number = 0): string { - const factory = new ethers.Contract(SimpleFactoryAddress, SimpleAccountFactory__factory.abi); + const factory = new ethers.Contract( + SimpleFactoryAddress, + SimpleAccountFactory__factory.abi + ); return hexConcat([ SimpleFactoryAddress, - factory.interface.encodeFunctionData('createAccount', [ - ownerAddress, - salt, - ]), + factory.interface.encodeFunctionData("createAccount", [ownerAddress, salt]), ]); } diff --git a/packages/executor/test/mocks/GethTracer.ts b/packages/executor/test/mocks/GethTracer.ts index df0a8ff7..bc88bda1 100644 --- a/packages/executor/test/mocks/GethTracer.ts +++ b/packages/executor/test/mocks/GethTracer.ts @@ -4,7 +4,7 @@ import { TracerPrestateResponse } from "../../src/interfaces"; export class GethTracer { async debug_traceCall( - tx: providers.TransactionRequest + _tx: providers.TransactionRequest ): Promise { return { callsFromEntryPoint: [], @@ -12,12 +12,10 @@ export class GethTracer { calls: [], logs: [], debug: [], - } + }; } - - async debug_traceCallPrestate( - tx: providers.TransactionRequest - ): Promise { + + async debug_traceCallPrestate(): Promise { return {}; } -} \ No newline at end of file +} diff --git a/packages/executor/test/mocks/logger.ts b/packages/executor/test/mocks/logger.ts index 10dda1e2..3264ecc3 100644 --- a/packages/executor/test/mocks/logger.ts +++ b/packages/executor/test/mocks/logger.ts @@ -1,11 +1,11 @@ import { Logger } from "@skandha/types/src"; export const logger: Logger = { - fatal: (...args: any[]) => {}, - error: (...args: any[]) => {}, - warn: (...args: any[]) => {}, - info: (...args: any[]) => {}, - debug: (...args: any[]) => {}, - trace: (...args: any[]) => {}, - silent: (...args: any[]) => {}, -} + fatal: (..._args: any[]) => {}, + error: (..._args: any[]) => {}, + warn: (..._args: any[]) => {}, + info: (..._args: any[]) => {}, + debug: (..._args: any[]) => {}, + trace: (..._args: any[]) => {}, + silent: (..._args: any[]) => {}, +}; diff --git a/packages/executor/test/unit/modules/eth.test.ts b/packages/executor/test/unit/modules/eth.test.ts index c271e57d..8d18cf37 100644 --- a/packages/executor/test/unit/modules/eth.test.ts +++ b/packages/executor/test/unit/modules/eth.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it } from "vitest"; import { Wallet } from "ethers"; -import { EstimatedUserOperationGas } from "@skandha/types/src/api/interfaces"; import { createRandomUnsignedUserOp, getClient, @@ -40,11 +39,10 @@ describe("Eth module", async () => { it("Simple transfer should pass through estimation", async () => { await setBalance(aaWalletAddress); const userOp = await createRandomUnsignedUserOp(wallet.address); - const response: EstimatedUserOperationGas = - await eth.estimateUserOperationGas({ - userOp, - entryPoint: EntryPointAddress, - }); + const response = await eth.estimateUserOperationGas({ + userOp, + entryPoint: EntryPointAddress, + }); expect(response).toBeDefined(); }); }); diff --git a/packages/executor/test/unit/services/MempoolService.test.ts b/packages/executor/test/unit/services/MempoolService.test.ts index 222c3e54..a594d81a 100644 --- a/packages/executor/test/unit/services/MempoolService.test.ts +++ b/packages/executor/test/unit/services/MempoolService.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, vi } from "vitest"; import { Wallet, constants } from "ethers"; +import { EstimatedUserOperationGas } from "@skandha/types/src/api/interfaces"; import { createRandomUnsignedUserOp, getClient, @@ -48,7 +49,9 @@ describe("Mempool Service", async () => { ); expect.unreachable("Validation should fail"); } catch (err) { - expect(err.message).toContain("fee too low"); + if (err instanceof Error) { + expect(err.message).toContain("fee too low"); + } } try { vi.useFakeTimers(); @@ -64,6 +67,7 @@ describe("Mempool Service", async () => { constants.HashZero ); } catch (err) { + // eslint-disable-next-line no-console console.log(err); expect.unreachable("Validation should not fail"); } finally { @@ -72,6 +76,7 @@ describe("Mempool Service", async () => { }); }); +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type async function prepareTest() { const { config, networkConfig } = await getConfigs(); const { eth: ethModule, mempoolService: service } = await getModules( @@ -81,12 +86,13 @@ async function prepareTest() { return { service, ethModule, networkConfig }; } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type async function createUserOp(eth: Eth, wallet: Wallet) { let unsignedUserOp = await createRandomUnsignedUserOp(wallet.address); - const response = await eth.estimateUserOperationGas({ + const response = (await eth.estimateUserOperationGas({ userOp: unsignedUserOp, entryPoint: EntryPointAddress, - }); + })) as EstimatedUserOperationGas; unsignedUserOp = applyEstimatedUserOp(unsignedUserOp, response); const userOp = await signUserOp(wallet, unsignedUserOp); return userOp; diff --git a/packages/executor/test/unit/services/ReputationService.test.ts b/packages/executor/test/unit/services/ReputationService.test.ts index 5dfb81ad..0b4a8beb 100644 --- a/packages/executor/test/unit/services/ReputationService.test.ts +++ b/packages/executor/test/unit/services/ReputationService.test.ts @@ -190,6 +190,7 @@ describe("Reputation Service", async () => { }); }); +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type async function prepareTest() { const { config, networkConfig } = await getConfigs(); const { reputationService: service } = await getServices( diff --git a/packages/executor/test/utils/applyEstimatedUserOp.ts b/packages/executor/test/utils/applyEstimatedUserOp.ts index 4096012c..dff7d24c 100644 --- a/packages/executor/test/utils/applyEstimatedUserOp.ts +++ b/packages/executor/test/utils/applyEstimatedUserOp.ts @@ -1,7 +1,11 @@ import { EstimatedUserOperationGas } from "@skandha/types/src/api/interfaces"; import { UserOperationStruct } from "@skandha/types/src/executor/contracts/EntryPoint"; -export function applyEstimatedUserOp(userOp: UserOperationStruct, estimated: EstimatedUserOperationGas) { +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export function applyEstimatedUserOp( + userOp: UserOperationStruct, + estimated: EstimatedUserOperationGas +) { userOp.maxFeePerGas = estimated.maxFeePerGas; userOp.maxPriorityFeePerGas = estimated.maxPriorityFeePerGas; userOp.preVerificationGas = estimated.preVerificationGas; diff --git a/packages/executor/test/utils/setBalance.ts b/packages/executor/test/utils/setBalance.ts index 0728837f..84ea0550 100644 --- a/packages/executor/test/utils/setBalance.ts +++ b/packages/executor/test/utils/setBalance.ts @@ -1,16 +1,15 @@ import { BigNumber, BigNumberish } from "ethers"; -import { getClient } from "../fixtures"; import { parseEther } from "ethers/lib/utils"; -import { wait } from "../../src/utils"; +import { getClient } from "../fixtures"; export async function setBalance( address: string, - desiredBalance: BigNumberish = parseEther('1') + desiredBalance: BigNumberish = parseEther("1") ): Promise { const provider = await getClient(); await provider.send("anvil_setBalance", [ address, - BigNumber.from(desiredBalance).toHexString() + BigNumber.from(desiredBalance).toHexString(), ]); - await provider.send('evm_mine', []); + await provider.send("evm_mine", []); } diff --git a/packages/executor/test/vitestSetup.ts b/packages/executor/test/vitestSetup.ts index 7082f319..8ff88bed 100644 --- a/packages/executor/test/vitestSetup.ts +++ b/packages/executor/test/vitestSetup.ts @@ -1,8 +1,8 @@ import { vi } from "vitest"; import { GethTracer } from "./mocks/GethTracer"; -vi.mock('../src/services/UserOpValidation/GethTracer.ts', async () => { +vi.mock("../src/services/UserOpValidation/GethTracer.ts", async () => { return { GethTracer: GethTracer, }; -}); \ No newline at end of file +}); diff --git a/packages/types/src/api/interfaces.ts b/packages/types/src/api/interfaces.ts index 662837ca..37c65be7 100644 --- a/packages/types/src/api/interfaces.ts +++ b/packages/types/src/api/interfaces.ts @@ -2,16 +2,14 @@ import { BigNumberish, providers } from "ethers"; import { UserOperationStruct } from "../executor/contracts/EntryPoint"; import { IWhitelistedEntities } from "../executor"; -export type EstimatedUserOperationGas = - | { - preVerificationGas: BigNumberish; - verificationGas: BigNumberish; - verificationGasLimit: BigNumberish; - callGasLimit: BigNumberish; - validAfter?: BigNumberish; - validUntil?: BigNumberish; - } - | GetGasPriceResponse; +export type EstimatedUserOperationGas = { + preVerificationGas: BigNumberish; + verificationGas: BigNumberish; + verificationGasLimit: BigNumberish; + callGasLimit: BigNumberish; + validAfter?: BigNumberish; + validUntil?: BigNumberish; +} & GetGasPriceResponse; export type UserOperationByHashResponse = { userOperation: UserOperationStruct;