From 562ccba5fe5417b03aec5f65c19d4748e99b06e1 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Thu, 18 Jul 2024 15:39:47 +0200 Subject: [PATCH] Use Slightly More Gas For 4337 Test (#465) 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) ``` --- modules/4337/certora/harnesses/Account.sol | 6 +++--- modules/4337/package.json | 2 +- modules/4337/test/e2e/SingletonSigners.spec.ts | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/4337/certora/harnesses/Account.sol b/modules/4337/certora/harnesses/Account.sol index d0e95125..509564cc 100644 --- a/modules/4337/certora/harnesses/Account.sol +++ b/modules/4337/certora/harnesses/Account.sol @@ -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]; @@ -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 @@ -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 diff --git a/modules/4337/package.json b/modules/4337/package.json index d3b19c71..1905a6b0 100644 --- a/modules/4337/package.json +++ b/modules/4337/package.json @@ -76,4 +76,4 @@ "@account-abstraction/contracts": "0.7.0", "@safe-global/safe-contracts": "1.4.1-build.0" } -} \ No newline at end of file +} diff --git a/modules/4337/test/e2e/SingletonSigners.spec.ts b/modules/4337/test/e2e/SingletonSigners.spec.ts index 803c2e7d..9c1481bd 100644 --- a/modules/4337/test/e2e/SingletonSigners.spec.ts +++ b/modules/4337/test/e2e/SingletonSigners.spec.ts @@ -107,7 +107,10 @@ describe('Singleton Signers [@4337]', () => { await entryPoint.getAddress(), false, false, - { initCode }, + { + initCode, + verificationGasLimit: 600000, + }, ) const opHash = await validator.getOperationHash( buildPackedUserOperationFromSafeUserOperation({