Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rundler): add support for Rundler v0.3.0 #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ See [`AltoParameters`](https://github.com/wevm/prool/blob/801ede06ded8b2cb2d59c9
#### Requirements

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

#### Usage

Expand Down
99 changes: 63 additions & 36 deletions src/instances/rundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ export type RundlerParameters = {
*/
binary?: string

/**
* The version of the entrypoint to use
*
* @default 0.6.0
*/
entryPointVersion?: '0.6.0' | '0.7.0'

/**
* Network to look up a hardcoded chain spec.
* @default dev
Expand Down Expand Up @@ -129,6 +122,31 @@ export type RundlerParameters = {
*/
mempoolConfigPath?: string

/**
* Disables entry point version v0.6.
* @default false
*/
disableEntryPointV0_6?: boolean

/**
* The number of builder accounts to use for entry point version v0.6.
*
* @default 1
*/
numBuildersV0_6?: number

/**
* Disables entry point version v0.7.
* @default false
*/
disableEntryPointV0_7?: boolean

/**
* The number of builder accounts to use for entry point version v0.7.
* @default 1
*/
numBuildersV0_7?: number

metrics?: {
/**
* Port to listen on for metrics requests.
Expand Down Expand Up @@ -261,18 +279,20 @@ export type RundlerParameters = {

builder?: {
/**
* Private key to use for signing transactions.
* Private keys to use for signing transactions.
* If used with awsKmsKeyIds, then explicitly pass in `null` here.
*
* @default 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
* @default ['0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80','0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d']
*/
privateKey?: string
privateKeys?: string[]

/**
* AWS KMS key IDs to use for signing transactions (comma-separated).
* Only required if privateKey is not provided.
* AWS KMS key IDs to use for signing transactions.
* Only required if privateKeys is not provided.
*
* @default null
*/
awsKmsKeyIds?: string
awsKmsKeyIds?: string[]

/**
* Redis URI to use for KMS leasing.
Expand Down Expand Up @@ -304,9 +324,21 @@ export type RundlerParameters = {
/**
* Choice of what sender type to use for transaction submission.
* @default raw
* options: raw, conditional, flashbots, polygon_bloxroute
* options: raw, flashbots, polygon_bloxroute
*/
sender?: 'raw' | 'flashbots' | 'polygonBloxroute'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sender?: 'raw' | 'flashbots' | 'polygonBloxroute'
sender?: 'raw' | 'flashbots' | 'polygonBloxroute' | undefined


/**
* Use the submit URL for transaction status checks.
* @default false
*/
use_submit_for_status?: boolean
Copy link
Member

@jxom jxom Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use_submit_for_status?: boolean
useSubmitForStatus?: boolean | undefined

These should automatically be converted to snake_case at runtime.


/**
* If the sender supports the 'dropped' status. Many senders do not support this status, and only support 'pending' or 'mined'.
* @default false
*/
sender?: 'raw' | 'conditional' | 'flashbots' | 'polygonBloxroute'
dropped_status_unsupported?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dropped_status_unsupported?: boolean
droppedStatusUnsupported?: boolean | undefined


/**
* 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.
Expand All @@ -321,11 +353,16 @@ export type RundlerParameters = {
replacementFeePercentIncrease?: number

/**
* Maximum number of fee increases to attempt.
* Seven increases of 10% is roughly 2x the initial fees.
* @default 7
* Maximum number of fee increases to attempt during a cancellation.
* @default 15
*/
maxFeeIncreases?: number
maxCancellationFeeIncreases?: number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maxCancellationFeeIncreases?: number
maxCancellationFeeIncreases?: number | undefined


/**
* The maximum number of blocks to spend in a replacement underpriced state before issuing a transaction cancellation.
* @default 20
*/
maxReplacementUnderpricedBlocks?: number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maxReplacementUnderpricedBlocks?: number
maxReplacementUnderpricedBlocks?: number | undefined


/**
* Additional builders to send bundles to through the Flashbots relay RPC (comma-separated).
Expand Down Expand Up @@ -392,11 +429,11 @@ export const rundler = defineInstance((parameters?: RundlerParameters) => {
...args,
builder: {
...args.builder,
privateKey:
args.builder?.privateKey ??
privateKeys: args.builder?.privateKeys ?? [
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d',
],
},
entryPointVersion: undefined,
maxVerificationGas: args.maxVerificationGas ?? 10000000,
network: args.network ?? 'dev',
nodeHttp: args.nodeHttp ?? 'http://localhost:8545',
Expand All @@ -413,23 +450,13 @@ export const rundler = defineInstance((parameters?: RundlerParameters) => {
args.userOperationEventBlockDistance ?? 100,
} satisfies RundlerParameters

const entrypointArgs = (() => {
if (args.entryPointVersion === '0.6.0')
return ['--disable_entry_point_v0_7']
return ['--disable_entry_point_v0_6']
})()

return await process.start(
($) =>
$(
binary,
['node', ...toArgs(args_, { casing: 'snake' }), ...entrypointArgs],
{
env: {
RUST_LOG: 'debug',
},
$(binary, ['node', ...toArgs(args_, { casing: 'snake' })], {
env: {
RUST_LOG: 'debug',
},
),
}),
{
...options,
resolver({ process, reject, resolve }) {
Expand Down