Skip to content

Commit

Permalink
Use Slightly More Gas For 4337 Test (#465)
Browse files Browse the repository at this point in the history
Under certain conditions, an E2E test can fail because it uses slightly
more gas. This PR adds a larger gas buffer to the E2E test to prevent
intermittent failures.

Example failure:
https://github.com/safe-global/safe-modules/actions/runs/9990468990/job/27611219692

```
  1) Singleton Signers [@4337]
       should deploy a new Safe with alternate signing scheme accessing associated storage:
     Error: could not coalesce error (error={ "code": -32500, "message": "verificationGas should have extra 2000 gas. has only 353" }, payload={ ... }, code=UNKNOWN_ERROR, version=6.13.1)
```
  • Loading branch information
nlordell authored Jul 18, 2024
1 parent 3f0e7b5 commit 562ccba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/4337/certora/harnesses/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract Account is Safe {
* The canonical format ensures the signatures are tightly packed one after the other in order.
*
* For more details on signature encoding: https://docs.safe.global/advanced/smart-account-signatures
*/
*/
function canonicalSignature(bytes calldata signatures, uint256 safeThreshold) public pure returns (bytes memory canonical) {
uint256 dynamicOffset = safeThreshold * 0x41;
bytes memory staticPart = signatures[:dynamicOffset];
Expand All @@ -75,7 +75,7 @@ contract Account is Safe {
uint256 signatureOffset = uint256(bytes32(signatures[ptr + 0x20:]));

uint256 signatureLength = uint256(bytes32(signatures[signatureOffset:]));
bytes memory signature = signatures[signatureOffset+0x20:][:signatureLength];
bytes memory signature = signatures[signatureOffset + 0x20:][:signatureLength];

// Make sure to update the static part so that the smart contract signature
// points to the "canonical" signature offset (i.e. that all contract
Expand All @@ -91,7 +91,7 @@ contract Account is Safe {
}
}
canonical = abi.encodePacked(staticPart, dynamicPart);
}
}
}

// @notice This is a harness contract for the rule that verfies the validation data
Expand Down
2 changes: 1 addition & 1 deletion modules/4337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
"@account-abstraction/contracts": "0.7.0",
"@safe-global/safe-contracts": "1.4.1-build.0"
}
}
}
5 changes: 4 additions & 1 deletion modules/4337/test/e2e/SingletonSigners.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ describe('Singleton Signers [@4337]', () => {
await entryPoint.getAddress(),
false,
false,
{ initCode },
{
initCode,
verificationGasLimit: 600000,
},
)
const opHash = await validator.getOperationHash(
buildPackedUserOperationFromSafeUserOperation({
Expand Down

0 comments on commit 562ccba

Please sign in to comment.