Skip to content

Commit

Permalink
Move 'DebugBundlerConfigShape' to appropriate location
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Oct 20, 2024
1 parent adf7d7c commit 51b02ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
14 changes: 14 additions & 0 deletions packages/bundler/src/BundlerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ export const BundlerConfigShape = {
estimationPaymasterDataSize: ow.optional.number
}

/**
* Only parameters in this object can be provided by a 'debug_bundler_setConfiguration' API.
*/
export const DebugBundlerConfigShape = {
fixedGasOverhead: ow.optional.number,
perUserOpGasOverhead: ow.optional.number,
perUserOpWordGasOverhead: ow.optional.number,
zeroByteGasCost: ow.optional.number,
nonZeroByteGasCost: ow.optional.number,
expectedBundleSize: ow.optional.number,
estimationSignatureSize: ow.optional.number,
estimationPaymasterDataSize: ow.optional.number
}

// TODO: consider if we want any default fields at all
// TODO: implement merging config (args -> config.js -> default) and runtime shape validation
export const bundlerConfigDefault: Partial<BundlerConfig> = {
Expand Down
20 changes: 3 additions & 17 deletions packages/bundler/src/DebugMethodHandler.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import ow from 'ow'

import { StakeInfo } from '@account-abstraction/utils'
import { PreVerificationGasCalculator } from '@account-abstraction/sdk'

import { BundlerConfig } from './BundlerConfig'
import { BundlerConfig, DebugBundlerConfigShape } from './BundlerConfig'
import { EventsManager } from './modules/EventsManager'
import { ExecutionManager } from './modules/ExecutionManager'
import { MempoolManager } from './modules/MempoolManager'
import { ReputationDump, ReputationManager } from './modules/ReputationManager'
import { SendBundleReturn } from './modules/BundleManager'
import { PreVerificationGasCalculator } from '@account-abstraction/sdk'

/**
* Only parameters in this object can be provided by a 'debug_bundler_setConfiguration' API.
*/
export const BundlerConfigShape = {
fixedGasOverhead: ow.optional.number,
perUserOpGasOverhead: ow.optional.number,
perUserOpWordGasOverhead: ow.optional.number,
zeroByteGasCost: ow.optional.number,
nonZeroByteGasCost: ow.optional.number,
expectedBundleSize: ow.optional.number,
estimationSignatureSize: ow.optional.number,
estimationPaymasterDataSize: ow.optional.number
}

export class DebugMethodHandler {
constructor (
Expand Down Expand Up @@ -97,7 +83,7 @@ export class DebugMethodHandler {
}

async _setConfiguration (config: Partial<BundlerConfig>): Promise<PreVerificationGasCalculator> {
ow.object.exactShape(BundlerConfigShape)
ow.object.exactShape(DebugBundlerConfigShape)
return await this.execManager._setConfiguration(config)
}
}

0 comments on commit 51b02ef

Please sign in to comment.