@@ -174,13 +174,14 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
174
174
function getVersion ()
175
175
public
176
176
pure
177
+ virtual
177
178
returns (uint8 majorVersion , uint8 minorVersion , uint8 patchVersion )
178
179
{
179
180
return (1 , 0 , 0 );
180
181
}
181
182
182
183
/// @notice only the owner can authorize an upgrade
183
- function _authorizeUpgrade (address newImplementation ) internal override onlyOwner {
184
+ function _authorizeUpgrade (address newImplementation ) internal virtual override onlyOwner {
184
185
emit Upgrade (newImplementation);
185
186
}
186
187
@@ -237,7 +238,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
237
238
function newFinalizedState (
238
239
LightClientState memory newState ,
239
240
IPlonkVerifier.PlonkProof memory proof
240
- ) external {
241
+ ) external virtual {
241
242
//revert if we're in permissionedProver mode and the permissioned prover has not been set
242
243
if (permissionedProverEnabled && msg .sender != permissionedProver) {
243
244
if (permissionedProver == address (0 )) {
@@ -287,12 +288,12 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
287
288
}
288
289
289
290
/// @dev Simple getter function for the genesis state
290
- function getGenesisState () public view returns (LightClientState memory ) {
291
+ function getGenesisState () public view virtual returns (LightClientState memory ) {
291
292
return states[genesisState];
292
293
}
293
294
294
295
/// @dev Simple getter function for the finalized state
295
- function getFinalizedState () public view returns (LightClientState memory ) {
296
+ function getFinalizedState () public view virtual returns (LightClientState memory ) {
296
297
return states[finalizedState];
297
298
}
298
299
@@ -322,7 +323,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
322
323
323
324
/// @notice Advance to the next epoch (without any precondition check!)
324
325
/// @dev This meant to be invoked only internally after appropriate precondition checks are done
325
- function _advanceEpoch () private {
326
+ function _advanceEpoch () internal virtual {
326
327
bytes32 newStakeTableComm = computeStakeTableComm (states[finalizedState]);
327
328
votingStakeTableCommitment = frozenStakeTableCommitment;
328
329
frozenStakeTableCommitment = newStakeTableComm;
@@ -335,7 +336,12 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
335
336
}
336
337
337
338
/// @notice Given the light client state, compute the short commitment of the stake table
338
- function computeStakeTableComm (LightClientState memory state ) public pure returns (bytes32 ) {
339
+ function computeStakeTableComm (LightClientState memory state )
340
+ public
341
+ pure
342
+ virtual
343
+ returns (bytes32 )
344
+ {
339
345
return keccak256 (
340
346
abi.encodePacked (
341
347
state.stakeTableBlsKeyComm,
@@ -349,7 +355,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
349
355
/// non-zero address provided
350
356
/// @dev this function can also be used to update the permissioned prover once it's a different
351
357
/// address
352
- function setPermissionedProver (address prover ) public onlyOwner {
358
+ function setPermissionedProver (address prover ) public virtual onlyOwner {
353
359
if (prover == address (0 )) {
354
360
revert InvalidAddress ();
355
361
}
@@ -363,7 +369,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
363
369
364
370
/// @notice set the permissionedProverMode to false and set the permissionedProver to address(0)
365
371
/// @dev if it was already disabled (permissioneProverMode == false), then revert with
366
- function disablePermissionedProverMode () public onlyOwner {
372
+ function disablePermissionedProverMode () public virtual onlyOwner {
367
373
if (permissionedProverEnabled) {
368
374
permissionedProver = address (0 );
369
375
permissionedProverEnabled = false ;
@@ -419,7 +425,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
419
425
}
420
426
421
427
/// @notice get the number of L1 block updates
422
- function getStateUpdateBlockNumbersCount () public view returns (uint256 ) {
428
+ function getStateUpdateBlockNumbersCount () public view virtual returns (uint256 ) {
423
429
return stateUpdateBlockNumbers.length ;
424
430
}
425
431
@@ -429,6 +435,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
429
435
function getHotShotCommitment (uint256 hotShotBlockHeight )
430
436
public
431
437
view
438
+ virtual
432
439
returns (HotShotCommitment memory )
433
440
{
434
441
uint256 commitmentsHeight = hotShotCommitments.length ;
@@ -447,7 +454,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable {
447
454
}
448
455
449
456
/// @notice get the number of HotShot block commitments
450
- function getHotShotBlockCommitmentsCount () public view returns (uint256 ) {
457
+ function getHotShotBlockCommitmentsCount () public view virtual returns (uint256 ) {
451
458
return hotShotCommitments.length ;
452
459
}
453
460
}
0 commit comments