Skip to content

Commit

Permalink
feat: 7702
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Sep 10, 2024
1 parent 9d7417a commit fba7141
Show file tree
Hide file tree
Showing 8 changed files with 3,315 additions and 2,583 deletions.
5,824 changes: 3,259 additions & 2,565 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/localDeployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},
"dependencies": {
"@types/node": "^18.16.3",
"viem": "^2.9.5"
"viem": "^2.21.4"
}
}
55 changes: 42 additions & 13 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
type Transport,
type WalletClient
} from "viem"
import { Authorization } from "viem/experimental"
import {
createCompressedCalldata,
filterOpsAndEstimateGas,
Expand Down Expand Up @@ -931,25 +932,43 @@ export class Executor {

let transactionHash: HexData32
try {
const gasOptions = this.legacyTransactions
? {
gasPrice: gasPriceParameters.maxFeePerGas
}
: {
maxFeePerGas: gasPriceParameters.maxFeePerGas,
maxPriorityFeePerGas:
gasPriceParameters.maxPriorityFeePerGas
}

const compressedOpsToBundle = opsToBundle.map(
({ mempoolUserOperation }) => {
const compressedOp = mempoolUserOperation
return compressedOp as CompressedUserOperation
}
)

let authorizationList: Authorization[] | undefined = undefined
for (const compressedOp of compressedOpsToBundle) {
if ("authorizationList" in compressedOp.inflatedOp) {
const opAuthorizationList = compressedOp.inflatedOp.authorizationList
if (opAuthorizationList) {
if (authorizationList !== undefined) {
authorizationList.push(...opAuthorizationList)
} else {
authorizationList = opAuthorizationList
}
}
}
}

if (authorizationList && this.legacyTransactions) {
throw new Error("AuthorizationList is not supported for legacy transactions")
}
const newGasOptions = {
maxFeePerGas: gasPriceParameters.maxFeePerGas,
maxPriorityFeePerGas:
gasPriceParameters.maxPriorityFeePerGas
}
const gasOptions = this.legacyTransactions
? {
gasPrice: gasPriceParameters.maxFeePerGas
}
: newGasOptions

// need to use sendTransaction to target BundleBulker's fallback
transactionHash = await this.walletClient.sendTransaction({
const params = {
account: wallet,
to: compressionHandler.bundleBulkerAddress,
data: createCompressedCalldata(
Expand All @@ -958,8 +977,18 @@ export class Executor {
),
gas: gasLimit,
nonce: nonce,
...gasOptions
})
}
const sendTransactionParams = authorizationList
? {
...params,
...newGasOptions,
authorizationList
}
: {
...params,
...gasOptions
}
transactionHash = await this.walletClient.sendTransaction(sendTransactionParams)

opsToBundle.map(({ userOperationHash }) => {
this.eventManager.emitSubmitted(
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"pino-http": "^8.4.0",
"pino-pretty": "^10.0.0",
"prom-client": "^14.2.0",
"viem": "^2.9.5",
"viem": "^2.21.4",
"yargs": "^17.7.1",
"zod": "^3.21.4",
"zod-validation-error": "^1.3.0"
Expand Down
9 changes: 9 additions & 0 deletions src/types/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ const userOperationV07Schema = z
.nullable()
.optional()
.transform((val) => val ?? null),
authorizationList: z.array(z.object({
contractAddress: addressSchema,
chainId: z.number(),
nonce: z.number(),
yParity: z.number(),
r: hexDataSchema,
s: hexDataSchema,
}))
.optional(),
signature: hexDataSchema
})
.strict()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/deploy-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"start": "wait-port anvil:8545 && ts-node index.ts"
},
"dependencies": {
"viem": "^2.9.5",
"viem": "^2.21.4",
"wait-port": "^1.1.0",
"ts-node": "^10.9.2"
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@pimlico/alto": "workspace:./src/",
"permissionless": "^0.1.25",
"ts-node": "^10.9.2",
"viem": "^2.9.5",
"viem": "^2.21.4",
"vitest": "^1.6.0",
"wait-port": "^1.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion test/kinto-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"kinto-e2e": "link:",
"permissionless": "0.0.36",
"ts-node": "^10.9.2",
"viem": "^2.0.0",
"viem": "^2.21.4",
"wait-port": "^1.1.0"
}
}

0 comments on commit fba7141

Please sign in to comment.