diff --git a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifier.sol b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifier.sol index 8371738e9..ef42f119d 100644 --- a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifier.sol +++ b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifier.sol @@ -6,9 +6,6 @@ import {IBalanceVerifier} from './interfaces/IBalanceVerifierDiva.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; abstract contract BalanceVerifier is Ownable, IBalanceVerifier { - /// @notice the verifierDigest of the plonky2 circuit - uint256 public immutable VERIFIER_DIGEST; - /// @notice The genesis block timestamp. uint256 public immutable GENESIS_BLOCK_TIMESTAMP; @@ -22,19 +19,26 @@ abstract contract BalanceVerifier is Ownable, IBalanceVerifier { address internal verifier; + /// @notice the verifierDigest of the plonky2 circuit + uint256 public verifierDigest; + constructor( - uint256 verifierDigest, + uint256 _verifierDigest, uint256 genesisBlockTimestamp, address _verifier, address _owner ) Ownable(_owner) { - VERIFIER_DIGEST = verifierDigest; + verifierDigest = _verifierDigest; GENESIS_BLOCK_TIMESTAMP = genesisBlockTimestamp; verifier = _verifier; } - function setVerifier(address _verifier) external override onlyOwner { + function setVerifier( + address _verifier, + uint256 newVerifierDigest + ) external override onlyOwner { verifier = _verifier; + verifierDigest = newVerifierDigest; } /// @notice Verifies the proof and writes the data for given slot if valid diff --git a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierDiva.sol b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierDiva.sol index 76b63b4d5..545404c48 100644 --- a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierDiva.sol +++ b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierDiva.sol @@ -42,7 +42,7 @@ contract BalanceVerifierDiva is BalanceVerifier, IBalanceVerifierDiva { .findAccumulatorByBlock(blockNumber); uint256[] memory publicInputs = new uint256[](2); - publicInputs[0] = VERIFIER_DIGEST; + publicInputs[0] = verifierDigest; publicInputs[1] = (uint256( sha256( abi.encodePacked( diff --git a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierLido.sol b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierLido.sol index 1b9d9b21a..cc8ad94c2 100644 --- a/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierLido.sol +++ b/beacon-light-client/solidity/contracts/balance_verifier/BalanceVerifierLido.sol @@ -37,7 +37,7 @@ contract BalanceVerifierLido is BalanceVerifier, IBalanceVerifierLido { uint64 _numberOfSlashedValidators ) external override { uint256[] memory publicInputs = new uint256[](2); - publicInputs[0] = VERIFIER_DIGEST; + publicInputs[0] = verifierDigest; publicInputs[1] = (uint256( sha256( abi.encodePacked( diff --git a/beacon-light-client/solidity/contracts/balance_verifier/interfaces/IBalanceVerifier.sol b/beacon-light-client/solidity/contracts/balance_verifier/interfaces/IBalanceVerifier.sol index 08f58becf..43eb5cb4c 100644 --- a/beacon-light-client/solidity/contracts/balance_verifier/interfaces/IBalanceVerifier.sol +++ b/beacon-light-client/solidity/contracts/balance_verifier/interfaces/IBalanceVerifier.sol @@ -14,5 +14,5 @@ interface IBalanceVerifier { /// @dev Verification failed error VerificationFailed(); - function setVerifier(address newVerifier) external; + function setVerifier(address newVerifier, uint256 newVerifierDigest) external; }