From 7f976fbf8878641346586a0705e8d77945b2ee44 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Fri, 21 Jun 2024 17:23:56 +0200 Subject: [PATCH 1/2] Fixed and More Consistent Pragmas This PR changes the pragmas in the passkeys contract to be: 1. More consistent: we use `^0.8.20` everywhere for "non-top-level" contracts. The version was chosen as this it the first version that supports all of the compiler features that we make use of. Notably, we have `@custom:` NatSpec items which are only officially supported as of v0.8.20. The choice to use floating pragmas here is to make using these support contracts easier across other projects (namely, the `WebAuthn` and `P256` libraries are useful outside of this project). 2. Use fixed pragmas for "top-level" contracts that we deploy: - `SafeWebAuthnProxyFactory` - `SafeWebAuthnSharedSigner` - `FCLP256Verifier` I am aware that Solidity v0.8.20 doesn't play nice with chains like BNB by default, however this can be worked around by explicitly by setting the EVM version target (as we do in this project) and do not believe this is an issue. --- modules/passkey/contracts/4337/SafeWebAuthnSharedSigner.sol | 2 +- modules/passkey/contracts/SafeWebAuthnSignerFactory.sol | 2 +- modules/passkey/contracts/SafeWebAuthnSignerProxy.sol | 2 +- modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol | 2 +- modules/passkey/contracts/base/SignatureValidator.sol | 2 +- modules/passkey/contracts/interfaces/IP256Verifier.sol | 2 +- modules/passkey/contracts/interfaces/ISafe.sol | 2 +- modules/passkey/contracts/interfaces/ISafeSignerFactory.sol | 2 +- modules/passkey/contracts/libraries/ERC1271.sol | 2 +- modules/passkey/contracts/libraries/P256.sol | 2 +- modules/passkey/contracts/libraries/WebAuthn.sol | 2 +- modules/passkey/contracts/test/Benchmarker.sol | 2 +- modules/passkey/contracts/test/DummyP256Verifier.sol | 2 +- modules/passkey/contracts/test/TestDependencies.sol | 2 +- modules/passkey/contracts/test/TestP256Lib.sol | 2 +- .../passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol | 2 +- modules/passkey/contracts/test/TestWebAuthnLib.sol | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/passkey/contracts/4337/SafeWebAuthnSharedSigner.sol b/modules/passkey/contracts/4337/SafeWebAuthnSharedSigner.sol index 63e4c35c3..088d7782c 100644 --- a/modules/passkey/contracts/4337/SafeWebAuthnSharedSigner.sol +++ b/modules/passkey/contracts/4337/SafeWebAuthnSharedSigner.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0; +pragma solidity 0.8.24; import {SignatureValidator} from "../base/SignatureValidator.sol"; import {ISafe} from "../interfaces/ISafe.sol"; diff --git a/modules/passkey/contracts/SafeWebAuthnSignerFactory.sol b/modules/passkey/contracts/SafeWebAuthnSignerFactory.sol index 26d9f54c0..ecc2c09b9 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerFactory.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0; +pragma solidity 0.8.24; import {ISafeSignerFactory} from "./interfaces/ISafeSignerFactory.sol"; import {SafeWebAuthnSignerProxy} from "./SafeWebAuthnSignerProxy.sol"; diff --git a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol index 82b7d05ad..9a733c096 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: LGPL-3.0-only /* solhint-disable no-complex-fallback */ -pragma solidity >=0.8.0; +pragma solidity ^0.8.20; import {P256} from "./libraries/WebAuthn.sol"; diff --git a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol index 799f5450a..3b35b9656 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0; +pragma solidity ^0.8.20; import {SignatureValidator} from "./base/SignatureValidator.sol"; import {P256, WebAuthn} from "./libraries/WebAuthn.sol"; diff --git a/modules/passkey/contracts/base/SignatureValidator.sol b/modules/passkey/contracts/base/SignatureValidator.sol index 800282b2d..59a3d934f 100644 --- a/modules/passkey/contracts/base/SignatureValidator.sol +++ b/modules/passkey/contracts/base/SignatureValidator.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0; +pragma solidity ^0.8.20; import {ERC1271} from "../libraries/ERC1271.sol"; diff --git a/modules/passkey/contracts/interfaces/IP256Verifier.sol b/modules/passkey/contracts/interfaces/IP256Verifier.sol index 40d22ecc2..9accdd320 100644 --- a/modules/passkey/contracts/interfaces/IP256Verifier.sol +++ b/modules/passkey/contracts/interfaces/IP256Verifier.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: LGPL-3.0-only /* solhint-disable payable-fallback */ -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; /** * @title P-256 Elliptic Curve Verifier. diff --git a/modules/passkey/contracts/interfaces/ISafe.sol b/modules/passkey/contracts/interfaces/ISafe.sol index d34d1d45b..30396667d 100644 --- a/modules/passkey/contracts/interfaces/ISafe.sol +++ b/modules/passkey/contracts/interfaces/ISafe.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0 <0.9.0; +pragma solidity ^0.8.20; /** * @title Safe Smart Account diff --git a/modules/passkey/contracts/interfaces/ISafeSignerFactory.sol b/modules/passkey/contracts/interfaces/ISafeSignerFactory.sol index ce3d85e95..feba3d5f7 100644 --- a/modules/passkey/contracts/interfaces/ISafeSignerFactory.sol +++ b/modules/passkey/contracts/interfaces/ISafeSignerFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0 <0.9.0; +pragma solidity ^0.8.20; import {P256} from "../libraries/P256.sol"; diff --git a/modules/passkey/contracts/libraries/ERC1271.sol b/modules/passkey/contracts/libraries/ERC1271.sol index 25d7fb288..715b78af9 100644 --- a/modules/passkey/contracts/libraries/ERC1271.sol +++ b/modules/passkey/contracts/libraries/ERC1271.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; /** * @title ERC-1271 Magic Values diff --git a/modules/passkey/contracts/libraries/P256.sol b/modules/passkey/contracts/libraries/P256.sol index 0473e6c1e..54694c24d 100644 --- a/modules/passkey/contracts/libraries/P256.sol +++ b/modules/passkey/contracts/libraries/P256.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {IP256Verifier} from "../interfaces/IP256Verifier.sol"; diff --git a/modules/passkey/contracts/libraries/WebAuthn.sol b/modules/passkey/contracts/libraries/WebAuthn.sol index a4b2d0044..38129d34a 100644 --- a/modules/passkey/contracts/libraries/WebAuthn.sol +++ b/modules/passkey/contracts/libraries/WebAuthn.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {P256} from "./P256.sol"; diff --git a/modules/passkey/contracts/test/Benchmarker.sol b/modules/passkey/contracts/test/Benchmarker.sol index 15c504547..e6bca53d8 100644 --- a/modules/passkey/contracts/test/Benchmarker.sol +++ b/modules/passkey/contracts/test/Benchmarker.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; contract Benchmarker { function call(address to, bytes memory data) external returns (uint256 gas, bytes memory returnData) { diff --git a/modules/passkey/contracts/test/DummyP256Verifier.sol b/modules/passkey/contracts/test/DummyP256Verifier.sol index ef66fae13..e3903e748 100644 --- a/modules/passkey/contracts/test/DummyP256Verifier.sol +++ b/modules/passkey/contracts/test/DummyP256Verifier.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only /* solhint-disable no-complex-fallback */ /* solhint-disable payable-fallback */ -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {IP256Verifier} from "../interfaces/IP256Verifier.sol"; diff --git a/modules/passkey/contracts/test/TestDependencies.sol b/modules/passkey/contracts/test/TestDependencies.sol index fcfd8ed63..0fc77223d 100644 --- a/modules/passkey/contracts/test/TestDependencies.sol +++ b/modules/passkey/contracts/test/TestDependencies.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: LGPL-3.0-only /* solhint-disable no-global-import */ -pragma solidity >=0.8.0; +pragma solidity ^0.8.20; import "@account-abstraction/contracts/interfaces/IEntryPoint.sol"; import "@account-abstraction/contracts/samples/VerifyingPaymaster.sol"; diff --git a/modules/passkey/contracts/test/TestP256Lib.sol b/modules/passkey/contracts/test/TestP256Lib.sol index 10875c743..8691b91c4 100644 --- a/modules/passkey/contracts/test/TestP256Lib.sol +++ b/modules/passkey/contracts/test/TestP256Lib.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {IP256Verifier, P256} from "../libraries/P256.sol"; diff --git a/modules/passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol b/modules/passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol index 6af005bf2..08add9e14 100644 --- a/modules/passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol +++ b/modules/passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {SafeWebAuthnSharedSigner} from "../4337/SafeWebAuthnSharedSigner.sol"; diff --git a/modules/passkey/contracts/test/TestWebAuthnLib.sol b/modules/passkey/contracts/test/TestWebAuthnLib.sol index 8f0ca573c..0d572941f 100644 --- a/modules/passkey/contracts/test/TestWebAuthnLib.sol +++ b/modules/passkey/contracts/test/TestWebAuthnLib.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; +pragma solidity ^0.8.20; import {P256, WebAuthn} from "../libraries/WebAuthn.sol"; From e6d893eec3376263a73ade1593d2c60e217335dd Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Fri, 5 Jul 2024 11:32:17 +0200 Subject: [PATCH 2/2] merge with 0.8.26 change --- modules/passkey/README.md | 2 +- modules/passkey/contracts/libraries/P256.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/passkey/README.md b/modules/passkey/README.md index 3cbbdcdc7..5babdc7f9 100644 --- a/modules/passkey/README.md +++ b/modules/passkey/README.md @@ -102,7 +102,7 @@ npx hardhat --network $NETWORK verify $SAFE_WEBAUTHN_SIGNER_SINGLETON_ADDRESS -- ### Compiler settings -The project uses Solidity compiler version `0.8.24` with 10 million optimizer runs, as we want to optimize for the code execution costs. The EVM version is set to `paris` because not all our target networks support the opcodes introduced in the `Shanghai` EVM upgrade. +The project uses Solidity compiler version `0.8.26` with 10 million optimizer runs, as we want to optimize for the code execution costs. The EVM version is set to `paris` because not all our target networks support the opcodes introduced in the `Shanghai` EVM upgrade. #### Custom Networks diff --git a/modules/passkey/contracts/libraries/P256.sol b/modules/passkey/contracts/libraries/P256.sol index 54694c24d..882cb1e6b 100644 --- a/modules/passkey/contracts/libraries/P256.sol +++ b/modules/passkey/contracts/libraries/P256.sol @@ -116,7 +116,7 @@ library P256 { mstore(add(input, 128), y) // Perform staticcall and check result, note that Yul evaluates expressions from right - // to left. See . + // to left. See . mstore(0, 0) success := and( and(