-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate state proof and megapool work
- Loading branch information
1 parent
a37f149
commit 95ecece
Showing
15 changed files
with
298 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity 0.8.18; | ||
|
||
import "../../interface/RocketStorageInterface.sol"; | ||
import "../../interface/util/BeaconStateVerifierInterface.sol"; | ||
import {BeaconStateVerifier} from "../util/BeaconStateVerifier.sol"; | ||
|
||
/// @dev NOT USED IN PRODUCTION - This contract only exists to bypass state proofs during tests | ||
contract BeaconStateVerifierMock is BeaconStateVerifierInterface { | ||
bool private disabled = false; | ||
|
||
BeaconStateVerifierInterface private immutable verifier; | ||
|
||
constructor(RocketStorageInterface _rocketStorageAddress) { | ||
verifier = new BeaconStateVerifier(_rocketStorageAddress); | ||
} | ||
|
||
function setDisabled(bool _disabled) external { | ||
disabled = _disabled; | ||
} | ||
|
||
function verifyValidator(ValidatorProof calldata _proof) override external view returns(bool) { | ||
if (disabled) { | ||
return true; | ||
} | ||
return verifier.verifyValidator(_proof); | ||
} | ||
|
||
function verifyExit(uint256 _validatorIndex, uint256 _withdrawableEpoch, uint64 _slot, bytes32[] calldata _proof) override external view returns(bool) { | ||
if (disabled) { | ||
return true; | ||
} | ||
return verifier.verifyExit(_validatorIndex, _withdrawableEpoch, _slot, _proof); | ||
} | ||
|
||
function verifyWithdrawal(uint256 _validatorIndex, uint64 _withdrawalSlot, uint256 _withdrawalNum, Withdrawal calldata _withdrawal, uint64 _slot, bytes32[] calldata _proof) override external view returns(bool) { | ||
if (disabled) { | ||
return true; | ||
} | ||
return verifier.verifyWithdrawal(_validatorIndex, _withdrawalSlot, _withdrawalNum, _withdrawal, _slot, _proof); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.