Skip to content

Commit cbca22b

Browse files
authored
feat(validium): Toggle require proof in mock contract (#149)
1 parent 2f8f2a2 commit cbca22b

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/mocks/ScrollChainValidiumMock.sol

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,51 @@ import {IL1MessageQueueV2} from "../L1/rollup/IL1MessageQueueV2.sol";
66

77
import {ScrollChainValidium} from "../validium/ScrollChainValidium.sol";
88

9+
/// @title ScrollChainValidiumMock
10+
/// @dev This contract should only be deployed on testnet.
911
contract ScrollChainValidiumMock is ScrollChainValidium {
12+
/*********************
13+
* Storage Variables *
14+
*********************/
15+
16+
/// @notice If set to false, we allow finalizing bundles with an arbitrary (or empty) proof.
17+
bool public requireProof;
18+
19+
/***************
20+
* Constructor *
21+
***************/
22+
1023
constructor(
1124
uint64 _chainId,
1225
address _messageQueueV2,
1326
address _verifier
1427
) ScrollChainValidium(_chainId, _messageQueueV2, _verifier) {}
1528

29+
/************************
30+
* Restricted Functions *
31+
************************/
32+
33+
function setRequireProof(bool _requireProof) external onlyRole(DEFAULT_ADMIN_ROLE) {
34+
requireProof = _requireProof;
35+
}
36+
37+
/**********************
38+
* Internal Functions *
39+
**********************/
40+
1641
/// @dev Internal function to finalize a bundle.
1742
/// @param batchHeader The header of the last batch in this bundle.
1843
/// @param totalL1MessagesPoppedOverall The number of messages processed after this bundle.
44+
/// @param aggrProof The bundle proof for this bundle.
1945
function _finalizeBundle(
2046
bytes calldata batchHeader,
2147
uint256 totalL1MessagesPoppedOverall,
22-
bytes calldata
48+
bytes calldata aggrProof
2349
) internal virtual override {
50+
if (requireProof) {
51+
return super._finalizeBundle(batchHeader, totalL1MessagesPoppedOverall, aggrProof);
52+
}
53+
2454
// actions before verification
2555
(, bytes32 batchHash, uint256 batchIndex, ) = _beforeFinalizeBatch(batchHeader);
2656

src/validium/ScrollChainValidium.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ contract ScrollChainValidium is AccessControlUpgradeable, PausableUpgradeable, I
112112
/// @dev An array of encryption keys.
113113
EncryptionKey[] public encryptionKeys;
114114

115+
/// @dev The storage slots reserved for future usage.
116+
uint256[50] private __gap;
117+
115118
/***************
116119
* Constructor *
117120
***************/

0 commit comments

Comments
 (0)