Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kl OZ fix L02 #295

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ interface IStateTransitionManager {
/// @notice Admin changed
event NewAdmin(address indexed oldAdmin, address indexed newAdmin);

/// @notice ValidatorTimelock changed
event NewValidatorTimelock(address indexed oldValidatorTimelock, address indexed newValidatorTimelock);

/// @notice InitialCutHash changed
event NewInitialCutHash(bytes32 indexed oldInitialCutHash, bytes32 indexed newInitialCutHash);

/// @notice new UpgradeCutHash
event NewUpgradeCutHash(uint256 indexed protocolVersion, bytes32 indexed upgradeCutHash);

/// @notice new ProtocolVersion
event NewProtocolVersion(uint256 indexed oldProtocolVersion, uint256 indexed newProtocolVersion);

function bridgehub() external view returns (address);

/// @notice Starts the transfer of admin rights. Only the current admin can propose a new pending one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,17 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own

/// @dev set validatorTimelock. Cannot do it an initialization, as validatorTimelock is deployed after STM
function setValidatorTimelock(address _validatorTimelock) external onlyOwnerOrAdmin {
address oldValidatorTimelock = validatorTimelock;
validatorTimelock = _validatorTimelock;
emit NewValidatorTimelock(oldValidatorTimelock, _validatorTimelock);
}

/// @dev set initial cutHash
function setInitialCutHash(Diamond.DiamondCutData calldata _diamondCut) external onlyOwner {
initialCutHash = keccak256(abi.encode(_diamondCut));
bytes32 oldInitialCutHash = initialCutHash;
bytes32 newCutHash = keccak256(abi.encode(_diamondCut));
initialCutHash = newCutHash;
emit NewInitialCutHash(oldInitialCutHash, newCutHash);
}

/// @dev set New Version with upgrade from old version
Expand All @@ -144,16 +149,22 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own
uint256 _oldProtocolVersion,
uint256 _newProtocolVersion
) external onlyOwner {
upgradeCutHash[_oldProtocolVersion] = keccak256(abi.encode(_cutData));
bytes32 newCutHash = keccak256(abi.encode(_cutData));
upgradeCutHash[_oldProtocolVersion] = newCutHash;
uint256 previousProtocolVersion = protocolVersion;
protocolVersion = _newProtocolVersion;
emit NewProtocolVersion(previousProtocolVersion, _newProtocolVersion);
emit NewUpgradeCutHash(_oldProtocolVersion, newCutHash);
}

/// @dev set upgrade for some protocolVersion
function setUpgradeDiamondCut(
Diamond.DiamondCutData calldata _cutData,
uint256 _oldProtocolVersion
) external onlyOwner {
upgradeCutHash[_oldProtocolVersion] = keccak256(abi.encode(_cutData));
bytes32 newCutHash = keccak256(abi.encode(_cutData));
upgradeCutHash[_oldProtocolVersion] = newCutHash;
emit NewUpgradeCutHash(_oldProtocolVersion, newCutHash);
}

/// @dev freezes the specified chain
Expand Down
Loading