Skip to content

Commit

Permalink
chore: up snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Nov 19, 2024
1 parent 924c054 commit ee9e6d3
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 336 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,26 @@ describe('entryPointVersion: 0.7', async () => {
const [account, account_2, account_3] = await getSmartAccounts_07()

test('default', async () => {
expect(
await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
...fees,
}),
).toMatchInlineSnapshot(`
{
"callGasLimit": 141653n,
"paymasterPostOpGasLimit": 0n,
"paymasterVerificationGasLimit": 0n,
"preVerificationGas": 53438n,
"verificationGasLimit": 259350n,
}
`)
const gas = await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
...fees,
})
expect(gas.callGasLimit).toBeGreaterThanOrEqual(141600n)
expect(gas.verificationGasLimit).toBeGreaterThanOrEqual(237000n)
expect(gas.preVerificationGas).toBeGreaterThanOrEqual(53400n)
expect(gas.paymasterVerificationGasLimit).toBe(0n)
expect(gas.paymasterPostOpGasLimit).toBe(0n)
})

test('args: paymaster (client)', async () => {
Expand All @@ -74,32 +69,28 @@ describe('entryPointVersion: 0.7', async () => {
transport: http(server.url),
})

expect(
await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
paymaster: paymasterClient,
...fees,
}),
).toMatchInlineSnapshot(`
{
"callGasLimit": 141653n,
"paymasterPostOpGasLimit": 1n,
"paymasterVerificationGasLimit": 20150n,
"preVerificationGas": 59826n,
"verificationGasLimit": 237672n,
}
`)
const gas = await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
paymaster: paymasterClient,
...fees,
})

expect(gas.callGasLimit).toBeGreaterThanOrEqual(141600n)
expect(gas.verificationGasLimit).toBeGreaterThanOrEqual(237000n)
expect(gas.preVerificationGas).toBeGreaterThanOrEqual(53400n)
expect(gas.paymasterVerificationGasLimit).toBeGreaterThanOrEqual(20000n)
expect(gas.paymasterPostOpGasLimit).toBe(1n)
})

test('behavior: client.paymaster (client)', async () => {
Expand All @@ -114,31 +105,27 @@ describe('entryPointVersion: 0.7', async () => {
paymaster: paymasterClient,
})

expect(
await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
...fees,
}),
).toMatchInlineSnapshot(`
{
"callGasLimit": 141653n,
"paymasterPostOpGasLimit": 1n,
"paymasterVerificationGasLimit": 20150n,
"preVerificationGas": 59826n,
"verificationGasLimit": 237672n,
}
`)
const gas = await estimateUserOperationGas(bundlerClient, {
account,
calls: [
{
to: '0x0000000000000000000000000000000000000000',
value: parseEther('1'),
},
{
to: wagmiContractConfig.address,
abi: wagmiContractConfig.abi,
functionName: 'mint',
},
],
...fees,
})

expect(gas.callGasLimit).toBeGreaterThanOrEqual(141600n)
expect(gas.verificationGasLimit).toBeGreaterThanOrEqual(237000n)
expect(gas.preVerificationGas).toBeGreaterThanOrEqual(53400n)
expect(gas.paymasterVerificationGasLimit).toBeGreaterThanOrEqual(20000n)
expect(gas.paymasterPostOpGasLimit).toBe(1n)
})

test('behavior: prepared user operation', async () => {
Expand All @@ -158,20 +145,16 @@ describe('entryPointVersion: 0.7', async () => {

expectTypeOf(request).toMatchTypeOf<UserOperation>()

expect(
await estimateUserOperationGas(bundlerClient, {
...request,
entryPointAddress: account.entryPoint?.address,
}),
).toMatchInlineSnapshot(`
{
"callGasLimit": 80000n,
"paymasterPostOpGasLimit": 0n,
"paymasterVerificationGasLimit": 0n,
"preVerificationGas": 51722n,
"verificationGasLimit": 259060n,
}
`)
const gas = await estimateUserOperationGas(bundlerClient, {
...request,
entryPointAddress: account.entryPoint?.address,
})

expect(gas.callGasLimit).toBeGreaterThanOrEqual(80000n)
expect(gas.verificationGasLimit).toBeGreaterThanOrEqual(237000n)
expect(gas.preVerificationGas).toBeGreaterThanOrEqual(51000n)
expect(gas.paymasterVerificationGasLimit).toBe(0n)
expect(gas.paymasterPostOpGasLimit).toBe(0n)
})

test('error: insufficient funds', async () => {
Expand Down
Loading

0 comments on commit ee9e6d3

Please sign in to comment.