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 |
|---|---|---|---|---|---|---|---|
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
+ ... | yeah should these two functions really live here inside this class? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -10,6 +10,34 @@ export interface ReferencedCodeHashes {
hash: string
}
+export interface MempoolUserOp {
+ getUserOperation(): UserOperation
+}
+
+export class NormalMempoolUserOp implements MempoolUserOp { | should it be called `Normal`? it kinda makes it seem like the other one is not Normal, no? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -3,70 +3,47 @@ import {
} 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 CompressionHandler {
- whiteListedInflators: Address[... | can we do without setting these values as defaults? seems like an antipattern |
alto | github_2023 | others | 78 | pimlicolabs | kristofgazso | @@ -27,6 +27,7 @@
"@alto/types": "*",
"@alto/utils": "*",
"@alto/mempool": "*",
+ "@alto/rpc": "*", | this would create a circular dependency, no?
can we do without importing @alto/rpc here? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -10,20 +10,29 @@ export interface ReferencedCodeHashes {
hash: string
}
+export const deriveUserOperation = (op: MempoolUserOperation): UserOperation => {
+ return isCompressedType(op) ? (op as CompressedUserOperation).inflatedOp : (op as UserOperation)
+}
+
+export const isCompressedType = (op: MempoolUs... | why can't we use the WriteContractParameters type as before? that way we inherit all of viem's good typing |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -46,7 +46,7 @@ import {
import { debug_traceCall } from "./tracer"
import { tracerResultParser } from "./TracerResultParser"
import { IValidator } from "@alto/types"
-import { SenderManager } from "@alto/executor"
+import { SenderManager } from "../../../executor/src" | @alto/executor |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -910,4 +816,175 @@ export class RpcHandler implements IRpcEndpoint {
}
}
}
+
+ // check if we want to bundle userOperation. If yes, add to mempool
+ async addToMempoolIfValid(op: MempoolUserOperation, entryPoint: Address) {
+ const userOperation = deriveUserOperation(op)
+ ... | this only adds the uncompressed version, no? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -62,6 +65,8 @@ import {
estimateVerificationGasLimit
} from "./gasEstimation"
import { NonceQueuer } from "./nonceQueuer"
+import { InflatorAbi } from "@alto/types/src/contracts/Inflator" | should just be importing from @alto/types |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -78,30 +106,43 @@ export async function filterOpsAndEstimateGas(
while (simulatedOps.filter((op) => op.reason === undefined).length > 0) {
try {
- gasLimit = await ep.estimateGas.handleOps(
- [
- simulatedOps
- .filter((op) => op.rea... | you shouldn't need to cast this... right? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -78,30 +106,43 @@ export async function filterOpsAndEstimateGas(
while (simulatedOps.filter((op) => op.reason === undefined).length > 0) {
try {
- gasLimit = await ep.estimateGas.handleOps(
- [
- simulatedOps
- .filter((op) => op.rea... | shouldn't need to cast this either |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -17,6 +18,8 @@ import {
} from "viem"
import { Logger, Metrics, transactionIncluded } from "@alto/utils"
import { getGasPrice } from "@alto/utils"
+import { UserOperation, deriveUserOperation } from "@alto/types/src" | just @alto/types |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -32,88 +32,8 @@ import {
} from "@alto/utils"
import { MemoryStore } from "./store"
import { IReputationManager, ReputationStatuses } from "./reputationManager"
-
-export interface Mempool {
- add(op: UserOperation, referencedContracts?: ReferencedCodeHashes): boolean
- checkEntityMultipleRoleViolation(_op:... | just @alto/types |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -23,7 +25,7 @@ export interface IReputationManager {
userOperation: UserOperation,
accountDeployed: boolean
): void
- crashedHandleOps(userOperation: UserOperation, reason: string): void
+ crashedHandleOps(userOperation: MempoolUserOperation, reason: string): void | should this not stay `UserOperation`? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -549,6 +590,161 @@ export class BasicExecutor implements IExecutor {
this.metrics.bundlesSubmitted.inc()
+ return userOperationResults
+ }
+
+async bundleCompressed(entryPoint: Address, compressedOps: CompressedUserOperation[]): Promise<BundleResult[]> {
+ const wallet = await this.send... | do we really need to create a contract instance here if we just need its address? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -463,22 +501,22 @@ export class BasicExecutor implements IExecutor {
let txHash: HexData32
try {
txHash = await ep.write.handleOps(
- [opsToBundle.map((op) => op.userOperation), wallet.address],
+ [opsToBundle.map((op) => (op.userOperation as UserOperation... | why do we need to cast this? we shouldn't have to, right? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -255,16 +288,16 @@ export class BasicExecutor implements IExecutor {
"replacing transaction"
)
- const txHash = await this.walletClient.writeContract(
+ const txHash = await this.walletClient.sendTransaction( | why sendTransaction instead of writeContract? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -227,19 +250,29 @@ export class BasicExecutor implements IExecutor {
newRequest.gas = this.useUserOperationGasLimitsForSubmission
? opsToBundle.reduce(
- (acc, op) =>
- acc +
- op.userOperation.preVerificationGas +
- ... | why not derivate just once right above this instead of 3 times? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -227,19 +250,29 @@ export class BasicExecutor implements IExecutor {
newRequest.gas = this.useUserOperationGasLimitsForSubmission
? opsToBundle.reduce(
- (acc, op) =>
- acc +
- op.userOperation.preVerificationGas +
- ... | the calldata doesn't change, why re-encode it? can't we reuse it? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -24,16 +27,21 @@ import {
PublicClient,
Transport,
WalletClient,
- getContract
+ encodeFunctionData,
+ getContract,
} from "viem"
import { SenderManager } from "./senderManager"
import { IReputationManager } from "@alto/mempool"
import {
+ CompressedFilterOpsAndEstimateGasParams,
+ ... | just @alto/types |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -13,6 +15,7 @@ import {
getUserOperationHash,
parseViemError
} from "@alto/utils"
+import { CompressionHandler } from "../../rpc/src/compressionHandler" // TODO: fix this | yep plz fix haha |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -215,8 +135,9 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- async checkEntityMultipleRoleViolation(op: UserOperation): Promise<void> {
- if (!this.safeMode) return
+ // biome-ignore lint/nursery/useAwait: keep async to adhere to interface
... | wait can't we just return? why do we need to return Promise.resolve() |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -248,6 +169,8 @@ export class MemoryMempool implements Mempool {
ValidationErrors.OpcodeValidation
)
}
+
+ return Promise.resolve() | same here |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -910,4 +816,183 @@ export class RpcHandler implements IRpcEndpoint {
}
}
}
+
+ // check if we want to bundle userOperation. If yes, add to mempool
+ async addToMempoolIfValid(op: MempoolUserOperation, entryPoint: Address) {
+ const userOperation = deriveUserOperation(op)
+ ... | hmm could we make the inflatorAddress second, and the entryPoint last here?
since sendUserOperation also has the entryPoint last |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -34,28 +42,49 @@ export function simulatedOpsToResults(
success: true,
value: {
userOperation: {
- userOperation: sop.op.userOperation,
- userOperationHash: sop.op.userOperationHash,
+ mempoolU... | maybe cleaner if we use `reduce`? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -34,28 +42,49 @@ export function simulatedOpsToResults(
success: true,
value: {
userOperation: {
- userOperation: sop.op.userOperation,
- userOperationHash: sop.op.userOperationHash,
+ mempoolU... | you can just concat hex strings, you don't need uint8arrays |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -320,6 +315,12 @@ export const bundlerHandler = async (
metrics
)
+ const compressionHandler = new CompressionHandler(
+ parsedArgs.bundleBulkerAddress,
+ parsedArgs.perOpInflatorAddress
+ )
+ await compressionHandler.fetchPerOpInflatorId(client) | could we call this `initialize` or something? |
alto | github_2023 | typescript | 78 | pimlicolabs | kristofgazso | @@ -74,13 +73,16 @@ export type CompressedFilterOpsAndEstimateGasParams = {
}
export function createCompressedCalldata(compressedOps: CompressedUserOperation[], perOpInflatorId: number): Hex {
- let calldata = new Uint8Array([])
- for (const op of compressedOps) {
- const encodedOp = concat([numberToBy... | why not `toHex("")` -> `numerToHex(perOpInflatorId)` |
alto | github_2023 | typescript | 90 | pimlicolabs | kristofgazso | @@ -172,6 +172,12 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
description: "Max block range for rpc calls",
type: "number",
require: false,
+ },
+ flushStuckTransactionsDuringStartUp: {
+ description: "Should the bundler try to flush out all stuck pen... | require true |
alto | github_2023 | typescript | 90 | pimlicolabs | kristofgazso | @@ -172,6 +172,12 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
description: "Max block range for rpc calls",
type: "number",
require: false,
+ },
+ flushStuckTransactionsDuringStartUp: { | StartUp->Startup |
alto | github_2023 | typescript | 90 | pimlicolabs | kristofgazso | @@ -172,6 +172,11 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
description: "Max block range for rpc calls",
type: "number",
require: false,
+ },
+ flushStuckTransactionsDuringStartup: {
+ description: "Should the bundler try to flush out all stuck pen... | oh i'd keep default false |
alto | github_2023 | others | 84 | pimlicolabs | plusminushalf | @@ -12,28 +12,29 @@
"start": "node packages/cli/lib/alto.js run",
"dev": "node --inspect packages/cli/lib/alto.js run",
"test": "pnpm -r --workspace-concurrency 1 test --verbose=true",
- "test:spec": "./test/run-spec-tests.sh",
+ "test:spec": "./test/spec-tests/run-spec-tests.sh... | not for you but I don't know why do we have this dependency, we don't use it anywhere. |
alto | github_2023 | others | 84 | pimlicolabs | nikmel2803 | @@ -0,0 +1,25 @@
+name: Run E2E Tests
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ docker:
+ timeout-minutes: 10
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v1 | ```suggestion
uses: actions/checkout@v4
``` |
alto | github_2023 | others | 84 | pimlicolabs | nikmel2803 | @@ -0,0 +1,6 @@
+FROM ghcr.io/foundry-rs/foundry | why do we need this Dockerfile? you can run this image directly with docker compose |
alto | github_2023 | others | 84 | pimlicolabs | nikmel2803 | @@ -0,0 +1,26 @@
+version: "2.2" | ```suggestion
version: "3.8"
``` |
alto | github_2023 | others | 84 | pimlicolabs | nikmel2803 | @@ -0,0 +1,26 @@
+version: "2.2"
+
+services:
+ anvil:
+ container_name: anvil | is there any specific reason to specify it? i think we can omit it |
alto | github_2023 | typescript | 82 | pimlicolabs | kristofgazso | @@ -203,6 +208,27 @@ export class UnsafeValidator implements IValidator {
this.usingTenderly
) as Promise<ExecutionResult>
}
+
+ if (this.balanceStateOverrideAllowed) {
+ const error = await simulateHandleOp(
+ userOperation,
+ this.... | uh... does this have the correct return type? |
alto | github_2023 | typescript | 82 | pimlicolabs | kristofgazso | @@ -133,6 +133,12 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
require: true,
default: false
},
+ balanceStateOverrideAllowed: { | isn't it just `balanceOverride` as opposed to `balanceStateOverride`? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -151,6 +151,18 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
customGasLimitForEstimation: {
description: "Custom gas limit for estimation",
type: "string"
+ },
+ bundleMode: {
+ description: "set if the bundler should auto bundle or not.", | Grammar / Spelling |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,9 +49,62 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") { | Use Enum here? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,9 +49,62 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") {
+ this.timer = setInterval(async () => {
+ await this.bu... | Should also prob make this bundle frequency configurable |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,9 +49,62 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") {
+ this.timer = setInterval(async () => {
+ await this.bu... | hmm can't this function be sort of merged with the original `bundle` func? seems like there is some overlap |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -134,16 +148,34 @@ export class MemoryMempool implements Mempool {
...this.store.dumpProcessing(),
...this.store.dumpSubmitted().map((sop) => sop.userOperation)
]
- if (allOps.find((uo) => uo.userOperation.sender === op.sender && uo.userOperation.nonce === op.nonce)) {
- ... | is this tested? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -134,16 +148,34 @@ export class MemoryMempool implements Mempool {
...this.store.dumpProcessing(),
...this.store.dumpSubmitted().map((sop) => sop.userOperation)
]
- if (allOps.find((uo) => uo.userOperation.sender === op.sender && uo.userOperation.nonce === op.nonce)) {
- ... | hmm should we not come up with a new status like `replaced` if it's replaced with another op with the same nonce? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -586,19 +596,36 @@ export class RpcHandler implements IRpcEndpoint {
}
async debug_bundler_clearState(): Promise<BundlerClearStateResponseResult> {
- throw new Error("Method not implemented.")
+ if (this.environment !== "development") {
+ throw new RpcError("debug_bundler_clearSt... | hmm we don't use _ naming anywhere else |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | use `Address` type? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | `bigint`? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | `Address` types here? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | is there no better way to log this? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | why do we convert this to a string and use regex logic instead of just working with the array? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,365 @@
+// javascript code of tracer function
+// NOTE: we process this locally for hardhat, but send to geth for remote tracing.
+// should NOT "require" anything, or use logs.
+// see LogTrace for valid types (but alas, this one must be javascript, not typescript).
+
+// This file contains references to va... | I love how we mention the specific rule that is being checked — great for reference! Could we do this in other places too? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -181,17 +237,159 @@ export class UnsafeValidator implements IValidator {
// @ts-ignore
return getSimulationResult(errorResult, this.logger, "validation", this.usingTenderly)
- } else {
- const errorResult = await entryPointContract.simulate.simulateValidation([userOperat... | ) in comment |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -94,9 +95,9 @@ export const validationResultSchema = z
.regex(hexPattern)
.transform((val) => val as HexData)
}),
- stakeInfoSchema,
- stakeInfoSchema,
- stakeInfoSchema
+ stakeInfoSchema.optional(), | is it actually optional? i thought it's always there |
alto | github_2023 | others | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,46 @@
+{
+ "$schema": "./node_modules/rome/configuration_schema.json", | rome? |
alto | github_2023 | others | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,46 @@
+{
+ "$schema": "./node_modules/rome/configuration_schema.json",
+ "files": {
+ "ignore": [
+ "node_modules",
+ "**/node_modules",
+ "CHANGELOG.md",
+ "cache",
+ "coverage",
+ "dist",
+ "tsconfig.json",
+ ... | bruh gimme some more line width |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -46,6 +46,11 @@ export const bundlerArgsSchema = z.object({
logLevel: z.enum(["trace", "debug", "info", "warn", "error", "fatal"]),
logEnvironment: z.enum(["production", "development"]),
+ bundleMode: z.enum(["auto", "manual"]),
+ bundleFequencey: z.number().int().min(0), | typo |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,16 +67,82 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") {
+ this.timer = setInterval(async () => {
+ await this.b... | shouldn't this be using the bundling frequency defined in the config? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,16 +67,82 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") {
+ this.timer = setInterval(async () => {
+ await this.b... | why throw an error here? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -47,16 +67,82 @@ export class ExecutorManager {
this.logger = logger
this.metrics = metrics
- setInterval(async () => {
- await this.bundle()
- }, 1000)
+ if (bundleMode === "auto") {
+ this.timer = setInterval(async () => {
+ await this.b... | what if the total amount of gas for all pending ops is more than 5m, wouldn't we want to send multiple bundles then? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -38,29 +63,48 @@ export interface Mempool {
* @returns An array of user operations.
*/
dumpSubmittedOps(): SubmittedUserOperation[]
+
+ dumpOutstanding(): UserOperationInfo[] | dumpOutstandingOps, no? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | but we should allow multiple ops per sender & paymaster, no? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation( | weird name |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | can we always just use the checksummed versions? when we parse using Zod we use getAddress so if it's validated it should be checksummed. I don't really like relying on lowerCase() |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | sounds like it should be a debug or trace log no? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | same here |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | and here |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -128,69 +205,455 @@ export class MemoryMempool implements Mempool {
this.store.removeProcessing(userOpHash)
}
- add(op: UserOperation) {
- const allOps = [
- ...this.store.dumpOutstanding(),
+ async checkReputationAndMultipleRolesViolation(
+ op: UserOperation,
+ ... | and here |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,603 @@
+import {
+ EntryPointAbi,
+ RpcError,
+ StakeInfo,
+ UserOperation,
+ ValidationErrors,
+ ValidationResult,
+ ValidationResultWithAggregation
+} from "@alto/types"
+import { Logger, getAddressFromInitCodeOrPaymasterAndData } from "@alto/utils"
+import { Address, PublicClient, get... | why bigint? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,603 @@
+import {
+ EntryPointAbi,
+ RpcError,
+ StakeInfo,
+ UserOperation,
+ ValidationErrors,
+ ValidationResult,
+ ValidationResultWithAggregation
+} from "@alto/types"
+import { Logger, getAddressFromInitCodeOrPaymasterAndData } from "@alto/utils"
+import { Address, PublicClient, get... | why bigint?
|
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,756 @@
+// This file contains references to validation rules, in the format [xxx-###]
+// where xxx is OP/STO/COD/EP/SREP/EREP/UREP/ALT, and ### is a number
+// the validation rules are defined in erc-aa-validation.md
+import {
+ Address,
+ Hex,
+ decodeErrorResult,
+ decodeFunctionResult,
+ g... | yeah can we also not do lowercasing here? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -0,0 +1,756 @@
+// This file contains references to validation rules, in the format [xxx-###]
+// where xxx is OP/STO/COD/EP/SREP/EREP/UREP/ALT, and ### is a number
+// the validation rules are defined in erc-aa-validation.md
+import {
+ Address,
+ Hex,
+ decodeErrorResult,
+ decodeFunctionResult,
+ g... | should we not be using an enum for these? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -52,33 +71,80 @@ async function simulateTenderlyCall(publicClient: PublicClient, params: any) {
return parsedObject.cause.data
}
+const ErrorSig = keccak256(Buffer.from("Error(string)")).slice(0, 10) // 0x08c379a0
+const FailedOpSig = keccak256(Buffer.from("FailedOp(uint256,string)")).slice(
+ 0,
+ 10
... | you can natively decode errors with viem |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -241,4 +438,222 @@ export class UnsafeValidator implements IValidator {
throw e
}
}
+
+ async getCodeHashes(addresses: string[]): Promise<ReferencedCodeHashes> {
+ const deployData = encodeDeployData({
+ abi: CodeHashGetterAbi,
+ bytecode: CodeHashGetterByte... | again i think viem can do this for you |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -275,11 +318,36 @@ const bundlerClearStateResponseSchema = z.object({
result: z.literal("ok")
})
+const bundlerClearMempoolResponseSchema = z.object({
+ method: z.literal("debug_bundler_clearMempool"),
+ result: z.literal("ok")
+})
+
const bundlerDumpMempoolResponseSchema = z.object({
method: z.l... | number??? |
alto | github_2023 | typescript | 45 | pimlicolabs | kristofgazso | @@ -1,51 +1,131 @@
import { EntryPointAbi, HexData32, UserOperation } from "@alto/types"
-import { Address, PublicClient, decodeEventLog, encodeAbiParameters, keccak256 } from "viem"
+import {
+ Address,
+ Hex,
+ PublicClient,
+ decodeEventLog,
+ encodeAbiParameters,
+ keccak256,
+} from "viem"
+
+ex... | not &&? |
alto | github_2023 | typescript | 62 | pimlicolabs | plusminushalf | @@ -38,6 +38,16 @@ JSON.stringify = function (
return originalJsonStringify(value, wrapperReplacer, space)
}
+declare module "fastify" { | `fastify` is typed write? |
permissionless.js | github_2023 | typescript | 350 | pimlicolabs | plusminushalf | @@ -0,0 +1,35 @@
+export const KernelV3FactoryAbi = [
+ {
+ type: "constructor",
+ inputs: [{ name: "_impl", type: "address", internalType: "address" }],
+ stateMutability: "nonpayable"
+ },
+ {
+ type: "function", | I think we just use `createAccount` can we remove rest of unused abi |
permissionless.js | github_2023 | others | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,175 @@
+# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
+
+# Logs
+ | Can you add these to the global .gitignore |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,150 @@
+import * as p from "@clack/prompts"
+// import chalk from "chalk";
+import { Command } from "commander"
+
+import { CREATE_PERMISSIONLESS_APP, DEFAULT_APP_NAME } from "../constants"
+import { logger } from "../utils/logger"
+import { validateAppName } from "../utils/validateAppName"
+
+interface CliF... | I see you have simple account & kernel as well right? |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,37 @@
+import path from "path"
+import chalk from "chalk"
+import { execa } from "execa"
+import ora from "ora"
+import {
+ type PackageManager,
+ detectPackageManager
+} from "../utils/detectPackageManager"
+
+export const installDependencies = async (projectDir: string) => {
+ const boilerplateDir... | Hey I saw you have a logger class, I think we can replace such console logs with it. |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,43 @@
+import pathModule from "path"
+
+import { removeTrailingSlash } from "./general"
+
+/**
+ * Parses the appName and its path from the user input.
+ *
+ * Returns a tuple of of `[appName, path]`, where `appName` is the name put in the "package.json"
+ * file and `path` is the path to the directory where... | You can use `indexOfDelimiter !== -1` |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,32 @@
+import Image from "next/image"
+import React from "react"
+
+export const Header: React.FC = () => {
+ return (
+ <div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
+ <p className="fixed left-0 top-0 flex flex-col w-full justify-center b... | I think we might want to change this, as this template shouldn't need to clone anything. |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,37 @@
+import { pimlicoPaymaster } from "@/config/pimlicoConfig"
+import { createSmartAccountClient } from "permissionless"
+import { type SmartAccountClient } from "permissionless"
+import {
+ type SafeSmartAccount,
+ privateKeyToSafeSmartAccount
+} from "permissionless/accounts"
+import { http, type ... | we are creating safe account but the directory is called simple |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | plusminushalf | @@ -0,0 +1,8 @@
+import { createPimlicoBundlerClient } from "permissionless/clients/pimlico"
+import { http } from "viem"
+import { goerli } from "viem/chains"
+
+export const bundlerClient = createPimlicoBundlerClient({
+ chain: goerli, | wagmi config is with sepolia, we might want to change this to sepolia too.
Also we can use transport as:
`https://api.pimlico.io/v1/sepolia/rpc?apikey=API_KEY` |
permissionless.js | github_2023 | others | 96 | pimlicolabs | mouseless0x | @@ -0,0 +1,15 @@
+# create-permissionless-app
+
+To install dependencies:
+
+```bash
+bun install
+```
+
+To run:
+
+```bash
+bun run index.ts | small nit, `bun run ./src/index.ts` |
permissionless.js | github_2023 | others | 96 | pimlicolabs | mouseless0x | @@ -1,12 +1,33 @@
{
"name": "create-permissionless-app",
- "version": "0.0.0",
+ "version": "0.0.1",
"description": "",
- "main": "index.js",
+ "module": "index.ts",
+ "type": "module",
"scripts": {
+ "build": "npx tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": [... | license can be set to MIT |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | mouseless0x | @@ -0,0 +1,42 @@
+import React from "react"
+
+export const Footer = () => {
+ return (
+ <div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-2 lg:text-left">
+ <a
+ href="https://docs.pimlico.io/permissionless"
+ className="group rounded... | This is a dead link |
permissionless.js | github_2023 | typescript | 96 | pimlicolabs | mouseless0x | @@ -0,0 +1,126 @@
+#!/usr/bin/env node
+import path from "path"
+import fs from "fs-extra"
+import { type PackageJson } from "type-fest"
+
+import { runCli } from "./cli/index"
+import { createProject } from "./helpers/createProject"
+import { installDependencies } from "./helpers/installDependencies"
+import { addPack... | Looks like this is a duplicate print? I would remove lines 93-100 and keep 103-113 |
permissionless.js | github_2023 | typescript | 245 | pimlicolabs | wilsoncusack | @@ -0,0 +1,8 @@
+export const COINBASE_SMART_WALLET_IMPLEMENTATION_ADDRESS =
+ "0x000100abaad02f1cfC8Bbe32bD5a564817339E72"
+
+export const COINBASE_SMART_WALLET_FACTORY_ADDRESS =
+ "0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a"
+
+export const ERC1271InputGeneratorByteCode = | we've actually moved away from using this in favor of just manually computing the replaySafeHash. Will try to share code |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -145,5 +150,28 @@ export function createSmartAccountClient(
userOperation
})
+ if (parameters.userOperation?.prepareUserOperation) { | ```ts
const client = Object.assign(
createClient({
...parameters,
chain: parameters.chain ?? client_?.chain,
key,
name,
transport,
type: 'bundlerClient',
}),
{ client: client_, paymaster, paymasterContext, userOperation },
``` |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,231 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ getAddress,
+ maxUint256,
+ parseAbi
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters,
+ type Prep... | use `getAction` |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,231 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ getAddress,
+ maxUint256,
+ parseAbi
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters,
+ type Prep... | use `Client` |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,231 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ getAddress,
+ maxUint256,
+ parseAbi
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters,
+ type Prep... | no need for `parameters.maxFeePerGas` |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,231 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ getAddress,
+ maxUint256,
+ parseAbi
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters,
+ type Prep... | use `erc20Abi` from viem |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,261 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ erc20Abi,
+ getAddress,
+ isAddress,
+ maxUint256
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters... | ```ts
let chainId: number | undefined
async function getChainId(): Promise<number> {
if (chainId) return chainId
if (client.chain) return client.chain.id
const chainId_ = await getAction(client, getChainId_, 'getChainId')({})
chainId = chainId_
return chainId
}
``` |
permissionless.js | github_2023 | typescript | 278 | pimlicolabs | plusminushalf | @@ -0,0 +1,261 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type ContractFunctionParameters,
+ type Transport,
+ encodeFunctionData,
+ erc20Abi,
+ getAddress,
+ isAddress,
+ maxUint256
+} from "viem"
+import {
+ type BundlerClient,
+ type PrepareUserOperationParameters... | omit `callData` |
permissionless.js | github_2023 | typescript | 214 | pimlicolabs | plusminushalf | @@ -0,0 +1,112 @@
+import type {
+ Abi,
+ Chain,
+ Client,
+ DeployContractParameters,
+ EncodeDeployDataParameters,
+ Hash,
+ Transport
+} from "viem"
+import { getAction } from "viem/utils"
+import type { SmartAccount } from "../../accounts/types"
+import type { Prettify } from "../../types/"
+im... | Why can't we use the existing actions? |
permissionless.js | github_2023 | typescript | 214 | pimlicolabs | plusminushalf | @@ -0,0 +1,479 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type Hex,
+ type LocalAccount,
+ type Transport,
+ type TypedData,
+ type TypedDataDefinition,
+ concatHex,
+ encodeAbiParameters,
+ encodeFunctionData,
+ toHex,
+ zeroAddress
+} from "viem"
+import {
+ ... | Make this to `entryPoint extends ENTRYPOINT_ADDRESS_V07_TYPE` so that users are aware of the type of entryPoint they can pass. |
permissionless.js | github_2023 | typescript | 214 | pimlicolabs | plusminushalf | @@ -0,0 +1,479 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type Hex,
+ type LocalAccount,
+ type Transport,
+ type TypedData,
+ type TypedDataDefinition,
+ concatHex,
+ encodeAbiParameters,
+ encodeFunctionData,
+ toHex,
+ zeroAddress
+} from "viem"
+import {
+ ... | `undefined` is not needed. |
permissionless.js | github_2023 | typescript | 214 | pimlicolabs | plusminushalf | @@ -0,0 +1,479 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type Hex,
+ type LocalAccount,
+ type Transport,
+ type TypedData,
+ type TypedDataDefinition,
+ concatHex,
+ encodeAbiParameters,
+ encodeFunctionData,
+ toHex,
+ zeroAddress
+} from "viem"
+import {
+ ... | We can check if client already have a chain by `client.chain?.id ?? getChainId(client)` |
permissionless.js | github_2023 | typescript | 214 | pimlicolabs | plusminushalf | @@ -0,0 +1,479 @@
+import {
+ type Address,
+ type Chain,
+ type Client,
+ type Hex,
+ type LocalAccount,
+ type Transport,
+ type TypedData,
+ type TypedDataDefinition,
+ concatHex,
+ encodeAbiParameters,
+ encodeFunctionData,
+ toHex,
+ zeroAddress
+} from "viem"
+import {
+ ... | Can we check if the chainId is supported or not, as addresses can be undefined. in safe we also have similar implementation but we don't check because we have a type check on all the types of versions that can be passed. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.