From 65f7000f99ef25c6c42a3e26fce2081daf558c74 Mon Sep 17 00:00:00 2001 From: Victorien Gauch <85494462+VGau@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:14:12 +0200 Subject: [PATCH] chore(3704): Bump solidity version to 0.8.26 across the repository (#64) * Bump solidity version to 0.8.26 across the repository * Regenerated Verifiers * bump solidity for other merged PRs --------- Co-authored-by: thedarkjester Co-authored-by: The Dark Jester --- contracts/contracts/LineaRollup.sol | 2 +- contracts/contracts/LineaRollupInit.sol | 2 +- contracts/contracts/ZkEvmV2.sol | 2 +- .../contracts/interfaces/IGenericErrors.sol | 2 +- .../contracts/interfaces/IMessageService.sol | 2 +- .../contracts/interfaces/IPauseManager.sol | 2 +- .../interfaces/IPermissionsManager.sol | 2 +- .../contracts/interfaces/IRateLimiter.sol | 2 +- .../interfaces/l1/IL1MessageManager.sol | 2 +- .../interfaces/l1/IL1MessageManagerV1.sol | 2 +- .../interfaces/l1/IL1MessageService.sol | 2 +- .../contracts/interfaces/l1/ILineaRollup.sol | 2 +- .../interfaces/l1/IPlonkVerifier.sol | 2 +- .../contracts/interfaces/l1/IZkEvmV2.sol | 2 +- .../interfaces/tools/IRecoverFunds.sol | 2 +- contracts/contracts/lib/PauseManager.sol | 2 +- .../contracts/lib/PermissionsManager.sol | 2 +- contracts/contracts/lib/Utils.sol | 2 +- .../messageService/MessageServiceBase.sol | 2 +- .../messageService/l1/L1MessageManager.sol | 2 +- .../messageService/l1/L1MessageService.sol | 2 +- ...sientStorageReentrancyGuardUpgradeable.sol | 2 +- .../l1/v1/L1MessageManagerV1.sol | 2 +- .../l1/v1/L1MessageServiceV1.sol | 2 +- .../messageService/lib/MessageHashing.sol | 2 +- .../messageService/lib/RateLimiter.sol | 2 +- .../lib/SparseMerkleTreeVerifier.sol | 2 +- .../contracts/messageService/lib/TimeLock.sol | 2 +- .../lib/TransientStorageHelpers.sol | 2 +- .../IntegrationTestTrueVerifier.sol | 2 +- .../test-contracts/LineaRollupAlphaV3.sol | 40 +++---- .../test-contracts/RevertingVerifier.sol | 2 +- .../test-contracts/TestClaimingCaller.sol | 2 +- .../contracts/test-contracts/TestEIP4844.sol | 2 +- .../test-contracts/TestExternalCalls.sol | 2 +- .../test-contracts/TestL1MessageManager.sol | 2 +- .../test-contracts/TestL1MessageService.sol | 2 +- .../TestL1MessageServiceMerkleProof.sol | 2 +- .../test-contracts/TestL1RevertContract.sol | 2 +- .../test-contracts/TestLineaRollup.sol | 2 +- .../test-contracts/TestMessageServiceBase.sol | 2 +- .../test-contracts/TestPauseManager.sol | 2 +- .../TestPublicInputVerifier.sol | 2 +- .../test-contracts/TestRateLimiter.sol | 2 +- .../test-contracts/TestSetPauseTypeRoles.sol | 2 +- .../TestSparseMerkleTreeVerifier.sol | 2 +- .../contracts/test-contracts/TestUtils.sol | 2 +- .../MessageBridgeV2/MockMessageServiceV2.sol | 2 +- contracts/contracts/tools/RecoverFunds.sol | 2 +- .../contracts/verifiers/PlonkVerifierDev.sol | 2 +- .../PlonkVerifierForDataAggregation.sol | 109 ++++++++++-------- ...onkVerifierForMultiTypeDataAggregation.sol | 2 +- .../TestPlonkVerifierForDataAggregation.sol | 109 ++++++++++-------- contracts/hardhat.config.ts | 30 ++--- contracts/test/TokenMintingRateLimiter.ts | 2 +- .../compression-aggregation/autoupdate.sh | 2 +- .../emulation-dummy/Verifier.sol | 2 +- 57 files changed, 211 insertions(+), 183 deletions(-) diff --git a/contracts/contracts/LineaRollup.sol b/contracts/contracts/LineaRollup.sol index aeb1ef7d..24faeab8 100644 --- a/contracts/contracts/LineaRollup.sol +++ b/contracts/contracts/LineaRollup.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; diff --git a/contracts/contracts/LineaRollupInit.sol b/contracts/contracts/LineaRollupInit.sol index 8856636b..9b75bdd3 100644 --- a/contracts/contracts/LineaRollupInit.sol +++ b/contracts/contracts/LineaRollupInit.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { LineaRollup } from "./LineaRollup.sol"; diff --git a/contracts/contracts/ZkEvmV2.sol b/contracts/contracts/ZkEvmV2.sol index dc76e78c..ab745600 100644 --- a/contracts/contracts/ZkEvmV2.sol +++ b/contracts/contracts/ZkEvmV2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; diff --git a/contracts/contracts/interfaces/IGenericErrors.sol b/contracts/contracts/interfaces/IGenericErrors.sol index ada15917..f53c68f2 100644 --- a/contracts/contracts/interfaces/IGenericErrors.sol +++ b/contracts/contracts/interfaces/IGenericErrors.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring generic errors. diff --git a/contracts/contracts/interfaces/IMessageService.sol b/contracts/contracts/interfaces/IMessageService.sol index 33a55b3f..bc11cd5f 100644 --- a/contracts/contracts/interfaces/IMessageService.sol +++ b/contracts/contracts/interfaces/IMessageService.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring pre-existing cross-chain messaging functions, events and errors. diff --git a/contracts/contracts/interfaces/IPauseManager.sol b/contracts/contracts/interfaces/IPauseManager.sol index 7d019720..05cf7e1f 100644 --- a/contracts/contracts/interfaces/IPauseManager.sol +++ b/contracts/contracts/interfaces/IPauseManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring pre-existing pausing functions, events and errors. diff --git a/contracts/contracts/interfaces/IPermissionsManager.sol b/contracts/contracts/interfaces/IPermissionsManager.sol index 2010caab..d3139b83 100644 --- a/contracts/contracts/interfaces/IPermissionsManager.sol +++ b/contracts/contracts/interfaces/IPermissionsManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring permissions manager related data types. diff --git a/contracts/contracts/interfaces/IRateLimiter.sol b/contracts/contracts/interfaces/IRateLimiter.sol index 6b9b9e5a..c93e57ed 100644 --- a/contracts/contracts/interfaces/IRateLimiter.sol +++ b/contracts/contracts/interfaces/IRateLimiter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring rate limiting messaging functions, events and errors. diff --git a/contracts/contracts/interfaces/l1/IL1MessageManager.sol b/contracts/contracts/interfaces/l1/IL1MessageManager.sol index 03f2acf8..e765f4c5 100644 --- a/contracts/contracts/interfaces/l1/IL1MessageManager.sol +++ b/contracts/contracts/interfaces/l1/IL1MessageManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message manager interface for current functions, events and errors. diff --git a/contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol b/contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol index 86ee0c7d..07d6c1fa 100644 --- a/contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol +++ b/contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message manager V1 interface for pre-existing functions, events and errors. diff --git a/contracts/contracts/interfaces/l1/IL1MessageService.sol b/contracts/contracts/interfaces/l1/IL1MessageService.sol index f9a4ae15..51f695b2 100644 --- a/contracts/contracts/interfaces/l1/IL1MessageService.sol +++ b/contracts/contracts/interfaces/l1/IL1MessageService.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message Service interface for pre-existing functions, events and errors. diff --git a/contracts/contracts/interfaces/l1/ILineaRollup.sol b/contracts/contracts/interfaces/l1/ILineaRollup.sol index e4414418..a18efb84 100644 --- a/contracts/contracts/interfaces/l1/ILineaRollup.sol +++ b/contracts/contracts/interfaces/l1/ILineaRollup.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IPauseManager } from "../../interfaces/IPauseManager.sol"; import { IPermissionsManager } from "../../interfaces/IPermissionsManager.sol"; diff --git a/contracts/contracts/interfaces/l1/IPlonkVerifier.sol b/contracts/contracts/interfaces/l1/IPlonkVerifier.sol index f0ca7a59..39709773 100644 --- a/contracts/contracts/interfaces/l1/IPlonkVerifier.sol +++ b/contracts/contracts/interfaces/l1/IPlonkVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Interface declaring verifier functions. diff --git a/contracts/contracts/interfaces/l1/IZkEvmV2.sol b/contracts/contracts/interfaces/l1/IZkEvmV2.sol index 327a58f0..67e9a12d 100644 --- a/contracts/contracts/interfaces/l1/IZkEvmV2.sol +++ b/contracts/contracts/interfaces/l1/IZkEvmV2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title ZkEvm rollup interface for pre-existing functions, events and errors. diff --git a/contracts/contracts/interfaces/tools/IRecoverFunds.sol b/contracts/contracts/interfaces/tools/IRecoverFunds.sol index 7e00ba33..a0dcfd19 100644 --- a/contracts/contracts/interfaces/tools/IRecoverFunds.sol +++ b/contracts/contracts/interfaces/tools/IRecoverFunds.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Interface declaring IRecoverFunds errors and functions. diff --git a/contracts/contracts/lib/PauseManager.sol b/contracts/contracts/lib/PauseManager.sol index be98875e..8407a0e8 100644 --- a/contracts/contracts/lib/PauseManager.sol +++ b/contracts/contracts/lib/PauseManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; diff --git a/contracts/contracts/lib/PermissionsManager.sol b/contracts/contracts/lib/PermissionsManager.sol index 75f71b90..2636220f 100644 --- a/contracts/contracts/lib/PermissionsManager.sol +++ b/contracts/contracts/lib/PermissionsManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; diff --git a/contracts/contracts/lib/Utils.sol b/contracts/contracts/lib/Utils.sol index e4f63317..f0c6ba2c 100644 --- a/contracts/contracts/lib/Utils.sol +++ b/contracts/contracts/lib/Utils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; library Utils { /** diff --git a/contracts/contracts/messageService/MessageServiceBase.sol b/contracts/contracts/messageService/MessageServiceBase.sol index 3ea90d41..fb3d1bab 100644 --- a/contracts/contracts/messageService/MessageServiceBase.sol +++ b/contracts/contracts/messageService/MessageServiceBase.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { IMessageService } from "../interfaces/IMessageService.sol"; diff --git a/contracts/contracts/messageService/l1/L1MessageManager.sol b/contracts/contracts/messageService/l1/L1MessageManager.sol index b0df0c8e..135fe623 100644 --- a/contracts/contracts/messageService/l1/L1MessageManager.sol +++ b/contracts/contracts/messageService/l1/L1MessageManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { BitMaps } from "@openzeppelin/contracts/utils/structs/BitMaps.sol"; import { L1MessageManagerV1 } from "./v1/L1MessageManagerV1.sol"; diff --git a/contracts/contracts/messageService/l1/L1MessageService.sol b/contracts/contracts/messageService/l1/L1MessageService.sol index 8586815c..1ba73394 100644 --- a/contracts/contracts/messageService/l1/L1MessageService.sol +++ b/contracts/contracts/messageService/l1/L1MessageService.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { L1MessageServiceV1 } from "./v1/L1MessageServiceV1.sol"; diff --git a/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol b/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol index 56a72f84..d635384a 100644 --- a/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol +++ b/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { TransientStorageHelpers } from "../lib/TransientStorageHelpers.sol"; diff --git a/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol b/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol index 8ed2d8ee..f103e2a6 100644 --- a/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol +++ b/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IL1MessageManagerV1 } from "../../../interfaces/l1/IL1MessageManagerV1.sol"; diff --git a/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol b/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol index cf398006..adbd4f0a 100644 --- a/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol +++ b/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { PauseManager } from "../../../lib/PauseManager.sol"; diff --git a/contracts/contracts/messageService/lib/MessageHashing.sol b/contracts/contracts/messageService/lib/MessageHashing.sol index 840b2ebd..25034ba1 100644 --- a/contracts/contracts/messageService/lib/MessageHashing.sol +++ b/contracts/contracts/messageService/lib/MessageHashing.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Library to hash messages. diff --git a/contracts/contracts/messageService/lib/RateLimiter.sol b/contracts/contracts/messageService/lib/RateLimiter.sol index 88a02b97..fd2ec83a 100644 --- a/contracts/contracts/messageService/lib/RateLimiter.sol +++ b/contracts/contracts/messageService/lib/RateLimiter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; diff --git a/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol b/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol index da6984d5..e8bc42b9 100644 --- a/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol +++ b/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Library to verify sparse merkle proofs and to get the leaf hash value diff --git a/contracts/contracts/messageService/lib/TimeLock.sol b/contracts/contracts/messageService/lib/TimeLock.sol index e76168e0..ab2aefe3 100644 --- a/contracts/contracts/messageService/lib/TimeLock.sol +++ b/contracts/contracts/messageService/lib/TimeLock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { TimelockController } from "@openzeppelin/contracts/governance/TimelockController.sol"; diff --git a/contracts/contracts/messageService/lib/TransientStorageHelpers.sol b/contracts/contracts/messageService/lib/TransientStorageHelpers.sol index 46279371..c135480b 100644 --- a/contracts/contracts/messageService/lib/TransientStorageHelpers.sol +++ b/contracts/contracts/messageService/lib/TransientStorageHelpers.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Library that provides helper functions to interact with transient storage. diff --git a/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol b/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol index 21429970..597c55e5 100644 --- a/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol +++ b/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; diff --git a/contracts/contracts/test-contracts/LineaRollupAlphaV3.sol b/contracts/contracts/test-contracts/LineaRollupAlphaV3.sol index 2c9d5ac2..fd9aab5b 100644 --- a/contracts/contracts/test-contracts/LineaRollupAlphaV3.sol +++ b/contracts/contracts/test-contracts/LineaRollupAlphaV3.sol @@ -1440,7 +1440,7 @@ abstract contract ReentrancyGuardUpgradeable is Initializable { // File contracts/interfaces/l1/ILineaRollup.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title LineaRollup interface for current functions, events and errors. @@ -1745,7 +1745,7 @@ interface ILineaRollup { // File contracts/interfaces/IGenericErrors.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring generic errors. @@ -1762,7 +1762,7 @@ interface IGenericErrors { // File contracts/interfaces/l1/IL1MessageService.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message Service interface for pre-existing functions, events and errors. @@ -1873,7 +1873,7 @@ library BitMaps { // File contracts/interfaces/l1/IL1MessageManager.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message manager interface for current functions, events and errors. @@ -1929,7 +1929,7 @@ interface IL1MessageManager { // File contracts/lib/Utils.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; library Utils { /** @@ -1950,7 +1950,7 @@ library Utils { // File contracts/interfaces/l1/IL1MessageManagerV1.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title L1 Message manager V1 interface for pre-existing functions, events and errors. @@ -1991,7 +1991,7 @@ interface IL1MessageManagerV1 { // File contracts/messageService/l1/v1/L1MessageManagerV1.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain message hashes storage and status on L1. @@ -2041,7 +2041,7 @@ abstract contract L1MessageManagerV1 is IL1MessageManagerV1 { // File contracts/messageService/l1/L1MessageManager.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain message rolling hash computation and storage on L1. @@ -2138,7 +2138,7 @@ abstract contract L1MessageManager is L1MessageManagerV1, IL1MessageManager { // File contracts/interfaces/IMessageService.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring pre-existing cross-chain messaging functions, events and errors. @@ -2236,7 +2236,7 @@ interface IMessageService { // File contracts/interfaces/IPauseManager.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring pre-existing pausing functions, events and errors. @@ -2272,7 +2272,7 @@ interface IPauseManager { // File contracts/messageService/lib/PauseManager.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Contract to manage cross-chain function pausing. @@ -2390,7 +2390,7 @@ abstract contract PauseManager is Initializable, IPauseManager, AccessControlUpg // File contracts/interfaces/IRateLimiter.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Interface declaring rate limiting messaging functions, events and errors. @@ -2458,7 +2458,7 @@ interface IRateLimiter { // File contracts/messageService/lib/RateLimiter.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; /** * @title Rate Limiter by period and amount using the block timestamp. @@ -2575,7 +2575,7 @@ contract RateLimiter is Initializable, IRateLimiter, AccessControlUpgradeable { // File contracts/messageService/l1/v1/L1MessageServiceV1.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain messaging on L1. @@ -2710,7 +2710,7 @@ abstract contract L1MessageServiceV1 is // File contracts/messageService/lib/SparseMerkleTreeVerifier.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Library to verify sparse merkle proofs and to get the leaf hash value @@ -2760,7 +2760,7 @@ library SparseMerkleTreeVerifier { // File contracts/messageService/l1/L1MessageService.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain messaging on L1. @@ -2919,7 +2919,7 @@ abstract contract L1MessageService is // File contracts/interfaces/l1/IPlonkVerifier.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Interface declaring verifier functions. @@ -2938,7 +2938,7 @@ interface IPlonkVerifier { // File contracts/interfaces/l1/IZkEvmV2.sol // Original license: SPDX_License_Identifier: Apache-2.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title ZkEvm rollup interface for pre-existing functions, events and errors. @@ -2987,7 +2987,7 @@ interface IZkEvmV2 { // File contracts/ZkEvmV2.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain messaging on L1 and rollup proving. @@ -3049,7 +3049,7 @@ abstract contract ZkEvmV2 is Initializable, AccessControlUpgradeable, L1MessageS // File contracts/LineaRollup.sol // Original license: SPDX_License_Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; /** * @title Contract to manage cross-chain messaging on L1 and rollup proving. diff --git a/contracts/contracts/test-contracts/RevertingVerifier.sol b/contracts/contracts/test-contracts/RevertingVerifier.sol index 5ed22f42..30653630 100644 --- a/contracts/contracts/test-contracts/RevertingVerifier.sol +++ b/contracts/contracts/test-contracts/RevertingVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; diff --git a/contracts/contracts/test-contracts/TestClaimingCaller.sol b/contracts/contracts/test-contracts/TestClaimingCaller.sol index 5c7f0d67..db67b837 100644 --- a/contracts/contracts/test-contracts/TestClaimingCaller.sol +++ b/contracts/contracts/test-contracts/TestClaimingCaller.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IMessageService } from "../interfaces/IMessageService.sol"; diff --git a/contracts/contracts/test-contracts/TestEIP4844.sol b/contracts/contracts/test-contracts/TestEIP4844.sol index 40975fa1..db3397cc 100644 --- a/contracts/contracts/test-contracts/TestEIP4844.sol +++ b/contracts/contracts/test-contracts/TestEIP4844.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract TestEIP4844 { event BlobHashEvent(bytes32 blobHash); diff --git a/contracts/contracts/test-contracts/TestExternalCalls.sol b/contracts/contracts/test-contracts/TestExternalCalls.sol index 137d36ed..57a52b92 100644 --- a/contracts/contracts/test-contracts/TestExternalCalls.sol +++ b/contracts/contracts/test-contracts/TestExternalCalls.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; interface ITestExternalCalls { function revertWithError() external pure; diff --git a/contracts/contracts/test-contracts/TestL1MessageManager.sol b/contracts/contracts/test-contracts/TestL1MessageManager.sol index d308fb8a..9f2e267a 100644 --- a/contracts/contracts/test-contracts/TestL1MessageManager.sol +++ b/contracts/contracts/test-contracts/TestL1MessageManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { L1MessageManager } from "../messageService/l1/L1MessageManager.sol"; diff --git a/contracts/contracts/test-contracts/TestL1MessageService.sol b/contracts/contracts/test-contracts/TestL1MessageService.sol index 50a49873..b4032bc4 100644 --- a/contracts/contracts/test-contracts/TestL1MessageService.sol +++ b/contracts/contracts/test-contracts/TestL1MessageService.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { L1MessageService } from "../messageService/l1/L1MessageService.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; diff --git a/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol b/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol index 94ed4016..456bd01d 100644 --- a/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol +++ b/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { L1MessageService } from "../messageService/l1/L1MessageService.sol"; import { IL1MessageService } from "../interfaces/l1/IL1MessageService.sol"; diff --git a/contracts/contracts/test-contracts/TestL1RevertContract.sol b/contracts/contracts/test-contracts/TestL1RevertContract.sol index 796a0026..e2862a9d 100644 --- a/contracts/contracts/test-contracts/TestL1RevertContract.sol +++ b/contracts/contracts/test-contracts/TestL1RevertContract.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract TestL1RevertContract { function errorWithMessage() external pure { diff --git a/contracts/contracts/test-contracts/TestLineaRollup.sol b/contracts/contracts/test-contracts/TestLineaRollup.sol index 14b2da08..013ca09c 100644 --- a/contracts/contracts/test-contracts/TestLineaRollup.sol +++ b/contracts/contracts/test-contracts/TestLineaRollup.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { LineaRollup } from "../LineaRollup.sol"; diff --git a/contracts/contracts/test-contracts/TestMessageServiceBase.sol b/contracts/contracts/test-contracts/TestMessageServiceBase.sol index 5bfbbf8c..7dc94c8d 100644 --- a/contracts/contracts/test-contracts/TestMessageServiceBase.sol +++ b/contracts/contracts/test-contracts/TestMessageServiceBase.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { MessageServiceBase } from "../messageService/MessageServiceBase.sol"; diff --git a/contracts/contracts/test-contracts/TestPauseManager.sol b/contracts/contracts/test-contracts/TestPauseManager.sol index f5a91eb8..5e7084f1 100644 --- a/contracts/contracts/test-contracts/TestPauseManager.sol +++ b/contracts/contracts/test-contracts/TestPauseManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { PauseManager } from "../lib/PauseManager.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; diff --git a/contracts/contracts/test-contracts/TestPublicInputVerifier.sol b/contracts/contracts/test-contracts/TestPublicInputVerifier.sol index ae0c58fa..c94494ae 100644 --- a/contracts/contracts/test-contracts/TestPublicInputVerifier.sol +++ b/contracts/contracts/test-contracts/TestPublicInputVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; diff --git a/contracts/contracts/test-contracts/TestRateLimiter.sol b/contracts/contracts/test-contracts/TestRateLimiter.sol index eeff0ade..b60cde25 100644 --- a/contracts/contracts/test-contracts/TestRateLimiter.sol +++ b/contracts/contracts/test-contracts/TestRateLimiter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { RateLimiter } from "../messageService/lib/RateLimiter.sol"; diff --git a/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol b/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol index a7499135..cd384c02 100644 --- a/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol +++ b/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { PauseManager } from "../lib/PauseManager.sol"; diff --git a/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol b/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol index 13b844ce..c4675470 100644 --- a/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol +++ b/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { SparseMerkleTreeVerifier } from "../messageService/lib/SparseMerkleTreeVerifier.sol"; diff --git a/contracts/contracts/test-contracts/TestUtils.sol b/contracts/contracts/test-contracts/TestUtils.sol index d3d4dcd7..e21bd044 100644 --- a/contracts/contracts/test-contracts/TestUtils.sol +++ b/contracts/contracts/test-contracts/TestUtils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { Utils } from "../lib/Utils.sol"; diff --git a/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol b/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol index ae85c28a..6ab22ec9 100644 --- a/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol +++ b/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity >=0.8.19 <=0.8.24; +pragma solidity >=0.8.19 <=0.8.26; import { IMessageService } from "../../../interfaces/IMessageService.sol"; import { IGenericErrors } from "../../../interfaces/IGenericErrors.sol"; diff --git a/contracts/contracts/tools/RecoverFunds.sol b/contracts/contracts/tools/RecoverFunds.sol index a925c112..36210aa1 100644 --- a/contracts/contracts/tools/RecoverFunds.sol +++ b/contracts/contracts/tools/RecoverFunds.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity 0.8.24; +pragma solidity 0.8.26; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { IGenericErrors } from "../interfaces/IGenericErrors.sol"; diff --git a/contracts/contracts/verifiers/PlonkVerifierDev.sol b/contracts/contracts/verifiers/PlonkVerifierDev.sol index 82ba2eaf..22bba9ca 100644 --- a/contracts/contracts/verifiers/PlonkVerifierDev.sol +++ b/contracts/contracts/verifiers/PlonkVerifierDev.sol @@ -16,7 +16,7 @@ // Code generated by gnark DO NOT EDIT -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract PlonkVerifierDev { uint256 private constant R_MOD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; diff --git a/contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol b/contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol index b805a530..8670ce2a 100644 --- a/contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol +++ b/contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol @@ -16,7 +16,7 @@ // Code generated by gnark DO NOT EDIT -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract PlonkVerifierForDataAggregation { uint256 private constant R_MOD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; @@ -73,6 +73,9 @@ contract PlonkVerifierForDataAggregation { // ------------------------------------------------ + // size of the proof without call custom gate + uint256 private constant FIXED_PROOF_SIZE = 0x300; + // offset proof uint256 private constant PROOF_L_COM_X = 0x0; @@ -83,14 +86,14 @@ contract PlonkVerifierForDataAggregation { uint256 private constant PROOF_O_COM_Y = 0xa0; // h = h_0 + x^{n+2}h_1 + x^{2(n+2)}h_2 - uint256 private constant PROOF_H_0_X = 0xc0; - uint256 private constant PROOF_H_0_Y = 0xe0; - uint256 private constant PROOF_H_1_X = 0x100; - uint256 private constant PROOF_H_1_Y = 0x120; - uint256 private constant PROOF_H_2_X = 0x140; - uint256 private constant PROOF_H_2_Y = 0x160; + uint256 private constant PROOF_H_0_COM_X = 0xc0; + uint256 private constant PROOF_H_0_COM_Y = 0xe0; + uint256 private constant PROOF_H_1_COM_X = 0x100; + uint256 private constant PROOF_H_1_COM_Y = 0x120; + uint256 private constant PROOF_H_2_COM_X = 0x140; + uint256 private constant PROOF_H_2_COM_Y = 0x160; - // wire values at zeta + // "evaluations of wire polynomials at zeta uint256 private constant PROOF_L_AT_ZETA = 0x180; uint256 private constant PROOF_R_AT_ZETA = 0x1a0; uint256 private constant PROOF_O_AT_ZETA = 0x1c0; @@ -115,9 +118,6 @@ contract PlonkVerifierForDataAggregation { uint256 private constant PROOF_OPENING_QCP_AT_ZETA = 0x300; uint256 private constant PROOF_BSB_COMMITMENTS = 0x320; - // -> next part of proof is - // [ openings_selector_commits || commitments_wires_commit_api] - // -------- offset state // challenges to check the claimed quotient @@ -133,7 +133,7 @@ contract PlonkVerifierForDataAggregation { uint256 private constant STATE_LINEARISED_POLYNOMIAL_Y = 0x100; uint256 private constant STATE_OPENING_LINEARISED_POLYNOMIAL_ZETA = 0x120; uint256 private constant STATE_FOLDED_CLAIMED_VALUES = 0x140; // Folded proof for the opening of H, linearised poly, l, r, o, s_1, s_2, qcp - uint256 private constant STATE_FOLDED_DIGESTS_X = 0x160; // folded digests of H, linearised poly, l, r, o, s_1, s_2, qcp + uint256 private constant STATE_FOLDED_DIGESTS_X = 0x160; // linearised poly, l, r, o, s_1, s_2, qcp uint256 private constant STATE_FOLDED_DIGESTS_Y = 0x180; uint256 private constant STATE_PI = 0x1a0; uint256 private constant STATE_ZETA_POWER_N_MINUS_ONE = 0x1c0; @@ -161,6 +161,7 @@ contract PlonkVerifierForDataAggregation { uint8 private constant HASH_FR_TWO = 2; // -------- precompiles + uint8 private constant SHA2 = 0x2; uint8 private constant MOD_EXP = 0x5; uint8 private constant EC_ADD = 0x6; uint8 private constant EC_MUL = 0x7; @@ -201,7 +202,7 @@ contract PlonkVerifierForDataAggregation { mstore(add(mem, STATE_PI), l_pi) compute_alpha_square_lagrange_0() - verify_opening_linearised_polynomial(proof.offset) + compute_opening_linearised_polynomial(proof.offset) fold_h(proof.offset) compute_commitment_linearised_polynomial(proof.offset) compute_gamma_kzg(proof.offset) @@ -221,6 +222,16 @@ contract PlonkVerifierForDataAggregation { revert(ptError, 0x64) } + /// Called when an exponentiation mod r fails + function error_mod_exp() { + let ptError := mload(0x40) + mstore(ptError, ERROR_STRING_ID) // selector for function Error(string) + mstore(add(ptError, 0x4), 0x20) + mstore(add(ptError, 0x24), 0xc) + mstore(add(ptError, 0x44), "error mod exp") + revert(ptError, 0x64) + } + /// Called when an operation on Bn254 fails /// @dev for instance when calling EcMul on a point not on Bn254. function error_ec_op() { @@ -321,7 +332,7 @@ contract PlonkVerifierForDataAggregation { /// Checks if the proof is of the correct size /// @param actual_proof_size size of the proof (not the expected size) function check_proof_size(actual_proof_size) { - let expected_proof_size := add(0x300, mul(VK_NB_CUSTOM_GATES, 0x60)) + let expected_proof_size := add(FIXED_PROOF_SIZE, mul(VK_NB_CUSTOM_GATES, 0x60)) if iszero(eq(actual_proof_size, expected_proof_size)) { error_proof_size() } @@ -405,9 +416,6 @@ contract PlonkVerifierForDataAggregation { let state := mload(0x40) let mPtr := add(state, STATE_LAST_MEM) - // gamma - // gamma in ascii is [0x67,0x61,0x6d, 0x6d, 0x61] - // (same for alpha, beta, zeta) mstore(mPtr, FS_GAMMA) // "gamma" mstore(add(mPtr, 0x20), VK_S1_COM_X) @@ -448,7 +456,7 @@ contract PlonkVerifierForDataAggregation { let size := add(0x2c5, size_pi_in_bytes) size := add(size, mul(VK_NB_CUSTOM_GATES, 0x40)) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1b), size, mPtr, 0x20) //0x1b -> 000.."gamma" + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1b), size, mPtr, 0x20) //0x1b -> 000.."gamma" if iszero(l_success) { error_verify() } @@ -468,7 +476,7 @@ contract PlonkVerifierForDataAggregation { // beta mstore(mPtr, FS_BETA) // "beta" mstore(add(mPtr, 0x20), gamma_not_reduced) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1c), 0x24, mPtr, 0x20) //0x1b -> 000.."gamma" + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1c), 0x24, mPtr, 0x20) //0x1b -> 000.."gamma" if iszero(l_success) { error_verify() } @@ -503,7 +511,7 @@ contract PlonkVerifierForDataAggregation { // [Z], the commitment to the grand product polynomial calldatacopy(_mPtr, add(aproof, PROOF_GRAND_PRODUCT_COMMITMENT_X), 0x40) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1b), full_size, mPtr, 0x20) + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1b), full_size, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -524,8 +532,8 @@ contract PlonkVerifierForDataAggregation { // zeta mstore(mPtr, FS_ZETA) // "zeta" mstore(add(mPtr, 0x20), alpha_not_reduced) - calldatacopy(add(mPtr, 0x40), add(aproof, PROOF_H_0_X), 0xc0) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1c), 0xe4, mPtr, 0x20) + calldatacopy(add(mPtr, 0x40), add(aproof, PROOF_H_0_COM_X), 0xc0) + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1c), 0xe4, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -566,28 +574,28 @@ contract PlonkVerifierForDataAggregation { /// batch_compute_lagranges_at_z computes [L_0(z), .., L_{n-1}(z)] /// @param z point at which the Lagranges are evaluated /// @param zpnmo ζⁿ-1 - /// @param n number of public inputs (number of Lagranges to compute) + /// @param n_pub number of public inputs (number of Lagranges to compute) /// @param mPtr pointer to which the results are stored - function batch_compute_lagranges_at_z(z, zpnmo, n, mPtr) { + function batch_compute_lagranges_at_z(z, zpnmo, n_pub, mPtr) { let zn := mulmod(zpnmo, VK_INV_DOMAIN_SIZE, R_MOD) // 1/n * (ζⁿ - 1) let _w := 1 let _mPtr := mPtr for { let i := 0 - } lt(i, n) { + } lt(i, n_pub) { i := add(i, 1) } { mstore(_mPtr, addmod(z, sub(R_MOD, _w), R_MOD)) _w := mulmod(_w, VK_OMEGA, R_MOD) _mPtr := add(_mPtr, 0x20) } - batch_invert(mPtr, n, _mPtr) + batch_invert(mPtr, n_pub, _mPtr) _mPtr := mPtr _w := 1 for { let i := 0 - } lt(i, n) { + } lt(i, n_pub) { i := add(i, 1) } { mstore(_mPtr, mulmod(mulmod(mload(_mPtr), zn, R_MOD), _w, R_MOD)) @@ -648,7 +656,6 @@ contract PlonkVerifierForDataAggregation { h_fr := hash_fr(calldataload(p), calldataload(add(p, 0x20)), mPtr) ith_lagrange := compute_ith_lagrange_at_z(z, zpnmo, add(nb_public_inputs, VK_INDEX_COMMIT_API_0), mPtr) pi_commit := addmod(pi_commit, mulmod(h_fr, ith_lagrange, R_MOD), R_MOD) - p := add(p, 0x40) } /// Computes L_i(zeta) = ωⁱ/n * (ζⁿ-1)/(ζ-ωⁱ) where: @@ -704,7 +711,7 @@ contract PlonkVerifierForDataAggregation { // size domain mstore8(add(mPtr, 0x8e), HASH_FR_SIZE_DOMAIN) - let l_success := staticcall(gas(), 0x2, mPtr, 0x8f, mPtr, 0x20) + let l_success := staticcall(gas(), SHA2, mPtr, 0x8f, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -728,7 +735,7 @@ contract PlonkVerifierForDataAggregation { mstore8(add(mPtr, 0x2b), 0x6b) mstore8(add(mPtr, 0x2c), HASH_FR_SIZE_DOMAIN) // size domain - l_success := staticcall(gas(), 0x2, mPtr, 0x2d, mPtr, 0x20) + l_success := staticcall(gas(), SHA2, mPtr, 0x2d, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -755,14 +762,14 @@ contract PlonkVerifierForDataAggregation { mstore8(add(mPtr, 0x4c), HASH_FR_SIZE_DOMAIN) // size domain let offset := add(mPtr, 0x20) - l_success := staticcall(gas(), 0x2, offset, 0x2d, offset, 0x20) + l_success := staticcall(gas(), SHA2, offset, 0x2d, offset, 0x20) if iszero(l_success) { error_verify() } // at this point we have mPtr = [ b1 || b2] where b1 is on 32byes and b2 in 16bytes. // we interpret it as a big integer mod r in big endian (similar to regular decimal notation) - // the result is then 2**(8*16)*mPtr[32:] + mPtr[32:48] + // the result is then 2**(8*16)*mPtr[:32] + mPtr[32:48] res := mulmod(mload(mPtr), HASH_FR_BB, R_MOD) // <- res = 2**128 * mPtr[:32] let b1 := shr(128, mload(add(mPtr, 0x20))) // b1 <- [0, 0, .., 0 || b2[:16] ] res := addmod(res, b1, R_MOD) @@ -802,7 +809,7 @@ contract PlonkVerifierForDataAggregation { // derive a random number. As there is no random generator, we // do an FS like challenge derivation, depending on both digests and - // ζ to ensure that the prover cannot control the random numger. + // ζ to ensure that the prover cannot control the random number. // Note: adding the other point ζω is not needed, as ω is known beforehand. mstore(mPtr, mload(add(state, STATE_FOLDED_DIGESTS_X))) mstore(add(mPtr, 0x20), mload(add(state, STATE_FOLDED_DIGESTS_Y))) @@ -814,7 +821,7 @@ contract PlonkVerifierForDataAggregation { mstore(add(mPtr, 0xe0), calldataload(add(aproof, PROOF_OPENING_AT_ZETA_OMEGA_Y))) mstore(add(mPtr, 0x100), mload(add(state, STATE_ZETA))) mstore(add(mPtr, 0x120), mload(add(state, STATE_GAMMA_KZG))) - let random := staticcall(gas(), 0x2, mPtr, 0x140, mPtr, 0x20) + let random := staticcall(gas(), SHA2, mPtr, 0x140, mPtr, 0x20) if iszero(random) { error_random_generation() } @@ -864,6 +871,7 @@ contract PlonkVerifierForDataAggregation { mstore(folded_quotients_y, sub(P_MOD, mload(folded_quotients_y))) mstore(mPtr, mload(folded_digests)) + mstore(add(mPtr, 0x20), mload(add(folded_digests, 0x20))) mstore(add(mPtr, 0x40), G2_SRS_0_X_0) // the 4 lines are the canonical G2 point on BN254 mstore(add(mPtr, 0x60), G2_SRS_0_X_1) @@ -895,7 +903,7 @@ contract PlonkVerifierForDataAggregation { /// @notice Fold the opening proofs at ζ: /// * at state+state_folded_digest we store: [Linearised_polynomial]+γ[L] + γ²[R] + γ³[O] + γ⁴[S₁] +γ⁵[S₂] + ∑ᵢγ⁵⁺ⁱ[Pi_{i}] - /// * at state+state_folded_claimed_values we store: H(ζ) + γLinearised_polynomial(ζ)+γ²L(ζ) + γ³R(ζ)+ γ⁴O(ζ) + γ⁵S₁(ζ) +γ⁶S₂(ζ) + ∑ᵢγ⁶⁺ⁱPi_{i}(ζ) + /// * at state+state_folded_claimed_values we store: Linearised_polynomial(ζ)+γL(ζ) + γ²R(ζ)+ γ³O(ζ) + γ⁴S₁(ζ) +γ⁵S₂(ζ) + ∑ᵢγ⁵⁺ⁱPi_{i}(ζ) /// @param aproof pointer to the proof /// acc_gamma stores the γⁱ function fold_state(aproof) { @@ -908,11 +916,11 @@ contract PlonkVerifierForDataAggregation { let acc_gamma := l_gamma_kzg let state_folded_digests := add(state, STATE_FOLDED_DIGESTS_X) - mstore(add(state, STATE_FOLDED_DIGESTS_X), mload(add(state, STATE_LINEARISED_POLYNOMIAL_X))) + mstore(state_folded_digests, mload(add(state, STATE_LINEARISED_POLYNOMIAL_X))) mstore(add(state, STATE_FOLDED_DIGESTS_Y), mload(add(state, STATE_LINEARISED_POLYNOMIAL_Y))) mstore(add(state, STATE_FOLDED_CLAIMED_VALUES), mload(add(state, STATE_OPENING_LINEARISED_POLYNOMIAL_ZETA))) - point_acc_mul_calldata(add(state, STATE_FOLDED_DIGESTS_X), add(aproof, PROOF_L_COM_X), acc_gamma, mPtr) + point_acc_mul_calldata(state_folded_digests, add(aproof, PROOF_L_COM_X), acc_gamma, mPtr) fr_acc_mul_calldata(add(state, STATE_FOLDED_CLAIMED_VALUES), add(aproof, PROOF_L_AT_ZETA), acc_gamma) acc_gamma := mulmod(acc_gamma, l_gamma_kzg, R_MOD) @@ -993,11 +1001,11 @@ contract PlonkVerifierForDataAggregation { mstore(_mPtr, calldataload(add(aproof, PROOF_GRAND_PRODUCT_AT_ZETA_OMEGA))) let start_input := 0x1b // 00.."gamma" - let size_input := add(0x14, mul(VK_NB_CUSTOM_GATES, 3)) // number of 32bytes elmts = 0x17 (zeta+3*6 for the digests+openings) + 3*VK_NB_CUSTOM_GATES (for the commitments of the selectors) + 1 (opening of Z at ζω) + let size_input := add(0x14, mul(VK_NB_CUSTOM_GATES, 3)) // number of 32bytes elmts = 0x14 (zeta+3*6 for the digests+openings) + 3*VK_NB_CUSTOM_GATES (for the commitments of the selectors) + 1 (opening of Z at ζω) size_input := add(0x5, mul(size_input, 0x20)) // size in bytes: 15*32 bytes + 5 bytes for gamma let check_staticcall := staticcall( gas(), - 0x2, + SHA2, add(mPtr, start_input), size_input, add(state, STATE_GAMMA_KZG), @@ -1144,7 +1152,7 @@ contract PlonkVerifierForDataAggregation { compute_commitment_linearised_polynomial_ec(aproof, s1, s2) } - /// @notice compute -z_h(ζ)*([H₁] + ζᵐ⁺²[H₂] + ζ²⁽ᵐ⁺²⁾[H₃]) and store the result at + /// @notice compute -z_h(ζ)*([H₁] + ζⁿ⁺²[H₂] + ζ²⁽ⁿ⁺²⁾[H₃]) and store the result at /// state + state_folded_h /// @param aproof pointer to the proof function fold_h(aproof) { @@ -1152,10 +1160,20 @@ contract PlonkVerifierForDataAggregation { let n_plus_two := add(VK_DOMAIN_SIZE, 2) let mPtr := add(mload(0x40), STATE_LAST_MEM) let zeta_power_n_plus_two := pow(mload(add(state, STATE_ZETA)), n_plus_two, mPtr) - point_mul_calldata(add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_2_X), zeta_power_n_plus_two, mPtr) - point_add_calldata(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_1_X), mPtr) + point_mul_calldata(add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_2_COM_X), zeta_power_n_plus_two, mPtr) + point_add_calldata( + add(state, STATE_FOLDED_H_X), + add(state, STATE_FOLDED_H_X), + add(aproof, PROOF_H_1_COM_X), + mPtr + ) point_mul(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), zeta_power_n_plus_two, mPtr) - point_add_calldata(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_0_X), mPtr) + point_add_calldata( + add(state, STATE_FOLDED_H_X), + add(state, STATE_FOLDED_H_X), + add(aproof, PROOF_H_0_COM_X), + mPtr + ) point_mul( add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), @@ -1170,7 +1188,7 @@ contract PlonkVerifierForDataAggregation { /// @notice check that the opening of the linearised polynomial at zeta is equal to /// - [ PI(ζ) - α²*L₁(ζ) + α(l(ζ)+β*s1(ζ)+γ)(r(ζ)+β*s2(ζ)+γ)(o(ζ)+γ)*z(ωζ) ] /// @param aproof pointer to the proof - function verify_opening_linearised_polynomial(aproof) { + function compute_opening_linearised_polynomial(aproof) { let state := mload(0x40) // (l(ζ)+β*s1(ζ)+γ) @@ -1289,7 +1307,6 @@ contract PlonkVerifierForDataAggregation { /// @param s scalar /// @mPtr free memory function point_acc_mul_calldata(dst, src, s, mPtr) { - let state := mload(0x40) mstore(mPtr, calldataload(src)) mstore(add(mPtr, 0x20), calldataload(add(src, 0x20))) mstore(add(mPtr, 0x40), s) @@ -1324,7 +1341,7 @@ contract PlonkVerifierForDataAggregation { mstore(add(mPtr, 0xa0), R_MOD) let check_staticcall := staticcall(gas(), MOD_EXP, mPtr, 0xc0, mPtr, 0x20) if eq(check_staticcall, 0) { - + error_mod_exp() } res := mload(mPtr) } diff --git a/contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol b/contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol index e2f95b88..83f15324 100644 --- a/contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol +++ b/contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol @@ -16,7 +16,7 @@ // Code generated by gnark DO NOT EDIT -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract PlonkVerifierForMultiTypeDataAggregation { uint256 private constant R_MOD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; diff --git a/contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol b/contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol index c9d79141..f9c5b695 100644 --- a/contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol +++ b/contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol @@ -16,7 +16,7 @@ // Code generated by gnark DO NOT EDIT -pragma solidity 0.8.24; +pragma solidity ^0.8.0; contract TestPlonkVerifierForDataAggregation { uint256 private constant R_MOD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; @@ -73,6 +73,9 @@ contract TestPlonkVerifierForDataAggregation { // ------------------------------------------------ + // size of the proof without call custom gate + uint256 private constant FIXED_PROOF_SIZE = 0x300; + // offset proof uint256 private constant PROOF_L_COM_X = 0x0; @@ -83,14 +86,14 @@ contract TestPlonkVerifierForDataAggregation { uint256 private constant PROOF_O_COM_Y = 0xa0; // h = h_0 + x^{n+2}h_1 + x^{2(n+2)}h_2 - uint256 private constant PROOF_H_0_X = 0xc0; - uint256 private constant PROOF_H_0_Y = 0xe0; - uint256 private constant PROOF_H_1_X = 0x100; - uint256 private constant PROOF_H_1_Y = 0x120; - uint256 private constant PROOF_H_2_X = 0x140; - uint256 private constant PROOF_H_2_Y = 0x160; + uint256 private constant PROOF_H_0_COM_X = 0xc0; + uint256 private constant PROOF_H_0_COM_Y = 0xe0; + uint256 private constant PROOF_H_1_COM_X = 0x100; + uint256 private constant PROOF_H_1_COM_Y = 0x120; + uint256 private constant PROOF_H_2_COM_X = 0x140; + uint256 private constant PROOF_H_2_COM_Y = 0x160; - // wire values at zeta + // "evaluations of wire polynomials at zeta uint256 private constant PROOF_L_AT_ZETA = 0x180; uint256 private constant PROOF_R_AT_ZETA = 0x1a0; uint256 private constant PROOF_O_AT_ZETA = 0x1c0; @@ -115,9 +118,6 @@ contract TestPlonkVerifierForDataAggregation { uint256 private constant PROOF_OPENING_QCP_AT_ZETA = 0x300; uint256 private constant PROOF_BSB_COMMITMENTS = 0x320; - // -> next part of proof is - // [ openings_selector_commits || commitments_wires_commit_api] - // -------- offset state // challenges to check the claimed quotient @@ -133,7 +133,7 @@ contract TestPlonkVerifierForDataAggregation { uint256 private constant STATE_LINEARISED_POLYNOMIAL_Y = 0x100; uint256 private constant STATE_OPENING_LINEARISED_POLYNOMIAL_ZETA = 0x120; uint256 private constant STATE_FOLDED_CLAIMED_VALUES = 0x140; // Folded proof for the opening of H, linearised poly, l, r, o, s_1, s_2, qcp - uint256 private constant STATE_FOLDED_DIGESTS_X = 0x160; // folded digests of H, linearised poly, l, r, o, s_1, s_2, qcp + uint256 private constant STATE_FOLDED_DIGESTS_X = 0x160; // linearised poly, l, r, o, s_1, s_2, qcp uint256 private constant STATE_FOLDED_DIGESTS_Y = 0x180; uint256 private constant STATE_PI = 0x1a0; uint256 private constant STATE_ZETA_POWER_N_MINUS_ONE = 0x1c0; @@ -161,6 +161,7 @@ contract TestPlonkVerifierForDataAggregation { uint8 private constant HASH_FR_TWO = 2; // -------- precompiles + uint8 private constant SHA2 = 0x2; uint8 private constant MOD_EXP = 0x5; uint8 private constant EC_ADD = 0x6; uint8 private constant EC_MUL = 0x7; @@ -201,7 +202,7 @@ contract TestPlonkVerifierForDataAggregation { mstore(add(mem, STATE_PI), l_pi) compute_alpha_square_lagrange_0() - verify_opening_linearised_polynomial(proof.offset) + compute_opening_linearised_polynomial(proof.offset) fold_h(proof.offset) compute_commitment_linearised_polynomial(proof.offset) compute_gamma_kzg(proof.offset) @@ -221,6 +222,16 @@ contract TestPlonkVerifierForDataAggregation { revert(ptError, 0x64) } + /// Called when an exponentiation mod r fails + function error_mod_exp() { + let ptError := mload(0x40) + mstore(ptError, ERROR_STRING_ID) // selector for function Error(string) + mstore(add(ptError, 0x4), 0x20) + mstore(add(ptError, 0x24), 0xc) + mstore(add(ptError, 0x44), "error mod exp") + revert(ptError, 0x64) + } + /// Called when an operation on Bn254 fails /// @dev for instance when calling EcMul on a point not on Bn254. function error_ec_op() { @@ -321,7 +332,7 @@ contract TestPlonkVerifierForDataAggregation { /// Checks if the proof is of the correct size /// @param actual_proof_size size of the proof (not the expected size) function check_proof_size(actual_proof_size) { - let expected_proof_size := add(0x300, mul(VK_NB_CUSTOM_GATES, 0x60)) + let expected_proof_size := add(FIXED_PROOF_SIZE, mul(VK_NB_CUSTOM_GATES, 0x60)) if iszero(eq(actual_proof_size, expected_proof_size)) { error_proof_size() } @@ -405,9 +416,6 @@ contract TestPlonkVerifierForDataAggregation { let state := mload(0x40) let mPtr := add(state, STATE_LAST_MEM) - // gamma - // gamma in ascii is [0x67,0x61,0x6d, 0x6d, 0x61] - // (same for alpha, beta, zeta) mstore(mPtr, FS_GAMMA) // "gamma" mstore(add(mPtr, 0x20), VK_S1_COM_X) @@ -448,7 +456,7 @@ contract TestPlonkVerifierForDataAggregation { let size := add(0x2c5, size_pi_in_bytes) size := add(size, mul(VK_NB_CUSTOM_GATES, 0x40)) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1b), size, mPtr, 0x20) //0x1b -> 000.."gamma" + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1b), size, mPtr, 0x20) //0x1b -> 000.."gamma" if iszero(l_success) { error_verify() } @@ -468,7 +476,7 @@ contract TestPlonkVerifierForDataAggregation { // beta mstore(mPtr, FS_BETA) // "beta" mstore(add(mPtr, 0x20), gamma_not_reduced) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1c), 0x24, mPtr, 0x20) //0x1b -> 000.."gamma" + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1c), 0x24, mPtr, 0x20) //0x1b -> 000.."gamma" if iszero(l_success) { error_verify() } @@ -503,7 +511,7 @@ contract TestPlonkVerifierForDataAggregation { // [Z], the commitment to the grand product polynomial calldatacopy(_mPtr, add(aproof, PROOF_GRAND_PRODUCT_COMMITMENT_X), 0x40) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1b), full_size, mPtr, 0x20) + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1b), full_size, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -524,8 +532,8 @@ contract TestPlonkVerifierForDataAggregation { // zeta mstore(mPtr, FS_ZETA) // "zeta" mstore(add(mPtr, 0x20), alpha_not_reduced) - calldatacopy(add(mPtr, 0x40), add(aproof, PROOF_H_0_X), 0xc0) - let l_success := staticcall(gas(), 0x2, add(mPtr, 0x1c), 0xe4, mPtr, 0x20) + calldatacopy(add(mPtr, 0x40), add(aproof, PROOF_H_0_COM_X), 0xc0) + let l_success := staticcall(gas(), SHA2, add(mPtr, 0x1c), 0xe4, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -566,28 +574,28 @@ contract TestPlonkVerifierForDataAggregation { /// batch_compute_lagranges_at_z computes [L_0(z), .., L_{n-1}(z)] /// @param z point at which the Lagranges are evaluated /// @param zpnmo ζⁿ-1 - /// @param n number of public inputs (number of Lagranges to compute) + /// @param n_pub number of public inputs (number of Lagranges to compute) /// @param mPtr pointer to which the results are stored - function batch_compute_lagranges_at_z(z, zpnmo, n, mPtr) { + function batch_compute_lagranges_at_z(z, zpnmo, n_pub, mPtr) { let zn := mulmod(zpnmo, VK_INV_DOMAIN_SIZE, R_MOD) // 1/n * (ζⁿ - 1) let _w := 1 let _mPtr := mPtr for { let i := 0 - } lt(i, n) { + } lt(i, n_pub) { i := add(i, 1) } { mstore(_mPtr, addmod(z, sub(R_MOD, _w), R_MOD)) _w := mulmod(_w, VK_OMEGA, R_MOD) _mPtr := add(_mPtr, 0x20) } - batch_invert(mPtr, n, _mPtr) + batch_invert(mPtr, n_pub, _mPtr) _mPtr := mPtr _w := 1 for { let i := 0 - } lt(i, n) { + } lt(i, n_pub) { i := add(i, 1) } { mstore(_mPtr, mulmod(mulmod(mload(_mPtr), zn, R_MOD), _w, R_MOD)) @@ -648,7 +656,6 @@ contract TestPlonkVerifierForDataAggregation { h_fr := hash_fr(calldataload(p), calldataload(add(p, 0x20)), mPtr) ith_lagrange := compute_ith_lagrange_at_z(z, zpnmo, add(nb_public_inputs, VK_INDEX_COMMIT_API_0), mPtr) pi_commit := addmod(pi_commit, mulmod(h_fr, ith_lagrange, R_MOD), R_MOD) - p := add(p, 0x40) } /// Computes L_i(zeta) = ωⁱ/n * (ζⁿ-1)/(ζ-ωⁱ) where: @@ -704,7 +711,7 @@ contract TestPlonkVerifierForDataAggregation { // size domain mstore8(add(mPtr, 0x8e), HASH_FR_SIZE_DOMAIN) - let l_success := staticcall(gas(), 0x2, mPtr, 0x8f, mPtr, 0x20) + let l_success := staticcall(gas(), SHA2, mPtr, 0x8f, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -728,7 +735,7 @@ contract TestPlonkVerifierForDataAggregation { mstore8(add(mPtr, 0x2b), 0x6b) mstore8(add(mPtr, 0x2c), HASH_FR_SIZE_DOMAIN) // size domain - l_success := staticcall(gas(), 0x2, mPtr, 0x2d, mPtr, 0x20) + l_success := staticcall(gas(), SHA2, mPtr, 0x2d, mPtr, 0x20) if iszero(l_success) { error_verify() } @@ -755,14 +762,14 @@ contract TestPlonkVerifierForDataAggregation { mstore8(add(mPtr, 0x4c), HASH_FR_SIZE_DOMAIN) // size domain let offset := add(mPtr, 0x20) - l_success := staticcall(gas(), 0x2, offset, 0x2d, offset, 0x20) + l_success := staticcall(gas(), SHA2, offset, 0x2d, offset, 0x20) if iszero(l_success) { error_verify() } // at this point we have mPtr = [ b1 || b2] where b1 is on 32byes and b2 in 16bytes. // we interpret it as a big integer mod r in big endian (similar to regular decimal notation) - // the result is then 2**(8*16)*mPtr[32:] + mPtr[32:48] + // the result is then 2**(8*16)*mPtr[:32] + mPtr[32:48] res := mulmod(mload(mPtr), HASH_FR_BB, R_MOD) // <- res = 2**128 * mPtr[:32] let b1 := shr(128, mload(add(mPtr, 0x20))) // b1 <- [0, 0, .., 0 || b2[:16] ] res := addmod(res, b1, R_MOD) @@ -802,7 +809,7 @@ contract TestPlonkVerifierForDataAggregation { // derive a random number. As there is no random generator, we // do an FS like challenge derivation, depending on both digests and - // ζ to ensure that the prover cannot control the random numger. + // ζ to ensure that the prover cannot control the random number. // Note: adding the other point ζω is not needed, as ω is known beforehand. mstore(mPtr, mload(add(state, STATE_FOLDED_DIGESTS_X))) mstore(add(mPtr, 0x20), mload(add(state, STATE_FOLDED_DIGESTS_Y))) @@ -814,7 +821,7 @@ contract TestPlonkVerifierForDataAggregation { mstore(add(mPtr, 0xe0), calldataload(add(aproof, PROOF_OPENING_AT_ZETA_OMEGA_Y))) mstore(add(mPtr, 0x100), mload(add(state, STATE_ZETA))) mstore(add(mPtr, 0x120), mload(add(state, STATE_GAMMA_KZG))) - let random := staticcall(gas(), 0x2, mPtr, 0x140, mPtr, 0x20) + let random := staticcall(gas(), SHA2, mPtr, 0x140, mPtr, 0x20) if iszero(random) { error_random_generation() } @@ -864,6 +871,7 @@ contract TestPlonkVerifierForDataAggregation { mstore(folded_quotients_y, sub(P_MOD, mload(folded_quotients_y))) mstore(mPtr, mload(folded_digests)) + mstore(add(mPtr, 0x20), mload(add(folded_digests, 0x20))) mstore(add(mPtr, 0x40), G2_SRS_0_X_0) // the 4 lines are the canonical G2 point on BN254 mstore(add(mPtr, 0x60), G2_SRS_0_X_1) @@ -895,7 +903,7 @@ contract TestPlonkVerifierForDataAggregation { /// @notice Fold the opening proofs at ζ: /// * at state+state_folded_digest we store: [Linearised_polynomial]+γ[L] + γ²[R] + γ³[O] + γ⁴[S₁] +γ⁵[S₂] + ∑ᵢγ⁵⁺ⁱ[Pi_{i}] - /// * at state+state_folded_claimed_values we store: H(ζ) + γLinearised_polynomial(ζ)+γ²L(ζ) + γ³R(ζ)+ γ⁴O(ζ) + γ⁵S₁(ζ) +γ⁶S₂(ζ) + ∑ᵢγ⁶⁺ⁱPi_{i}(ζ) + /// * at state+state_folded_claimed_values we store: Linearised_polynomial(ζ)+γL(ζ) + γ²R(ζ)+ γ³O(ζ) + γ⁴S₁(ζ) +γ⁵S₂(ζ) + ∑ᵢγ⁵⁺ⁱPi_{i}(ζ) /// @param aproof pointer to the proof /// acc_gamma stores the γⁱ function fold_state(aproof) { @@ -908,11 +916,11 @@ contract TestPlonkVerifierForDataAggregation { let acc_gamma := l_gamma_kzg let state_folded_digests := add(state, STATE_FOLDED_DIGESTS_X) - mstore(add(state, STATE_FOLDED_DIGESTS_X), mload(add(state, STATE_LINEARISED_POLYNOMIAL_X))) + mstore(state_folded_digests, mload(add(state, STATE_LINEARISED_POLYNOMIAL_X))) mstore(add(state, STATE_FOLDED_DIGESTS_Y), mload(add(state, STATE_LINEARISED_POLYNOMIAL_Y))) mstore(add(state, STATE_FOLDED_CLAIMED_VALUES), mload(add(state, STATE_OPENING_LINEARISED_POLYNOMIAL_ZETA))) - point_acc_mul_calldata(add(state, STATE_FOLDED_DIGESTS_X), add(aproof, PROOF_L_COM_X), acc_gamma, mPtr) + point_acc_mul_calldata(state_folded_digests, add(aproof, PROOF_L_COM_X), acc_gamma, mPtr) fr_acc_mul_calldata(add(state, STATE_FOLDED_CLAIMED_VALUES), add(aproof, PROOF_L_AT_ZETA), acc_gamma) acc_gamma := mulmod(acc_gamma, l_gamma_kzg, R_MOD) @@ -993,11 +1001,11 @@ contract TestPlonkVerifierForDataAggregation { mstore(_mPtr, calldataload(add(aproof, PROOF_GRAND_PRODUCT_AT_ZETA_OMEGA))) let start_input := 0x1b // 00.."gamma" - let size_input := add(0x14, mul(VK_NB_CUSTOM_GATES, 3)) // number of 32bytes elmts = 0x17 (zeta+3*6 for the digests+openings) + 3*VK_NB_CUSTOM_GATES (for the commitments of the selectors) + 1 (opening of Z at ζω) + let size_input := add(0x14, mul(VK_NB_CUSTOM_GATES, 3)) // number of 32bytes elmts = 0x14 (zeta+3*6 for the digests+openings) + 3*VK_NB_CUSTOM_GATES (for the commitments of the selectors) + 1 (opening of Z at ζω) size_input := add(0x5, mul(size_input, 0x20)) // size in bytes: 15*32 bytes + 5 bytes for gamma let check_staticcall := staticcall( gas(), - 0x2, + SHA2, add(mPtr, start_input), size_input, add(state, STATE_GAMMA_KZG), @@ -1144,7 +1152,7 @@ contract TestPlonkVerifierForDataAggregation { compute_commitment_linearised_polynomial_ec(aproof, s1, s2) } - /// @notice compute -z_h(ζ)*([H₁] + ζᵐ⁺²[H₂] + ζ²⁽ᵐ⁺²⁾[H₃]) and store the result at + /// @notice compute -z_h(ζ)*([H₁] + ζⁿ⁺²[H₂] + ζ²⁽ⁿ⁺²⁾[H₃]) and store the result at /// state + state_folded_h /// @param aproof pointer to the proof function fold_h(aproof) { @@ -1152,10 +1160,20 @@ contract TestPlonkVerifierForDataAggregation { let n_plus_two := add(VK_DOMAIN_SIZE, 2) let mPtr := add(mload(0x40), STATE_LAST_MEM) let zeta_power_n_plus_two := pow(mload(add(state, STATE_ZETA)), n_plus_two, mPtr) - point_mul_calldata(add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_2_X), zeta_power_n_plus_two, mPtr) - point_add_calldata(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_1_X), mPtr) + point_mul_calldata(add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_2_COM_X), zeta_power_n_plus_two, mPtr) + point_add_calldata( + add(state, STATE_FOLDED_H_X), + add(state, STATE_FOLDED_H_X), + add(aproof, PROOF_H_1_COM_X), + mPtr + ) point_mul(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), zeta_power_n_plus_two, mPtr) - point_add_calldata(add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), add(aproof, PROOF_H_0_X), mPtr) + point_add_calldata( + add(state, STATE_FOLDED_H_X), + add(state, STATE_FOLDED_H_X), + add(aproof, PROOF_H_0_COM_X), + mPtr + ) point_mul( add(state, STATE_FOLDED_H_X), add(state, STATE_FOLDED_H_X), @@ -1170,7 +1188,7 @@ contract TestPlonkVerifierForDataAggregation { /// @notice check that the opening of the linearised polynomial at zeta is equal to /// - [ PI(ζ) - α²*L₁(ζ) + α(l(ζ)+β*s1(ζ)+γ)(r(ζ)+β*s2(ζ)+γ)(o(ζ)+γ)*z(ωζ) ] /// @param aproof pointer to the proof - function verify_opening_linearised_polynomial(aproof) { + function compute_opening_linearised_polynomial(aproof) { let state := mload(0x40) // (l(ζ)+β*s1(ζ)+γ) @@ -1289,7 +1307,6 @@ contract TestPlonkVerifierForDataAggregation { /// @param s scalar /// @mPtr free memory function point_acc_mul_calldata(dst, src, s, mPtr) { - let state := mload(0x40) mstore(mPtr, calldataload(src)) mstore(add(mPtr, 0x20), calldataload(add(src, 0x20))) mstore(add(mPtr, 0x40), s) @@ -1324,7 +1341,7 @@ contract TestPlonkVerifierForDataAggregation { mstore(add(mPtr, 0xa0), R_MOD) let check_staticcall := staticcall(gas(), MOD_EXP, mPtr, 0xc0, mPtr, 0x20) if eq(check_staticcall, 0) { - + error_mod_exp() } res := mload(mPtr) } diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index b3760289..350c8482 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -28,7 +28,19 @@ const config: HardhatUserConfig = { artifacts: "./build", }, solidity: { + // NB: double check the autoupdate shell script version complies to the latest solidity version if you add a new one. compilers: [ + { + version: "0.8.26", + settings: { + viaIR: useViaIR, + optimizer: { + enabled: true, + runs: 50_000, + }, + evmVersion: "cancun", + }, + }, { version: "0.8.25", settings: { @@ -81,18 +93,10 @@ const config: HardhatUserConfig = { accounts: [process.env.SEPOLIA_PRIVATE_KEY || EMPTY_HASH], url: "https://sepolia.infura.io/v3/" + process.env.INFURA_API_KEY, }, - goerli: { - accounts: [process.env.GOERLI_PRIVATE_KEY || EMPTY_HASH], - url: "https://goerli.infura.io/v3/" + process.env.INFURA_API_KEY, - }, linea_mainnet: { accounts: [process.env.LINEA_MAINNET_PRIVATE_KEY || EMPTY_HASH], url: "https://linea-mainnet.infura.io/v3/" + process.env.INFURA_API_KEY, }, - linea_goerli: { - accounts: [process.env.LINEA_GOERLI_PRIVATE_KEY || EMPTY_HASH], - url: "https://linea-goerli.infura.io/v3/" + process.env.INFURA_API_KEY, - }, linea_sepolia: { accounts: [process.env.LINEA_SEPOLIA_PRIVATE_KEY || EMPTY_HASH], url: "https://linea-sepolia.infura.io/v3/" + process.env.INFURA_API_KEY, @@ -122,21 +126,11 @@ const config: HardhatUserConfig = { etherscan: { apiKey: { mainnet: process.env.ETHERSCAN_API_KEY ?? "", - goerli: process.env.ETHERSCAN_API_KEY ?? "", sepolia: process.env.ETHERSCAN_API_KEY ?? "", linea_sepolia: process.env.LINEASCAN_API_KEY ?? "", - linea_goerli: process.env.LINEASCAN_API_KEY ?? "", linea_mainnet: process.env.LINEASCAN_API_KEY ?? "", }, customChains: [ - { - network: "linea_goerli", - chainId: 59140, - urls: { - apiURL: "https://api-goerli.lineascan.build/api", - browserURL: "https://goerli.lineascan.build/", - }, - }, { network: "linea_sepolia", chainId: 59141, diff --git a/contracts/test/TokenMintingRateLimiter.ts b/contracts/test/TokenMintingRateLimiter.ts index 65f653ce..d16c5856 100644 --- a/contracts/test/TokenMintingRateLimiter.ts +++ b/contracts/test/TokenMintingRateLimiter.ts @@ -57,7 +57,7 @@ describe("Token Minting Rate Limiter", () => { beforeEach(async () => { xpToken = await loadFixture(deployLineaVoyageXPFixture); tokenMintingRateLimiter = await loadFixture(deployTokenMintingRateLimiterFixture); - xpToken.connect(minter).grantRole(MINTER_ROLE, await tokenMintingRateLimiter.getAddress()); + await xpToken.connect(minter).grantRole(MINTER_ROLE, await tokenMintingRateLimiter.getAddress()); }); describe("Initialization and roles", () => { diff --git a/prover/cmd/dev-tools/testcase-gen/compression-aggregation/autoupdate.sh b/prover/cmd/dev-tools/testcase-gen/compression-aggregation/autoupdate.sh index a9912e26..94279f70 100755 --- a/prover/cmd/dev-tools/testcase-gen/compression-aggregation/autoupdate.sh +++ b/prover/cmd/dev-tools/testcase-gen/compression-aggregation/autoupdate.sh @@ -37,7 +37,7 @@ mv -f .samples-test-eip4844/* ${SOLTESTDIR_EIP4844}/test rm -rf .samples-simple-calldata .samples-multiproof-calldata .samples-test-calldata rm -rf .samples-simple-eip4844 .samples-multiproof-eip4844 .samples-test-eip4844 -sed -i.bak 's/pragma solidity \^0.8.19;/pragma solidity 0.8.24;/g' ../contracts/test/testData/compressedData/Verifier1.sol +sed -i.bak 's/pragma solidity \0.8.24;/pragma solidity 0.8.26;/g' ../contracts/test/testData/compressedData/Verifier1.sol cp ../contracts/test/testData/compressedData/Verifier1.sol ../contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol sed -i.bak 's/contract PlonkVerifier /contract PlonkVerifierForDataAggregation /g' ../contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol diff --git a/prover/prover-assets/3.0.0/integration-development/emulation-dummy/Verifier.sol b/prover/prover-assets/3.0.0/integration-development/emulation-dummy/Verifier.sol index edfddb49..5da795b3 100644 --- a/prover/prover-assets/3.0.0/integration-development/emulation-dummy/Verifier.sol +++ b/prover/prover-assets/3.0.0/integration-development/emulation-dummy/Verifier.sol @@ -16,7 +16,7 @@ // Code generated by gnark DO NOT EDIT -pragma solidity 0.8.24; +pragma solidity 0.8.26; contract PlonkVerifier {