repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
big-bear-scripts | github_2023 | others | 8 | bigbeartechworld | coderabbitai[bot] | @@ -140,23 +140,152 @@ check_dns_resolution() {
"registry.hub.docker.com"
"gcr.io"
"azurecr.io"
- "ghcr.io",
+ "ghcr.io"
"registry.gitlab.com"
)
+ local retries=3
+ local timeout=5
+ local dns_servers=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
... | _:warning: Potential issue_
**Avoid declaring and assigning 'local' variables in the same line to prevent masking return values**
In the `check_cpu_load` function, splitting declarations and assignments enhances the script's reliability.
Apply this diff:
```diff
- local load=$(uptime | awk -F'load average:... |
big-bear-scripts | github_2023 | others | 8 | bigbeartechworld | coderabbitai[bot] | @@ -140,23 +140,152 @@ check_dns_resolution() {
"registry.hub.docker.com"
"gcr.io"
"azurecr.io"
- "ghcr.io",
+ "ghcr.io"
"registry.gitlab.com"
)
+ local retries=3
+ local timeout=5
+ local dns_servers=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
... | _:warning: Potential issue_
**Avoid declaring and assigning 'local' variables in the same line to prevent masking return values**
In the `check_memory_usage` function, this practice prevents potential issues with function return values.
Apply this diff:
```diff
- local total_mem=$(free -m | awk '/^Mem:/ { ... |
big-bear-scripts | github_2023 | others | 8 | bigbeartechworld | coderabbitai[bot] | @@ -140,23 +140,152 @@ check_dns_resolution() {
"registry.hub.docker.com"
"gcr.io"
"azurecr.io"
- "ghcr.io",
+ "ghcr.io"
"registry.gitlab.com"
)
+ local retries=3
+ local timeout=5
+ local dns_servers=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
... | _:warning: Potential issue_
**Avoid declaring and assigning 'local' variables in the same line to prevent masking return values**
In Bash, declaring and assigning a `local` variable in the same line can mask the return value of the function. It's recommended to declare the variable and assign it in separate statement... |
big-bear-scripts | github_2023 | others | 8 | bigbeartechworld | coderabbitai[bot] | @@ -140,23 +140,152 @@ check_dns_resolution() {
"registry.hub.docker.com"
"gcr.io"
"azurecr.io"
- "ghcr.io",
+ "ghcr.io"
"registry.gitlab.com"
)
+ local retries=3
+ local timeout=5
+ local dns_servers=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
... | _:warning: Potential issue_
**Use portable regex options with 'grep'**
The `-P` option for `grep` (Perl-compatible regex) may not be available on all systems. To enhance portability, consider using `-E` for extended regular expressions or adjust the pattern accordingly.
Apply this diff to improve compatibility:
`... |
alto | github_2023 | typescript | 465 | pimlicolabs | plusminushalf | @@ -18,7 +18,9 @@ import { SignedAuthorizationList } from "viem/experimental"
import { AltoConfig } from "../createConfig"
export const isTransactionUnderpricedError = (e: BaseError) => {
- return e?.details
+ const deepestError = e.walk() | would it make sense to have something like:
```ts
const transactionUnderPriceError e.walk(e => e?.message?. toLowerCase()
.includes("replacement transaction underpriced"))
return transactionUnderPriceError !== null
``` |
alto | github_2023 | typescript | 467 | pimlicolabs | mouseless0x | @@ -599,22 +600,19 @@ export class RpcHandler {
preVerificationGas = scaleBigIntByPercent(preVerificationGas, 110n)
// Check if userOperation passes without estimation balance overrides
- if (isVersion06(simulationUserOperation)) {
- await this.validator.getExecutionResult({
- ... | I think we should spread the original userOperation here to ensure the maxFee/maxPriorityFee is used |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -0,0 +1,55 @@
+import { SenderManager } from "."
+import { AltoConfig } from "../../createConfig"
+import { GasPriceManager } from "../../handlers/gasPriceManager"
+import { flushStuckTransaction } from "../utils"
+
+export const flushOnStartUp = async ({
+ senderManager,
+ gasPriceManager,
+ config
+}: {
+... | this function should have an async and await on `flushStuckTransaction` for this to return promises |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -250,14 +232,42 @@ export const setupServer = async ({
})
if (config.refillingWallets) { | Can we leave a comment in the config that this must only be enabled on a single instance. Otherwise all the instance will try to send money to all the wallets. |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -0,0 +1,502 @@
+import {
+ getNonceKeyAndSequence,
+ isVersion06,
+ isVersion07
+} from "../utils/userop"
+import { AltoConfig } from "../createConfig"
+import {
+ Address,
+ HexData32,
+ UserOperation,
+ UserOpInfo,
+ userOpInfoSchema
+} from "@alto/types"
+import { OutstandingStore } from "... | remove as soon as we find so that no other server can bundle the op |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -349,86 +301,75 @@ export class MemoryMempool {
const hasHigherFees = hasHigherPriorityFee && hasHigherMaxFee
if (!hasHigherFees) {
- return [false, reason]
+ const reason =
+ conflicting.reason === "conflicting_deployment"
+ ... | note you will still have to push the op that we will be removing during `findConflictingOutstanding` back to mempool again |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -0,0 +1,312 @@
+import {
+ getNonceKeyAndSequence,
+ isVersion06,
+ isVersion07
+} from "../utils/userop"
+import { AltoConfig } from "../createConfig"
+import { HexData32, UserOpInfo, UserOperation } from "@alto/types"
+import { ConflictingType, OutstandingStore } from "."
+
+const senderNonceSlot = (userO... | can we leave a comment that this is a push to the reference of the array so this will update the state in pendingOps |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -237,6 +240,18 @@ export const gasEstimationArgsSchema = z.object({
"split-simulation-calls": z.boolean()
})
+export const mempoolArgsSchema = z.object({
+ "redis-mempool-url": z.string().optional(),
+ "redis-mempool-concurrency": z.number().int().min(0).default(10),
+ "redis-mempool-queue-name": z.... | can we add `redis-gas-price-queue-url` as well |
alto | github_2023 | typescript | 439 | pimlicolabs | plusminushalf | @@ -0,0 +1,505 @@
+import {
+ getNonceKeyAndSequence,
+ isVersion06,
+ isVersion07
+} from "../utils/userop"
+import { AltoConfig } from "../createConfig"
+import {
+ Address,
+ HexData32,
+ UserOperation,
+ UserOpInfo,
+ userOpInfoSchema
+} from "@alto/types"
+import { OutstandingStore } from "... | Better to do `multi?: ReturnType<Redis["multi"]> = this.redis` |
alto | github_2023 | typescript | 440 | pimlicolabs | mouseless0x | @@ -595,9 +610,12 @@ export function tracerResultParserV07(
if (userOperation.factory) {
// special case: account.validateUserOp is allowed to use assoc storage if factory is staked.
// [STO-022], [STO-021]
+
if (
... | I think it would be better to remove the `.toLowerCase()` here and on entityAddr |
alto | github_2023 | typescript | 438 | pimlicolabs | plusminushalf | @@ -118,12 +83,49 @@ export const bundlerArgsSchema = z.object({
","
)}`
),
- "refilling-wallets": z.boolean().default(true),
- "aa95-gas-multiplier": z.string().transform((val) => BigInt(val)),
"enable-instant-bundling-endpoint": z.boolean(),
"enable-experimental-... | This has not been removed from older config, can you check once. |
alto | github_2023 | typescript | 416 | pimlicolabs | plusminushalf | @@ -677,144 +284,79 @@ export class Executor {
})
let childLogger = this.logger.child({
- userOperations: opsWithHashes.map((oh) => oh.userOperationHash),
+ userOperations: userOperations.map((op) => op.hash), | I actually liked `opsWithHashes` since I don't expect the `userOperations` to have an hash. |
alto | github_2023 | typescript | 164 | pimlicolabs | plusminushalf | @@ -134,7 +137,7 @@ export class UnsafeValidator implements InterfaceValidator {
entryPoint: Address
logger: Logger
metrics: Metrics
- utilityWallet: Account
+ utilityWallet: PrivateKeyAccount | why are we so specific? |
alto | github_2023 | others | 107 | pimlicolabs | kristofgazso | @@ -13,11 +13,12 @@
"dev": "node --inspect packages/cli/lib/alto.js run",
"test": "pnpm -r --workspace-concurrency 1 test --verbose=true",
"test:spec": "./test/spec-tests/run-spec-tests.sh",
- "lint": "rome check ./",
- "lint:fix": "rome check ./ --apply",
+ "lint": "biom... | can we remove |
alto | github_2023 | others | 185 | pimlicolabs | pavlovdog | @@ -0,0 +1,19 @@
+{
+ "network-name": "local",
+ "rpc-url": "http://127.0.0.1:8545",
+ "min-entity-stake": 1,
+ "min-executor-balance": "1000000000000000000",
+ "min-entity-unstake-delay": 1,
+ "max-bundle-wait": 3,
+ "max-bundle-size": 3,
+ "port": 3000,
+ "executor-private-keys": "0xac0974b... | It seems to be outdated, using `0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87` now |
alto | github_2023 | typescript | 185 | pimlicolabs | pavlovdog | @@ -0,0 +1,301 @@
+import {
+ http,
+ createTestClient,
+ createWalletClient,
+ createPublicClient,
+ type Address
+} from "viem"
+import { mnemonicToAccount } from "viem/accounts"
+import { foundry } from "viem/chains"
+import {
+ ENTRY_POINT_SIMULATIONS_CREATECALL,
+ ENTRY_POINT_V06_CREATECALL,
+... | Same here |
alto | github_2023 | others | 185 | pimlicolabs | pavlovdog | @@ -1,102 +1,46 @@
#!/usr/bin/env bash | hm, I'm not sure if it's cross-platform, can you somehow detect the used env? |
alto | github_2023 | typescript | 419 | pimlicolabs | mouseless0x | @@ -790,8 +790,21 @@ export class ExecutorManager {
await this.refreshUserOperationStatuses()
// for all still not included check if needs to be replaced (based on gas price)
- const gasPriceParameters =
- await this.gasPriceManager.tryGetNetworkGasPrice()
+ let gasPricePara... | should we set `this.currentlyHandlingBlock = false` here when it early exits due to not finding gasPrice |
alto | github_2023 | typescript | 384 | pimlicolabs | mouseless0x | @@ -358,17 +358,21 @@ export function calcVerificationGasAndCallGasLimit(
paid: bigint
},
chainId: number,
- callDataResult?: {
- gasUsed: bigint
+ gasLimits?: {
+ callGasLimit?: bigint
+ verificationGasLimit?: bigint
+ paymasterVerificationGasLimit?: bigint
}
... | Is this still needed after the binary search change? |
alto | github_2023 | typescript | 367 | pimlicolabs | plusminushalf | @@ -119,7 +119,8 @@ export const bundlerArgsSchema = z.object({
),
"refilling-wallets": z.boolean().default(true),
"aa95-gas-multiplier": z.string().transform((val) => BigInt(val)),
- "enable-instant-bundling-endpoint": z.boolean()
+ "enable-instant-bundling-endpoint": z.boolean(),
+ "enable... | can we rename this to enable-experimental-7702-endpoints. |
alto | github_2023 | typescript | 367 | pimlicolabs | plusminushalf | @@ -139,6 +140,10 @@ export async function bundlerHandler(args_: IOptionsInput): Promise<void> {
chain
})
+ if (args.enableExperimental7702Endpoints) { | we can always extend, I don't see any issue in extending extra functions. |
alto | github_2023 | typescript | 381 | pimlicolabs | nikmel2803 | @@ -190,6 +190,13 @@ export function createMetrics(registry: Registry, register = true) {
registers
})
+ const walletsProcessingTime = new Gauge({ | that won't work, it must be a Histogram |
alto | github_2023 | typescript | 381 | pimlicolabs | nikmel2803 | @@ -190,6 +190,13 @@ export function createMetrics(registry: Registry, register = true) {
registers
})
+ const walletsProcessingTime = new Histogram({
+ name: "alto_executor_wallets_processing_time_seconds", | ```suggestion
name: "alto_executor_wallets_processing_duration_seconds",
```
duration is a more common word for naming Histograms |
alto | github_2023 | typescript | 381 | pimlicolabs | nikmel2803 | @@ -251,6 +252,12 @@ export class SenderManager {
{ executor: wallet.address },
"pushed wallet to sender manager"
)
+ const processingTime = this.walletProcessingTime.get(wallet.address)
+ if (processingTime) { | do we really need this check now? should be always non-nullable |
alto | github_2023 | typescript | 337 | pimlicolabs | plusminushalf | @@ -395,7 +289,7 @@ export class GasPriceManager {
this.logger.warn("maxFeePerGas is undefined, using fallback value")
try {
maxFeePerGas =
- (await this.getNextBaseFee(this.config.publicClient)) +
+ (await this.config.publicClient.getGasP... | Why do we have this change? Rest LGTM |
alto | github_2023 | typescript | 331 | pimlicolabs | nikmel2803 | @@ -542,8 +541,10 @@ export class RpcHandler implements IRpcEndpoint {
entryPoint,
queuedUserOperations,
false,
- deepHexlify(stateOverrides)
+ deepHexlify({ ...stateOverrides })
)
+ } catch (err) {
+ this.lo... | ```suggestion
this.logger.error({ err }, "Second simulations fail")
```
we should use `err` for logging an Error: https://getpino.io/#/docs/api?id=mergingobject-object
> If the object is of type Error, it is wrapped in an object containing a property err ({ err: mergingObject }). This allows for a u... |
alto | github_2023 | typescript | 317 | pimlicolabs | plusminushalf | @@ -11,38 +11,34 @@ export const EXECUTE_SIMULATOR_BYTECODE =
"0x60806040526004361061012e5760003560e01c806372b37bca116100ab578063b760faf91161006f578063b760faf914610452578063bb9fe6bf14610465578063c23a5cea1461047a578063d6383f941461049a578063ee219423146104ba578063fc7e286d146104da57600080fd5b806372b37bca146103bd578063... | we might want to add `...deepHexlify(stateOverride?.[entryPoint] || {})` |
alto | github_2023 | typescript | 317 | pimlicolabs | plusminushalf | @@ -11,38 +11,34 @@ export const EXECUTE_SIMULATOR_BYTECODE =
"0x60806040526004361061012e5760003560e01c806372b37bca116100ab578063b760faf91161006f578063b760faf914610452578063bb9fe6bf14610465578063c23a5cea1461047a578063d6383f941461049a578063ee219423146104ba578063fc7e286d146104da57600080fd5b806372b37bca146103bd578063... | if user has passed balance override for `userOperation.sender` will this not override our balance override for first estimation? |
alto | github_2023 | typescript | 299 | pimlicolabs | plusminushalf | @@ -494,6 +495,12 @@ export const getUserOperationHashV07 = (
)
}
+export function userOperationToJson(userOperation: MempoolUserOperation) { | we have a global bigint convertor right? |
alto | github_2023 | typescript | 284 | pimlicolabs | plusminushalf | @@ -460,7 +461,20 @@ export class ExecutorManager {
})
this.executor.markWalletProcessed(transactionInfo.executor)
- } else if (bundlingStatus.status === "reverted") {
+ } else if (
+ bundlingStatus.status === "reverted" &&
+ bundlingStatus.isAA95
+ ... | can we make this an env variable? |
alto | github_2023 | typescript | 274 | pimlicolabs | nikmel2803 | @@ -162,6 +162,13 @@ export function createMetrics(registry: Registry, register = true) {
registers
})
+ const executorWalletsBalances = new Gauge({
+ name: "alto_executor_wallets_balances", | ```suggestion
name: "alto_executor_wallet_balance",
``` |
alto | github_2023 | typescript | 274 | pimlicolabs | nikmel2803 | @@ -46,6 +46,11 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
type: "number",
default: 15 * 1000 // 15 seconds
},
+ "executor-wallets-monitor-interval": {
+ description: "Interval for checking executor wallets balances",
+ type: "number",
+ defau... | it seems like this option isn't necessary already? |
alto | github_2023 | typescript | 271 | pimlicolabs | plusminushalf | @@ -83,7 +83,10 @@ export const bundlerArgsSchema = z.object({
"max-gas-per-bundle": z
.string()
.transform((val) => BigInt(val))
- .default("5000000")
+ .default("5000000"),
+ "stateless-enabled": z | Would it better to just take a list of methods that can be enabled?
And we can pass the list like:
`eth_chainId,eth_supportedEntryPoints,eth_estimateUserOperationGas,eth_getUserOperationByHash,eth_getUserOperationReceipt`
And have a separate param to enable or disable the refill wallets functionality? |
alto | github_2023 | typescript | 271 | pimlicolabs | plusminushalf | @@ -83,7 +84,20 @@ export const bundlerArgsSchema = z.object({
"max-gas-per-bundle": z
.string()
.transform((val) => BigInt(val))
- .default("5000000")
+ .default("5000000"),
+ "supported-rpc-methods": z | Can we say enabled-rpc-methods instead of supported? As we do support all? Also default can be nullish that means all are enabled? |
alto | github_2023 | typescript | 271 | pimlicolabs | plusminushalf | @@ -430,14 +444,12 @@ export class GasPriceManager {
const baseFee = latestBlock.baseFeePerGas
this.saveBaseFeePerGas(baseFee, Date.now())
- this.logger.debug({
- baseFee
- }, "Base fee update");
+ return baseFee
}
public async getBaseFee(): Promise<bigint... | What if `this.queueBaseFeePerGas[this.queueBaseFeePerGas.length - 1];` is empty? server start or something like that? |
alto | github_2023 | typescript | 267 | pimlicolabs | nikmel2803 | @@ -169,6 +169,13 @@ export function createMetrics(registry: Registry, register = true) {
registers
})
+ const emittedEvents = new Counter({
+ name: "emitted_events", | ```suggestion
name: "alto_emitted_user_operation_events",
```
1) `alto_` prefix is necessary
2) added `user_operation` for more clarity |
alto | github_2023 | typescript | 263 | pimlicolabs | kristofgazso | @@ -402,6 +433,16 @@ export const setupServer = async ({
logger
})
+ const compressionHandler = await getCompressionHandler({
+ client,
+ parsedArgs
+ })
+ const eventManager = getEventManager({ | this should be optional? |
alto | github_2023 | typescript | 248 | pimlicolabs | plusminushalf | @@ -592,31 +595,39 @@ export class RpcHandler implements IRpcEndpoint {
return null
}
- let op: UserOperationV06 | PackedUserOperation | undefined = undefined
+ let op: UserOperationV06 | UserOperationV07
try {
const decoded = decodeFunctionData({
- ... | What is this selector 0x765e827f? Can we create a constant and name it? |
alto | github_2023 | typescript | 248 | pimlicolabs | plusminushalf | @@ -519,283 +494,131 @@ export class SafeValidator
userOperation: UserOperationV07,
entryPoint: Address
): Promise<[ValidationResultV07, BundlerTracerResult]> {
+ if (!this.entryPointSimulationsAddress) {
+ throw new Error("entryPointSimulationsAddress is not set")
+ }
+
... | Hey just to be sure we don't need this because we don't revert in the PimlicoSimulationsContract? |
alto | github_2023 | typescript | 223 | pimlicolabs | nikmel2803 | @@ -0,0 +1,72 @@
+import { spawn } from "node:child_process"
+import { generatePrivateKey, privateKeyToAddress } from "viem/accounts"
+import { type Hex, createTestClient, http, parseEther } from "viem"
+import waitPort from "wait-port"
+import { sleep } from "./utils"
+
+// skip docker wait times, just start locally
+... | don't you think we need some timeout or max retries here? i see global timeout in CI job, but anyway |
alto | github_2023 | typescript | 220 | pimlicolabs | mouseless0x | @@ -177,9 +176,43 @@ export function packUserOpV06(op: UserOperationV06): `0x${string}` {
)
}
-export function packedUserOperationToRandomDataUserOp(
- packedUserOperation: PackedUserOperation
-) {
+export function removeZeroBytesFromUserOp<T extends UserOperation>(
+ userOpearation: T | small nit userOpearation -> userOperation |
alto | github_2023 | typescript | 220 | pimlicolabs | mouseless0x | @@ -372,12 +394,24 @@ export function calcDefaultPreVerificationGas(
): bigint {
const ov = { ...DefaultGasOverheads, ...(overheads ?? {}) }
- const p = { ...userOperation }
- p.preVerificationGas ?? 21000n // dummy value, just for calldata cost
- p.signature =
- p.signature === "0x" ? toHex(Buf... | I think this console.log should be removed? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -104,7 +104,31 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
type: "string",
require: false,
default: "105,110,115"
- }
+ },
+ "mempool-parallel-user-operations-max-size": {
+ description: "Maximum amount of parallel user ops to keep in the meempo... | single |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -104,7 +104,31 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
type: "string",
require: false,
default: "105,110,115"
- }
+ },
+ "mempool-parallel-user-operations-max-size": { | maybe better as `mempool-max-parallel-ops`, `mempool-max-queued-ops`, `enforce-unique-senders`, `max-gas-per-bundle`? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -104,7 +104,31 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
type: "string",
require: false,
default: "105,110,115"
- }
+ },
+ "mempool-parallel-user-operations-max-size": {
+ description: "Maximum amount of parallel user ops to keep in the meempo... | setting these two to 0 is breaking an non-backward compatible. shouldn't we set them to a higher number? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -104,7 +104,31 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
type: "string",
require: false,
default: "105,110,115"
- }
+ },
+ "mempool-parallel-user-operations-max-size": {
+ description: "Maximum amount of parallel user ops to keep in the meempo... | same with this, this is breaking |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -547,6 +596,24 @@ export class MemoryMempool {
minOps?: number
): Promise<UserOperationInfo[]> {
const outstandingUserOperations = this.store.dumpOutstanding().slice()
+
+ // Sort userops before the execution
+ // Decide the order of the userops based on the sender and nonce
+ ... | should we be sorting by nonce value instead? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -617,6 +684,64 @@ export class MemoryMempool {
return null
}
+ async getQueuedUserOperations( | i'm kind of confused what this function is supposed to do. could you maybe comment it a bit? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -367,11 +367,48 @@ export class RpcHandler implements IRpcEndpoint {
// Since we don't want our estimations to depend upon baseFee, we set
// maxFeePerGas to maxPriorityFeePerGas
userOperation.maxPriorityFeePerGas = userOperation.maxFeePerGas
+
+
+ // Check if the nonce is v... | wait, we should keep supporting queued nonces for v0.6 no? users rely on it. it's just that we can't pre-simulate them before adding them to the queue |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -269,3 +271,90 @@ test("pimlico_sendCompressedUserOperation can bundle multiple compressed userOps
await publicClient.getBytecode({ address: relayer.account.address })
).toEqual(simpleAccountDeployedBytecode)
})
+
+test("eth_sendUserOperation supports bundling with the same sender and different nonce ... | worth doing another test for being able to queue up nonce values? |
alto | github_2023 | typescript | 207 | pimlicolabs | kristofgazso | @@ -488,251 +490,10 @@ export function simulateHandleOp(
return simulateHandleOpV07(
userOperation,
+ queuedUserOperations as UserOperationV07[],
entryPoint,
publicClient,
- userOperation.sender,
- userOperation.callData,
entryPointSimulationsAddress,
... | why are we removing this? |
alto | github_2023 | typescript | 201 | pimlicolabs | plusminushalf | @@ -134,20 +135,22 @@ export class Server {
this.fastify.post("/:version/rpc", this.rpcHttp.bind(this))
this.fastify.post("/", this.rpcHttp.bind(this))
- this.fastify.register(async (fastify) => {
- fastify.route({
- method: "GET",
- url: "/:version/rp... | Hey I just noticed this but `${version}` will be shown as it is, rather we should get the version from the request and put it here. |
alto | github_2023 | typescript | 201 | pimlicolabs | plusminushalf | @@ -96,6 +96,7 @@ export const compatibilityArgsSchema = z.object({
export const serverArgsSchema = z.object({
port: z.number().int().min(0),
timeout: z.number().int().min(0).optional(),
+ "websocket": z.boolean().default(false), | Also @pavlovdog we will have to enable it in gitops now if we do want websocket support on prodcution. |
alto | github_2023 | typescript | 197 | pimlicolabs | plusminushalf | @@ -89,6 +92,12 @@ export class Server {
disableRequestLogging: true
})
+ this.fastify.register(websocket, {
+ options: {
+ maxPayload: 1048576 // maximum allowed messages size is 1 MiB | can we make this configurable? |
alto | github_2023 | typescript | 197 | pimlicolabs | plusminushalf | @@ -113,16 +122,32 @@ export class Server {
this.metrics.httpRequests.labels(labels).inc()
- const durationMs = reply.getResponseTime()
+ const durationMs = reply.elapsedTime
const durationSeconds = durationMs / 1000
this.metrics.httpRequestsDuration
... | can we add more information like, we expect a POST request in `/v1/rpc` call?
so like:
```
await reply.status(500).send(`GET request to /${version}/rpc is not supported, use POST isntead.`)
``` |
alto | github_2023 | typescript | 197 | pimlicolabs | nikmel2803 | @@ -113,16 +122,32 @@ export class Server {
this.metrics.httpRequests.labels(labels).inc()
- const durationMs = reply.getResponseTime()
+ const durationMs = reply.elapsedTime
const durationSeconds = durationMs / 1000
this.metrics.httpRequestsDuration
... | can you clarify why do we need this wrapper here pls? as i understand it's something like fastify plugin? but why is it needed here? |
alto | github_2023 | typescript | 197 | pimlicolabs | nikmel2803 | @@ -0,0 +1,57 @@
+import { FastifyReply } from "fastify"
+import * as WebSocket from "ws"
+
+class ReplyMiddleware { | little bit confused by a name 'middleware', maybe smth like RpcReply would be better? |
alto | github_2023 | typescript | 196 | pimlicolabs | plusminushalf | @@ -105,6 +105,18 @@ export async function simulateHandleOpV06(
} catch (e) {
const err = e as RpcRequestErrorType
+ if (
+ /return data out of bounds.*|EVM error OutOfOffset.*/.test(
+ err.details
+ )
+ ) {
+ // out of bound (low level evm e... | umm is this chain specific or on all the chains? This seems like a weird error |
alto | github_2023 | typescript | 179 | pimlicolabs | mouseless0x | @@ -149,6 +158,28 @@ export class Server {
): Promise<void> {
reply.rpcStatus = "failed" // default to failed
let requestId: number | null = null
+
+ const versionParsingResult = altoVersions.safeParse(
+ (request.params as any)?.version ?? this.defaultApiVersion | a little confused on why we need the defaultApiVersion flag |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -9,7 +9,13 @@ export const bundlerArgsSchema = z.object({
// allow both a comma separated list of addresses
// (better for cli and env vars) or an array of addresses
// (better for config files)
- entryPoint: addressSchema,
+ entryPoints: z.string().transform((val) => { | you could use a regex to make sure it's the correct comma separated format |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -6,7 +6,14 @@ import {
UrlRequiredError,
createTransport
} from "viem"
-import { type RpcRequest, rpc } from "viem/utils"
+import { rpc } from "viem/utils"
+
+export type RpcRequest = { | why? |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -100,21 +98,54 @@ export class ExecutorManager {
}
}
- async bundleNow(): Promise<Hash> {
+ async bundleNow(): Promise<Hash[]> {
const ops = await this.mempool.process(5_000_000n, 1)
if (ops.length === 0) {
throw new Error("no ops to bundle")
}
- ... | naming convention — can we user either userOperation or op |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -375,13 +445,37 @@ export class ExecutorManager {
async refreshUserOperationStatuses(): Promise<void> {
const ops = this.mempool.dumpSubmittedOps()
- const txs = getTransactionsFromUserOperationEntries(ops)
-
- await Promise.all(
- txs.map(async (txInfo) => {
- ... | should this not be in parallel? |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -202,19 +175,21 @@ export function deepHexlify(obj: any): any {
export function getAddressFromInitCodeOrPaymasterAndData(
data: Hex
-): Address | undefined {
+): Address | null {
if (!data) {
- return undefined
+ return null
}
if (data.length >= 42) {
return getAddress(d... | it's a bit having this a boolean no? surely you'd just want two separate functions, one for each? idk but this seems a bit sus |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -320,16 +336,27 @@ export class MemoryMempool implements Mempool {
storageMap
}
}
- const paymaster = getAddressFromInitCodeOrPaymasterAndData(
- op.paymasterAndData
+
+ const isUserOpV06 = isVersion06(op)
+
+ const paymaster = isUserOpV06
+ ... | out of curiosity why BANNED -> banned? isn't capital standard for enums? |
alto | github_2023 | typescript | 175 | pimlicolabs | kristofgazso | @@ -387,13 +449,74 @@ export const getUserOperationHash = (
)
}
+export const getUserOperationHash = (
+ userOperation: UserOperation,
+ entryPointAddress: Address,
+ chainId: number
+) => {
+ if (isVersion06(userOperation)) {
+ return getUserOperationHashV06(
+ userOperation,
+ ... | UnPacked -> Unpacked? |
alto | github_2023 | typescript | 175 | pimlicolabs | nikmel2803 | @@ -375,11 +443,40 @@ export class ExecutorManager {
async refreshUserOperationStatuses(): Promise<void> {
const ops = this.mempool.dumpSubmittedOps()
- const txs = getTransactionsFromUserOperationEntries(ops)
+ const uniqueEntryPoints = new Set<Address>(
+ ops.map((op) => op.us... | we already know all possible EntryPoints from the config. can we just use it here? without cycling through each userop
and even with current logic we could make it with one iteration |
alto | github_2023 | typescript | 149 | pimlicolabs | kristofgazso | @@ -0,0 +1,450 @@
+import {
+ gasStationResult,
+ type GasPriceParameters,
+ RpcError
+} from "@entrypoint-0.7/types"
+import { parseGwei, type Chain, type PublicClient } from "viem"
+import { type Logger, maxBigInt, minBigInt } from "@alto/utils"
+import * as chains from "viem/chains"
+import * as sentry from... | shouldn't we get rid of this interface to reduce complexity and ability to F12 into things? we could just use the actual Class everywhere |
alto | github_2023 | typescript | 149 | pimlicolabs | kristofgazso | @@ -0,0 +1,450 @@
+import {
+ gasStationResult,
+ type GasPriceParameters,
+ RpcError
+} from "@entrypoint-0.7/types"
+import { parseGwei, type Chain, type PublicClient } from "viem"
+import { type Logger, maxBigInt, minBigInt } from "@alto/utils"
+import * as chains from "viem/chains"
+import * as sentry from... | why are we doing saveGasPrice 3 times in this function instead of abstracting the main implementation into an `innerGetGasPrice` and calling this right after |
alto | github_2023 | typescript | 149 | pimlicolabs | kristofgazso | @@ -0,0 +1,450 @@
+import {
+ gasStationResult,
+ type GasPriceParameters,
+ RpcError
+} from "@entrypoint-0.7/types"
+import { parseGwei, type Chain, type PublicClient } from "viem"
+import { type Logger, maxBigInt, minBigInt } from "@alto/utils"
+import * as chains from "viem/chains"
+import * as sentry from... | wait if `!last` that means queue.length === 0, that's not supposed to be that way, right? |
alto | github_2023 | typescript | 149 | pimlicolabs | kristofgazso | @@ -0,0 +1,450 @@
+import {
+ gasStationResult,
+ type GasPriceParameters,
+ RpcError
+} from "@entrypoint-0.7/types"
+import { parseGwei, type Chain, type PublicClient } from "viem"
+import { type Logger, maxBigInt, minBigInt } from "@alto/utils"
+import * as chains from "viem/chains"
+import * as sentry from... | why not save maxFeePerGas and maxPriorityFeePerGas together? |
alto | github_2023 | typescript | 149 | pimlicolabs | kristofgazso | @@ -0,0 +1,450 @@
+import {
+ gasStationResult,
+ type GasPriceParameters,
+ RpcError
+} from "@entrypoint-0.7/types"
+import { parseGwei, type Chain, type PublicClient } from "viem"
+import { type Logger, maxBigInt, minBigInt } from "@alto/utils"
+import * as chains from "viem/chains"
+import * as sentry from... | how big are we looking to set this? |
alto | github_2023 | others | 116 | pimlicolabs | kristofgazso | @@ -9,21 +9,22 @@
"clean": "rm -rf ./packages/*/lib ./packages/*/*.tsbuildinfo",
"clean-modules": "rm -rf ./packages/*/node_modules node_modules",
"build": "pnpm -r run build",
- "start": "node packages/cli/lib/alto.js run",
- "dev": "node --inspect packages/cli/lib/alto.js run"... | remove this? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -84,115 +30,103 @@ const getBumpAmount = (chainId: number) => {
return 100n
}
-const bumpTheGasPrice = (
- chainId: number,
- gasPriceParameters: GasPriceParameters
-): GasPriceParameters => {
- const bumpAmount = getBumpAmount(chainId)
-
- const result = {
- maxFeePerGas: (gasPriceParamet... | no bump for non-eip1559 chains? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -84,115 +30,103 @@ const getBumpAmount = (chainId: number) => {
return 100n
}
-const bumpTheGasPrice = (
- chainId: number,
- gasPriceParameters: GasPriceParameters
-): GasPriceParameters => {
- const bumpAmount = getBumpAmount(chainId)
-
- const result = {
- maxFeePerGas: (gasPriceParamet... | there is a new celo chain too now no? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -219,13 +220,27 @@ export async function filterOpsAndEstimateGas(
)[Number(errorResult.args[0])]
failingOp.reason = errorResult.args[1]
- } catch (e: unknown) {
+ } catch (_e: unknown) {
logger.error(
... | should this really be an error? since we've got logic to handle it. maybe info? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -84,115 +30,103 @@ const getBumpAmount = (chainId: number) => {
return 100n
}
-const bumpTheGasPrice = (
- chainId: number,
- gasPriceParameters: GasPriceParameters
-): GasPriceParameters => {
- const bumpAmount = getBumpAmount(chainId)
-
- const result = {
- maxFeePerGas: (gasPriceParamet... | is this constantly expected behaviour? is info the right level for this? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -84,115 +30,103 @@ const getBumpAmount = (chainId: number) => {
return 100n
}
-const bumpTheGasPrice = (
- chainId: number,
- gasPriceParameters: GasPriceParameters
-): GasPriceParameters => {
- const bumpAmount = getBumpAmount(chainId)
-
- const result = {
- maxFeePerGas: (gasPriceParamet... | should we not be try catching all these network calls? or do you think this is not required? |
alto | github_2023 | typescript | 105 | pimlicolabs | kristofgazso | @@ -84,115 +30,103 @@ const getBumpAmount = (chainId: number) => {
return 100n
}
-const bumpTheGasPrice = (
- chainId: number,
- gasPriceParameters: GasPriceParameters
-): GasPriceParameters => {
- const bumpAmount = getBumpAmount(chainId)
-
- const result = {
- maxFeePerGas: (gasPriceParamet... | is this constantly expected behaviour? is info the right level for this? |
alto | github_2023 | typescript | 95 | pimlicolabs | kristofgazso | @@ -109,18 +120,65 @@ export class NonceQueuer {
) {
const queuedUserOperations = this.queuedUserOperations.slice()
- const results = await publicClient.multicall({
- contracts: queuedUserOperations.map((qop) => {
- const userOp = deriveUserOperation(qop.mempoolUserOpera... | doesn't viem define a type for this? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -53,6 +53,9 @@ export const bundlerArgsSchema = z.object({
rpcUrl: z.string().url(),
executionRpcUrl: z.string().url().optional(),
+ bundleBulkerAddress: addressSchema,
+ perOpInflatorAddress: addressSchema, | hmmm... why not the perOpInflator id? (as opposed to the address) |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -0,0 +1,76 @@
+import {
+ Address, PerOpInfaltorAbi, bundleBulkerAbi,
+} from "@alto/types"
+import { Client, getContract } from "viem"
+
+type PerOpInflator = {
+ address: Address,
+ bundleBulkerIdRegistry: Record<Address, number> // id of this PerOpInflator in each BundleBulkers
+}
+
+export class Compres... | we don't need to support multiple entrypoints — assume the one that is passed in the env variable is for this entrypoint |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -0,0 +1,76 @@
+import {
+ Address, PerOpInfaltorAbi, bundleBulkerAbi,
+} from "@alto/types"
+import { Client, getContract } from "viem"
+
+type PerOpInflator = {
+ address: Address,
+ bundleBulkerIdRegistry: Record<Address, number> // id of this PerOpInflator in each BundleBulkers
+}
+
+export class Compres... | if an inflator is registered to our perOpInflator we can assume it's whitelisted, no? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -0,0 +1,76 @@
+import {
+ Address, PerOpInfaltorAbi, bundleBulkerAbi,
+} from "@alto/types"
+import { Client, getContract } from "viem"
+
+type PerOpInflator = {
+ address: Address,
+ bundleBulkerIdRegistry: Record<Address, number> // id of this PerOpInflator in each BundleBulkers
+}
+
+export class Compres... | hmm this code seems very Java-like — is there a way to just mark these variables as public without implementing getters? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -0,0 +1,79 @@
+export const bundleBulkerAbi = [
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'ENTRY_POINT',
+ outputs: [{ name: '', internalType: 'address', type: 'address' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function'... | this is the old signature, now submit is instead through the fallback function |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -43,21 +49,20 @@ export interface GasEstimateResult {
export type ReplaceTransactionResult =
| {
- status: "replaced"
- transactionInfo: TransactionInfo
- }
+ status: "replaced"
+ transactionInfo: TransactionInfo
+ }
| {
- status: "potentially_already_inc... | should the sig not include the entryPoint here too? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -168,10 +174,18 @@ export class BasicExecutor implements IExecutor {
walletClient: this.walletClient
})
+ const opsWithHashes = transactionInfo.userOperationInfos.map((_op) => {
+ const op = _op.mempoolUserOp.getUserOperation() | we don't use _ syntax elsewhere in the codebase |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -549,6 +563,172 @@ export class BasicExecutor implements IExecutor {
this.metrics.bundlesSubmitted.inc()
+ return userOperationResults
+ }
+
+async bundleCompressed(compressedOp: CompressedUserOp): Promise<BundleResult[]> {
+ const wallet = await this.senderManager.getWallet()
+
+ ... | yeah let's add multiple op support hah |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -549,6 +563,172 @@ export class BasicExecutor implements IExecutor {
this.metrics.bundlesSubmitted.inc()
+ return userOperationResults
+ }
+
+async bundleCompressed(compressedOp: CompressedUserOp): Promise<BundleResult[]> {
+ const wallet = await this.senderManager.getWallet()
+
+ ... | hmm this whole big block of code is mostly copied — is there a way to apply DRY more? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -549,6 +563,172 @@ export class BasicExecutor implements IExecutor {
this.metrics.bundlesSubmitted.inc()
+ return userOperationResults
+ }
+
+async bundleCompressed(compressedOp: CompressedUserOp): Promise<BundleResult[]> {
+ const wallet = await this.senderManager.getWallet()
+
+ ... | this seems a bit weird — why not just modify the filterOpsAndEstimateGas to estimate gas throught the whole bundleBulker when compressed ops are being used, that way estimation will be done by the native eth_estimateGas call |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -549,6 +563,172 @@ export class BasicExecutor implements IExecutor {
this.metrics.bundlesSubmitted.inc()
+ return userOperationResults
+ }
+
+async bundleCompressed(compressedOp: CompressedUserOp): Promise<BundleResult[]> {
+ const wallet = await this.senderManager.getWallet()
+
+ ... | if this is how we return the transactionInfo then during resubmission the resubmitted ops will be resubmitted non-compressed, directly through the entryPoint. we have to change the `transactionRequest` to be the compressed ops through the bulker no? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -101,8 +103,24 @@ export class ExecutorManager {
return txHash
}
- async sendToExecutor(ops: UserOperation[]) {
- const results = await this.executor.bundle(this.entryPointAddress, ops)
+ async sendToExecutor(ops: MempoolUserOp[]) {
+ const normalOps = [];
+ const compresse... | uhh... can we do this without this weird for loop? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -910,4 +928,151 @@ export class RpcHandler implements IRpcEndpoint {
}
}
}
+
+ async pimlico_sendCompressedUserOperation(
+ compressedCalldata: Hex,
+ entryPoint: Address,
+ inflator: Address
+ ) {
+ // check if inflator is registered with our PerOpInflato... | let's handle the error here? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -910,4 +928,151 @@ export class RpcHandler implements IRpcEndpoint {
}
}
}
+
+ async pimlico_sendCompressedUserOperation(
+ compressedCalldata: Hex,
+ entryPoint: Address,
+ inflator: Address
+ ) {
+ // check if inflator is registered with our PerOpInflato... | hmm should we put this in a function to apply DRY principles? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -910,4 +928,151 @@ export class RpcHandler implements IRpcEndpoint {
}
}
}
+
+ async pimlico_sendCompressedUserOperation(
+ compressedCalldata: Hex,
+ entryPoint: Address,
+ inflator: Address
+ ) {
+ // check if inflator is registered with our PerOpInflato... | as we talked about, we can just assume this is the case |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -0,0 +1,42 @@
+import { Hex, concat, toHex } from "viem"
+import { Address, UserOperation } from "./schemas"
+
+// Type that knows how to encode/decode itself
+export class CompressedUserOp {
+ compressedCalldata: Hex
+ inflatedUserOp: UserOperation
+ inflatorAddr: Address
+ bundleBulkerAddr: Address
+ ... | should entryPointAddr, bundleBulkerAddr, perOpInflatorId really live inside this struct/class? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.