Skip to content

Commit

Permalink
WIP: Add 'BigNonce' field support
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Aug 16, 2024
1 parent d28f475 commit 03b140e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/bundler/src/runBundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { bundlerConfigDefault } from './BundlerConfig'
import { parseEther } from 'ethers/lib/utils'
import { MethodHandlerRIP7560 } from './MethodHandlerRIP7560'
import { JsonRpcProvider } from '@ethersproject/providers'
import { deployNonceManager } from '@account-abstraction/utils/dist/src/RIP7712NonceManagerUtils'

// this is done so that console.log outputs BigNumber as hex string instead of unreadable object
export const inspectCustomSymbol = Symbol.for('nodejs.util.inspect.custom')
Expand Down Expand Up @@ -134,6 +135,10 @@ export async function runBundler (argv: string[], overrideExit = true): Promise<
process.exit(1)
}

if (config.rip7560) {
await deployNonceManager(provider, wallet as any)
}

const {
entryPoint
} = await connectContracts(wallet, !config.rip7560)
Expand Down
1 change: 1 addition & 0 deletions packages/bundler/test/RIP7560Mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe.skip('RIP7560Mode', function () {
operationRIP7560 = {
accessList: undefined,
nonce: '0x0',
bigNonce: '0x0',
sender: '0x0000000000000000000000000000000000000000',
callGasLimit: '0x0',
maxFeePerGas: '0x0',
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/src/RIP7560Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ function rlpEncodeRip7560Tx (op: OperationRIP7560, forSignature = true): string
input.push(bigNumberishToUnpaddedBuffer(op.verificationGasLimit))
input.push(bigNumberishToUnpaddedBuffer(op.paymasterVerificationGasLimit ?? 0))
input.push(bigNumberishToUnpaddedBuffer(op.paymasterPostOpGasLimit ?? 0))
input.push(bigNumberishToUnpaddedBuffer(op.bigNonce))
input.push(nonZeroAddr(undefined)) // to
input.push(bigNumberishToUnpaddedBuffer(op.nonce))
// input.push(bigNumberishToUnpaddedBuffer(op.nonce))
input.push(bigNumberishToUnpaddedBuffer(0)) // value
let rlpEncoded: any = encode(input)
rlpEncoded = Buffer.from([4, ...rlpEncoded])
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/interfaces/OperationRIP7560.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export interface OperationRIP7560 extends OperationBase {
accessList: any
value: BigNumberish
builderFee: BigNumberish
bigNonce: BigNumberish
}
1 change: 1 addition & 0 deletions packages/validation-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function supportsDebugTraceCall (provider: JsonRpcProvider, rip7560
value: '0x0',
sender: AddressZero,
nonce: '0x0',
bigNonce: '0x0',
callData: '0x',
callGasLimit: '0x0',
verificationGasLimit: '0x10000',
Expand Down

0 comments on commit 03b140e

Please sign in to comment.