Skip to content

Commit 09de966

Browse files
committed
feat(light-client): Restrict lightClientUpdate function
1 parent b145cff commit 09de966

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

beacon-light-client/solidity/contracts/bridge/src/interfaces/ILightClient.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity 0.8.9;
2+
pragma solidity 0.8.20;
33

44
interface ILightClient {
55
struct LightClientUpdate {
@@ -32,5 +32,5 @@ interface ILightClient {
3232

3333
function lightClientUpdate(
3434
LightClientUpdate calldata update
35-
) external payable;
35+
) external;
3636
}

beacon-light-client/solidity/contracts/bridge/src/truth/eth/BeaconLightClient.sol

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity 0.8.9;
2+
pragma solidity 0.8.20;
33

44
import '../../utils/LightClientUpdateVerifier.sol';
55
import '../../interfaces/ILightClient.sol';
6+
import '@openzeppelin/contracts/access/Ownable.sol';
67

78
uint256 constant BUFER_SIZE = 32;
89

9-
contract BeaconLightClient is LightClientUpdateVerifier, ILightClient {
10+
contract BeaconLightClient is Ownable, LightClientUpdateVerifier, ILightClient {
1011
bytes32[BUFER_SIZE] public optimisticHeaders;
1112

1213
uint256[BUFER_SIZE] public optimisticSlots;
@@ -25,7 +26,7 @@ contract BeaconLightClient is LightClientUpdateVerifier, ILightClient {
2526
bytes32 _finalizedHeaderRoot,
2627
bytes32 _executionStateRoot,
2728
bytes32 _domain
28-
) {
29+
) Ownable(msg.sender) {
2930
currentIndex = 0;
3031

3132
optimisticHeaders[currentIndex] = _optimisticHeaderRoot;
@@ -51,11 +52,9 @@ contract BeaconLightClient is LightClientUpdateVerifier, ILightClient {
5152
return executionStateRoots[currentIndex];
5253
}
5354

54-
// TODO: fix name to lightClientUpdate
55-
function lightClientUpdate(LightClientUpdate calldata update)
56-
external
57-
payable
58-
{
55+
function lightClientUpdate(
56+
LightClientUpdate calldata update
57+
) external onlyOwner {
5958
require(
6059
verifyUpdate(
6160
update.a,

beacon-light-client/solidity/contracts/bridge/src/utils/LightClientUpdateVerifier.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity 0.8.9;
2+
pragma solidity 0.8.20;
33

44
import './Verifier.sol';
55

0 commit comments

Comments
 (0)