Skip to content

Commit e054bd3

Browse files
authored
Merge branch 'main' into Monorepo-perozitory
2 parents e2e9cd2 + 624c877 commit e054bd3

File tree

113 files changed

+2894
-886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2894
-886
lines changed

.github/workflows/coordinator-build-and-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ concurrency:
5151

5252
jobs:
5353
build-and-publish:
54-
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
54+
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large
5555
name: Coordinator build
5656
env:
5757
COMMIT_TAG: ${{ inputs.commit_tag }}
@@ -78,7 +78,7 @@ jobs:
7878
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 #v4.2.1
7979
- name: Build dist
8080
run: |
81-
./gradlew coordinator:app:installDist --no-daemon
81+
./gradlew coordinator:app:installDist
8282
- name: Login to Docker Hub
8383
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
8484
uses: docker/login-action@v3

.husky/pre-commit.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ const FILE_EXTENSION_FILTERS = {
4343
[FILE_EXTENSION.SOLIDITY]: "\.sol$",
4444
};
4545

46-
// File extension => script in package.json to run
46+
// File extension => script in package.json to run for linting
4747
const FILE_EXTENSION_LINTING_COMMAND = {
4848
[FILE_EXTENSION.TYPESCRIPT]: "pnpm run lint:ts:fix",
4949
[FILE_EXTENSION.SOLIDITY]: "pnpm run lint:sol:fix",
5050
};
5151

52+
// File extension => script in package.json to run for documentation generation
53+
const FILE_EXTENSION_DOCUMENTATION_UPDATING_COMMAND = {
54+
[FILE_EXTENSION.SOLIDITY]: "pnpm run solidity:docgen",
55+
};
56+
5257
// Project => Path in monorepo
5358
const FOLDER_PATH = {
5459
[FOLDER.BRIDGEUI]: "bridge-ui/",
@@ -95,7 +100,8 @@ function main() {
95100
process.exit(1);
96101
}
97102
const changedFileExtensions = getChangedFileExtensions(folder);
98-
executeLinting(folder, changedFileExtensions);
103+
executeCommand(folder, changedFileExtensions, FILE_EXTENSION_LINTING_COMMAND);
104+
executeCommand(folder, changedFileExtensions, FILE_EXTENSION_DOCUMENTATION_UPDATING_COMMAND);
99105
}
100106

101107
updateGitIndex();
@@ -180,14 +186,15 @@ function getChangedFileExtensions(_folder) {
180186
}
181187

