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

[4337] Some tests do not actually test what they claim to test #263

Open
mmv08 opened this issue Feb 13, 2024 · 0 comments
Open

[4337] Some tests do not actually test what they claim to test #263

mmv08 opened this issue Feb 13, 2024 · 0 comments

Comments

@mmv08
Copy link
Member

mmv08 commented Feb 13, 2024

Description

Some tests like

it('should execute contract calls without a prefund required', async () => {
const { user1, safe, validator, entryPoint, relayer } = await setupTests()
await entryPoint.depositTo(await safe.getAddress(), { value: ethers.parseEther('1.0') })
await user1.sendTransaction({ to: await safe.getAddress(), value: ethers.parseEther('0.5') })
const safeOp = buildSafeUserOpTransaction(
await safe.getAddress(),
user1.address,
ethers.parseEther('0.5'),
'0x',
'0',
await entryPoint.getAddress(),
false,
false,
)
const safeOpHash = calculateSafeOperationHash(await validator.getAddress(), safeOp, await chainId())
const signature = buildSignatureBytes([await signHash(user1, safeOpHash)])
const userOp = buildUserOperationFromSafeUserOperation({ safeOp, signature })
await logGas('Execute UserOp without a prefund payment', entryPoint.handleOps([userOp], relayer))
expect(await ethers.provider.getBalance(await safe.getAddress())).to.be.eq(ethers.parseEther('0'))
})
do not test what the test description says. This test should test if the module can execute contract calls while the operation it tests is a native token transfer. Theoretically, I might be able to hardcode the call data passed to execTransactiomFromModule, and the test would still pass.

Proposed solution

There are multiple solutions to this, and the implementer should evaluate them:

  1. See if we have enough coverage for the problem I outlined through other tests, and if that's true, adjust the test description
  2. Alternatively, implement additional tests and adjust the test description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant