Skip to content

Commit 5619884

Browse files
committed
feat(rundler): update support for rundler to work with 0.3
1 parent 430c36d commit 5619884

File tree

3 files changed

+95
-42
lines changed

3 files changed

+95
-42
lines changed

src/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ See [`AltoParameters`](https://github.com/wevm/prool/blob/801ede06ded8b2cb2d59c9
153153
#### Requirements
154154

155155
- [Rundler](https://github.com/alchemyplatform/rundler) binary installed
156-
- [Download](https://github.com/alchemyplatform/rundler/releases)
156+
- [Download v0.3.x](https://github.com/alchemyplatform/rundler/releases/tag/v0.3.0)
157+
- Add to `PATH`
157158

158159
#### Usage
159160

@@ -187,7 +188,7 @@ await bundlerServer.start()
187188

188189
#### Parameters
189190

190-
See [RundlerParameters]().
191+
See [RundlerParameters](https://github.com/wevm/prool/blob/main/src/instances/rundler.ts#L7).
191192

192193
### Silius (Bundler Node)
193194

src/instances/rundler.ts

Lines changed: 89 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ export type RundlerParameters = {
1212
*/
1313
binary?: string
1414

15-
/**
16-
* The version of the entrypoint to use
17-
*
18-
* @default 0.6.0
19-
*/
20-
entryPointVersion?: '0.6.0' | '0.7.0'
21-
2215
/**
2316
* Network to look up a hardcoded chain spec.
2417
* @default dev
@@ -30,6 +23,13 @@ export type RundlerParameters = {
3023
*/
3124
chainSpec?: string
3225

26+
/**
27+
* Allows overriding the chain id for a given chain spec
28+
*
29+
* @default unset
30+
*/
31+
chainId?: number | undefined
32+
3333
/**
3434
* EVM Node HTTP URL to use.
3535
*
@@ -90,7 +90,10 @@ export type RundlerParameters = {
9090
* Possible values are base_fee_percent and priority_fee_increase_percent.
9191
* @default priority_fee_increase_percent
9292
*/
93-
priorityFeeModeKind?: 'base_fee_percent' | 'priority_fee_increase_percent'
93+
priorityFeeModeKind?:
94+
| 'base_fee_percent'
95+
| 'priority_fee_increase_percent'
96+
| undefined
9497

9598
/**
9699
* Priority fee mode value.
@@ -129,6 +132,31 @@ export type RundlerParameters = {
129132
*/
130133
mempoolConfigPath?: string
131134

135+
/**
136+
* Disables entry point version v0.6.
137+
* @default false
138+
*/
139+
disableEntryPointV0_6?: boolean
140+
141+
/**
142+
* The number of builder accounts to use for entry point version v0.6.
143+
*
144+
* @default 1
145+
*/
146+
numBuildersV0_6?: number
147+
148+
/**
149+
* Disables entry point version v0.7.
150+
* @default false
151+
*/
152+
disableEntryPointV0_7?: boolean
153+
154+
/**
155+
* The number of builder accounts to use for entry point version v0.7.
156+
* @default 1
157+
*/
158+
numBuildersV0_7?: number
159+
132160
metrics?: {
133161
/**
134162
* Port to listen on for metrics requests.
@@ -261,18 +289,20 @@ export type RundlerParameters = {
261289

262290
builder?: {
263291
/**
264-
* Private key to use for signing transactions.
292+
* Private keys to use for signing transactions.
265293
* If used with awsKmsKeyIds, then explicitly pass in `null` here.
266294
*
267-
* @default 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
295+
* @default ['0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80','0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d']
268296
*/
269-
privateKey?: string
297+
privateKeys?: string[]
270298

271299
/**
272-
* AWS KMS key IDs to use for signing transactions (comma-separated).
273-
* Only required if privateKey is not provided.
300+
* AWS KMS key IDs to use for signing transactions.
301+
* Only required if privateKeys is not provided.
302+
*
303+
* @default null
274304
*/
275-
awsKmsKeyIds?: string
305+
awsKmsKeyIds?: string[]
276306

277307
/**
278308
* Redis URI to use for KMS leasing.
@@ -304,9 +334,21 @@ export type RundlerParameters = {
304334
/**
305335
* Choice of what sender type to use for transaction submission.
306336
* @default raw
307-
* options: raw, conditional, flashbots, polygon_bloxroute
337+
* options: raw, flashbots, polygon_bloxroute
338+
*/
339+
sender?: 'raw' | 'flashbots' | 'polygonBloxroute' | undefined
340+
341+
/**
342+
* Use the submit URL for transaction status checks.
343+
* @default false
344+
*/
345+
useSubmitForStatus?: boolean | undefined
346+
347+
/**
348+
* If the sender supports the 'dropped' status. Many senders do not support this status, and only support 'pending' or 'mined'.
349+
* @default false
308350
*/
309-
sender?: 'raw' | 'conditional' | 'flashbots' | 'polygonBloxroute'
351+
droppedStatusUnsupported?: boolean | undefined
310352

311353
/**
312354
* After submitting a bundle transaction, the maximum number of blocks to wait for that transaction to mine before trying to resend with higher gas fees.
@@ -321,11 +363,16 @@ export type RundlerParameters = {
321363
replacementFeePercentIncrease?: number
322364

323365
/**
324-
* Maximum number of fee increases to attempt.
325-
* Seven increases of 10% is roughly 2x the initial fees.
326-
* @default 7
366+
* Maximum number of fee increases to attempt during a cancellation.
367+
* @default 15
327368
*/
328-
maxFeeIncreases?: number
369+
maxCancellationFeeIncreases?: number | undefined
370+
371+
/**
372+
* The maximum number of blocks to spend in a replacement underpriced state before issuing a transaction cancellation.
373+
* @default 20
374+
*/
375+
maxReplacementUnderpricedBlocks?: number | undefined
329376

330377
/**
331378
* Additional builders to send bundles to through the Flashbots relay RPC (comma-separated).
@@ -353,6 +400,13 @@ export type RundlerParameters = {
353400
*/
354401
indexOffset?: number
355402
}
403+
404+
/**
405+
* Log level for the Rundler binary.
406+
*
407+
* @default "debug"
408+
*/
409+
logLevel?: 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'off' | undefined
356410
}
357411

358412
/**
@@ -370,8 +424,12 @@ export type RundlerParameters = {
370424
* ```
371425
*/
372426
export const rundler = defineInstance((parameters?: RundlerParameters) => {
373-
const { binary = 'rundler', ...args } = (parameters ??
374-
{}) as RundlerParameters
427+
const {
428+
binary = 'rundler',
429+
logLevel = 'debug',
430+
chainId,
431+
...args
432+
} = (parameters ?? {}) as RundlerParameters
375433

376434
const host = '127.0.0.1'
377435
const name = 'rundler'
@@ -392,11 +450,11 @@ export const rundler = defineInstance((parameters?: RundlerParameters) => {
392450
...args,
393451
builder: {
394452
...args.builder,
395-
privateKey:
396-
args.builder?.privateKey ??
453+
privateKeys: args.builder?.privateKeys ?? [
397454
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
455+
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d',
456+
],
398457
},
399-
entryPointVersion: undefined,
400458
maxVerificationGas: args.maxVerificationGas ?? 10000000,
401459
network: args.network ?? 'dev',
402460
nodeHttp: args.nodeHttp ?? 'http://localhost:8545',
@@ -413,23 +471,15 @@ export const rundler = defineInstance((parameters?: RundlerParameters) => {
413471
args.userOperationEventBlockDistance ?? 100,
414472
} satisfies RundlerParameters
415473

416-
const entrypointArgs = (() => {
417-
if (args.entryPointVersion === '0.6.0')
418-
return ['--disable_entry_point_v0_7']
419-
return ['--disable_entry_point_v0_6']
420-
})()
421-
422474
return await process.start(
423475
($) =>
424-
$(
425-
binary,
426-
['node', ...toArgs(args_, { casing: 'snake' }), ...entrypointArgs],
427-
{
428-
env: {
429-
RUST_LOG: 'debug',
430-
},
476+
$(binary, ['node', ...toArgs(args_, { casing: 'snake' })], {
477+
env: {
478+
RUST_LOG: logLevel,
479+
// CHAIN_* overrides for a chain spec can only be set via env vars
480+
...(chainId != null ? { CHAIN_ID: chainId.toString() } : {}),
431481
},
432-
),
482+
}),
433483
{
434484
...options,
435485
resolver({ process, reject, resolve }) {

test/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ export const rundlerOptions = ({ port }: { port: number }) =>
1313
({
1414
nodeHttp: `http://localhost:${port}`,
1515
builder: {
16-
privateKey:
16+
privateKeys: [
1717
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
18+
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d',
19+
],
1820
},
1921
}) as const
2022

0 commit comments

Comments
 (0)