182188
/**
183-
* Execute linting command
184-
* @param {FOLDER, FILE_EXTENSION[]}
189+
* Execute command based on file extension
190+
* @param {FOLDER, FILE_EXTENSION[], FILE_EXTENSION_LINTING_COMMAND | FILE_EXTENSION_DOCUMENTATION_UPDATING_COMMAND}
185191
*/
186-
function executeLinting(_folder, _changedFileExtensions) {
192+
function executeCommand(_folder, _changedFileExtensions, _command) {
187193
for (const fileExtension of _changedFileExtensions) {
188194
const path = FOLDER_PATH[_folder];
189-
const cmd = FILE_EXTENSION_LINTING_COMMAND[fileExtension];
190-
console.log(`${fileExtension} change found in ${path}, linting...`);
195+
const cmd = _command[fileExtension];
196+
if (!cmd) return;
197+
console.log(`${fileExtension} change found in ${path}, executing command ${cmd}`);
191198
try {
192199
// Execute command synchronously and stream output directly to the current stdout
193200
execSync(`

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ deploy-token-bridge-l1:
111111
RPC_URL=http:\\localhost:8445/ \
112112
REMOTE_CHAIN_ID=1337 \
113113
TOKEN_BRIDGE_L1=true \
114-
TOKEN_BRIDGE_SECURITY_COUNCIL=0x90F79bf6EB2c4f870365E785982E1f101E93b906 \
114+
L1_TOKEN_BRIDGE_SECURITY_COUNCIL=0x90F79bf6EB2c4f870365E785982E1f101E93b906 \
115115
L2MESSAGESERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
116116
LINEA_ROLLUP_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
117117
npx ts-node local-deployments-artifacts/deployBridgedTokenAndTokenBridge.ts
@@ -124,7 +124,7 @@ deploy-token-bridge-l2:
124124
RPC_URL=http:\\localhost:8545/ \
125125
REMOTE_CHAIN_ID=31648428 \
126126
TOKEN_BRIDGE_L1=false \
127-
TOKEN_BRIDGE_SECURITY_COUNCIL=0xf17f52151EbEF6C7334FAD080c5704D77216b732 \
127+
L2_TOKEN_BRIDGE_SECURITY_COUNCIL=0xf17f52151EbEF6C7334FAD080c5704D77216b732 \
128128
L2MESSAGESERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
129129
LINEA_ROLLUP_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
130130
npx ts-node local-deployments-artifacts/deployBridgedTokenAndTokenBridge.ts

buildSrc/src/main/groovy/net.consensys.zkevm.kotlin-common-minimal-conventions.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ repositories {
2020
url "https://hyperledger.jfrog.io/artifactory/besu-maven/"
2121
content { includeGroupAndSubgroups('org.hyperledger.besu') }
2222
}
23+
maven {
24+
url "https://artifacts.consensys.net/public/linea-besu/maven/"
25+
content {
26+
includeGroupAndSubgroups('io.consensys')
27+
}
28+
}
2329
maven {
2430
url "https://artifacts.consensys.net/public/maven/maven/"
2531
}

contracts/abi/LineaRollupV6.0.abi

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -983,19 +983,6 @@
983983
"stateMutability": "view",
984984
"type": "function"
985985
},
986-
{
987-
"inputs": [],
988-
"name": "GENESIS_SHNARF",
989-
"outputs": [
990-
{
991-
"internalType": "bytes32",
992-
"name": "",
993-
"type": "bytes32"
994-
}
995-
],
996-
"stateMutability": "view",
997-
"type": "function"
998-
},
999986
{
1000987
"inputs": [],
1001988
"name": "INBOX_STATUS_RECEIVED",

contracts/contracts/LineaRollup.sol

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: AGPL-3.0
22
pragma solidity 0.8.26;
33

4-
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
54
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
65
import { L1MessageService } from "./messageService/l1/L1MessageService.sol";
76
import { ZkEvmV2 } from "./ZkEvmV2.sol";
@@ -14,14 +13,7 @@ import { Utils } from "./lib/Utils.sol";
1413
* @author ConsenSys Software Inc.
1514
* @custom:security-contact security-report@linea.build
1615
*/
17-
contract LineaRollup is
18-
Initializable,
19-
AccessControlUpgradeable,
20-
ZkEvmV2,
21-
L1MessageService,
22-
PermissionsManager,
23-
ILineaRollup
24-
{
16+
contract LineaRollup is AccessControlUpgradeable, ZkEvmV2, L1MessageService, PermissionsManager, ILineaRollup {
2517
using Utils for *;
2618

2719
/// @notice This is the ABI version and not the reinitialize version.
@@ -33,18 +25,6 @@ contract LineaRollup is
3325
/// @notice The role required to set/remove proof verifiers by type.
3426
bytes32 public constant VERIFIER_UNSETTER_ROLE = keccak256("VERIFIER_UNSETTER_ROLE");
3527

36-
/// @notice The default genesis shnarf using empty/default hashes and a default state.
37-
bytes32 public constant GENESIS_SHNARF =
38-
keccak256(
39-
abi.encode(
40-
EMPTY_HASH,
41-
EMPTY_HASH,
42-
0x072ead6777750dc20232d1cee8dc9a395c2d350df4bbaa5096c6f59b214dcecd,
43-
EMPTY_HASH,
44-
EMPTY_HASH
45-
)
46-
);
47-
4828
/// @dev Value indicating a shnarf exists.
4929
uint256 internal constant SHNARF_EXISTS_DEFAULT_VALUE = 1;
5030

@@ -122,6 +102,10 @@ contract LineaRollup is
122102

123103
__MessageService_init(_initializationData.rateLimitPeriodInSeconds, _initializationData.rateLimitAmountInWei);
124104

105+
if (_initializationData.defaultAdmin == address(0)) {
106+
revert ZeroAddressNotAllowed();
107+
}
108+
125109
/**
126110
* @dev DEFAULT_ADMIN_ROLE is set for the security council explicitly,
127111
* as the permissions init purposefully does not allow DEFAULT_ADMIN_ROLE to be set.
@@ -132,15 +116,26 @@ contract LineaRollup is
132116

133117
verifiers[0] = _initializationData.defaultVerifier;
134118

119+
if (_initializationData.fallbackOperator == address(0)) {
120+
revert ZeroAddressNotAllowed();
121+
}
122+
135123
fallbackOperator = _initializationData.fallbackOperator;
136124
emit FallbackOperatorAddressSet(msg.sender, _initializationData.fallbackOperator);
137125

138126
currentL2BlockNumber = _initializationData.initialL2BlockNumber;
139127
stateRootHashes[_initializationData.initialL2BlockNumber] = _initializationData.initialStateRootHash;
140128

141-
blobShnarfExists[GENESIS_SHNARF] = SHNARF_EXISTS_DEFAULT_VALUE;
129+
bytes32 genesisShnarf = _computeShnarf(
130+
EMPTY_HASH,
131+
EMPTY_HASH,
132+
_initializationData.initialStateRootHash,
133+
EMPTY_HASH,
134+
EMPTY_HASH
135+
);
142136

143-
currentFinalizedShnarf = GENESIS_SHNARF;
137+
blobShnarfExists[genesisShnarf] = SHNARF_EXISTS_DEFAULT_VALUE;
138+
currentFinalizedShnarf = genesisShnarf;
144139
currentFinalizedState = _computeLastFinalizedState(0, EMPTY_HASH, _initializationData.genesisTimestamp);
145140
}
146141

@@ -487,8 +482,7 @@ contract LineaRollup is
487482
_finalizationData,
488483
lastFinalizedShnarf,
489484
finalShnarf,
490-
lastFinalizedBlockNumber,
491-
_finalizationData.endBlockNumber
485+
lastFinalizedBlockNumber
492486
);
493487

494488
_verifyProof(publicInput, _proofType, _aggregatedProof);
@@ -504,10 +498,6 @@ contract LineaRollup is
504498
FinalizationDataV3 calldata _finalizationData,
505499
uint256 _lastFinalizedBlock
506500
) internal returns (bytes32 finalShnarf) {
507-
if (_finalizationData.endBlockNumber <= _lastFinalizedBlock) {
508-
revert FinalBlockNumberLessThanOrEqualToLastFinalizedBlock(_finalizationData.endBlockNumber, _lastFinalizedBlock);
509-
}
510-
511501
_validateL2ComputedRollingHash(_finalizationData.l1RollingHashMessageNumber, _finalizationData.l1RollingHash);
512502

513503
if (
@@ -678,14 +668,12 @@ contract LineaRollup is
678668
* @param _finalizationData The full finalization data.
679669
* @param _finalShnarf The final shnarf in the finalization.
680670
* @param _lastFinalizedBlockNumber The last finalized block number.
681-
* @param _endBlockNumber End block number being finalized.
682671
*/
683672
function _computePublicInput(
684673
FinalizationDataV3 calldata _finalizationData,
685674
bytes32 _lastFinalizedShnarf,
686675
bytes32 _finalShnarf,
687-
uint256 _lastFinalizedBlockNumber,
688-
uint256 _endBlockNumber
676+
uint256 _lastFinalizedBlockNumber
689677
) private pure returns (uint256 publicInput) {
690678
assembly {
691679
let mPtr := mload(0x40)
@@ -701,7 +689,7 @@ contract LineaRollup is
701689
mstore(add(mPtr, 0x80), _lastFinalizedBlockNumber)
702690

703691
// _finalizationData.endBlockNumber
704-
mstore(add(mPtr, 0xA0), _endBlockNumber)
692+
calldatacopy(add(mPtr, 0xA0), add(_finalizationData, 0x20), 0x20)
705693

706694
/**
707695
* _finalizationData.lastFinalizedL1RollingHash

contracts/contracts/ZkEvmV2.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: AGPL-3.0
22
pragma solidity 0.8.26;
33

4-
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
54
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
65
import { L1MessageServiceV1 } from "./messageService/l1/v1/L1MessageServiceV1.sol";
76
import { IZkEvmV2 } from "./interfaces/l1/IZkEvmV2.sol";
@@ -11,7 +10,7 @@ import { IPlonkVerifier } from "./interfaces/l1/IPlonkVerifier.sol";
1110
* @author ConsenSys Software Inc.
1211
* @custom:security-contact security-report@linea.build
1312
*/
14-
abstract contract ZkEvmV2 is Initializable, AccessControlUpgradeable, L1MessageServiceV1, IZkEvmV2 {
13+
abstract contract ZkEvmV2 is AccessControlUpgradeable, L1MessageServiceV1, IZkEvmV2 {
1514
uint256 internal constant MODULO_R = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
1615
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
1716

@@ -49,7 +48,7 @@ abstract contract ZkEvmV2 is Initializable, AccessControlUpgradeable, L1MessageS
4948
}
5049

5150
(bool callSuccess, bytes memory result) = verifierToUse.call(
52-
abi.encodeWithSelector(IPlonkVerifier.Verify.selector, _proof, publicInput)
51+
abi.encodeCall(IPlonkVerifier.Verify, (_proof, publicInput))
5352
);
5453

5554
if (!callSuccess) {

contracts/contracts/interfaces/IPauseManager.sol

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,29 @@ interface IPauseManager {
5757
*/
5858
event PauseTypeRoleSet(PauseType indexed pauseType, bytes32 indexed role);
5959

60+
/**
61+
* @notice Emitted when a pause type and its associated role are updated in the `_PauseTypeRoles` mapping.
62+
* @param pauseType The indexed type of pause.
63+
* @param role The indexed role associated with the pause type.
64+
* @param previousRole The indexed previously found role associated with the pause type.
65+
*/
66+
event PauseTypeRoleUpdated(PauseType indexed pauseType, bytes32 indexed role, bytes32 indexed previousRole);
67+
6068
/**
6169
* @notice Emitted when an unpause type and its associated role are set in the `_unPauseTypeRoles` mapping.
6270
* @param unPauseType The indexed type of unpause.
6371
* @param role The indexed role associated with the unpause type.
6472
*/
6573
event UnPauseTypeRoleSet(PauseType indexed unPauseType, bytes32 indexed role);
6674

75+
/**
76+
* @notice Emitted when an unpause type and its associated role are updated in the `_unPauseTypeRoles` mapping.
77+
* @param unPauseType The indexed type of unpause.
78+
* @param role The indexed role associated with the unpause type.
79+
* @param previousRole The indexed previously found role associated with the unpause type.
80+
*/
81+
event UnPauseTypeRoleUpdated(PauseType indexed unPauseType, bytes32 indexed role, bytes32 indexed previousRole);
82+
6783
/**
6884
* @dev Thrown when a specific pause type is paused.
6985
*/
@@ -74,15 +90,27 @@ interface IPauseManager {
7490
*/
7591
error IsNotPaused(PauseType pauseType);
7692

93+
/**
94+
* @dev Thrown when the unused paused type is used.
95+
*/
96+
error PauseTypeNotUsed();
97+
98+
/**
99+
* @dev Thrown when trying to update a pause/unpause type role mapping to the existing role.
100+
*/
101+
error RolesNotDifferent();
102+
77103
/**
78104
* @notice Pauses functionality by specific type.
105+
* @dev Throws if UNUSED pause type is used.
79106
* @dev Requires the role mapped in pauseTypeRoles for the pauseType.
80107
* @param _pauseType The pause type value.
81108
*/
82109
function pauseByType(PauseType _pauseType) external;
83110

84111
/**
85112
* @notice Unpauses functionality by specific type.
113+
* @dev Throws if UNUSED pause type is used.
86114
* @dev Requires the role mapped in unPauseTypeRoles for the pauseType.
87115
* @param _pauseType The pause type value.
88116
*/
@@ -94,4 +122,24 @@ interface IPauseManager {
94122
* @return pauseTypeIsPaused Returns true if the pause type if paused, false otherwise.
95123
*/
96124
function isPaused(PauseType _pauseType) external view returns (bool pauseTypeIsPaused);
125+
126+
/**
127+
* @notice Update the pause type role mapping.
128+
* @dev Throws if UNUSED pause type is used.
129+
* @dev Throws if role not different.
130+
* @dev PAUSE_ALL_ROLE role is required to execute this function.
131+
* @param _pauseType The pause type value to update.
132+
* @param _newRole The role to update to.
133+
*/
134+
function updatePauseTypeRole(PauseType _pauseType, bytes32 _newRole) external;
135+
136+
/**
137+
* @notice Update the unpause type role mapping.
138+
* @dev Throws if UNUSED pause type is used.
139+
* @dev Throws if role not different.
140+
* @dev UNPAUSE_ALL_ROLE role is required to execute this function.
141+
* @param _pauseType The pause type value to update.
142+
* @param _newRole The role to update to.
143+
*/
144+
function updateUnpauseTypeRole(PauseType _pauseType, bytes32 _newRole) external;
97145
}

contracts/contracts/interfaces/l1/ILineaRollup.sol

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,6 @@ interface ILineaRollup {
232232
*/
233233
error FinalizationStateIncorrect(bytes32 expected, bytes32 value);
234234

235-
/**
236-
* @dev Thrown when the final block number in finalization data is less than or equal to the last finalized block during finalization.
237-
*/
238-
error FinalBlockNumberLessThanOrEqualToLastFinalizedBlock(uint256 finalBlockNumber, uint256 lastFinalizedBlock);
239-
240235
/**
241236
* @dev Thrown when the final block state equals the zero hash during finalization.
242237
*/

0 commit comments

Comments
 (0)