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 L03 #296

Merged
merged 5 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 @@ -4,6 +4,7 @@ pragma solidity 0.8.20;

import {Diamond} from "./libraries/Diamond.sol";
import {L2CanonicalTransaction} from "../common/Messaging.sol";
import {FeeParams} from "./chain-deps/ZkSyncStateTransitionStorage.sol";

/// @notice Struct that holds all data needed for initializing STM Proxy.
/// @dev We use struct instead of raw parameters in `initialize` function to prevent "Stack too deep" error
Expand Down Expand Up @@ -92,4 +93,22 @@ interface IStateTransitionManager {
function freezeChain(uint256 _chainId) external;

function unfreezeChain(uint256 _chainId) external;

function upgradeChainFromVersion(
uint256 _chainId,
uint256 _oldProtocolVersion,
Diamond.DiamondCutData calldata _diamondCut
) external;

function executeUpgrade(uint256 _chainId, Diamond.DiamondCutData calldata _diamondCut) external;

function setPriorityTxMaxGasLimit(uint256 _chainId, uint256 _maxGasLimit) external;

function setTokenMultiplier(uint256 _chainId, uint128 _nominator, uint128 _denominator) external;

function changeFeeParams(uint256 _chainId, FeeParams calldata _newFeeParams) external;

function setValidator(uint256 _chainId, address _validator, bool _active) external;

function setPorterAvailability(uint256 _chainId, bool _zkPorterIsAvailable) external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {IExecutor} from "./chain-interfaces/IExecutor.sol";
import {IStateTransitionManager, StateTransitionManagerInitializeData} from "./IStateTransitionManager.sol";
import {ISystemContext} from "./l2-deps/ISystemContext.sol";
import {IZkSyncStateTransition} from "./chain-interfaces/IZkSyncStateTransition.sol";
import {FeeParams} from "./chain-deps/ZkSyncStateTransitionStorage.sol";
import {L2_SYSTEM_CONTEXT_SYSTEM_CONTRACT_ADDR, L2_FORCE_DEPLOYER_ADDR} from "../common/L2ContractAddresses.sol";
import {L2CanonicalTransaction} from "../common/Messaging.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
Expand Down Expand Up @@ -171,6 +172,45 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own
IZkSyncStateTransition(stateTransition[_chainId]).revertBatches(_newLastBatch);
}

/// @dev execute predefined upgrade
function upgradeChainFromVersion(
uint256 _chainId,
uint256 _oldProtocolVersion,
Diamond.DiamondCutData calldata _diamondCut
) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).upgradeChainFromVersion(_oldProtocolVersion, _diamondCut);
}

/// @dev executes upgrade on chain
function executeUpgrade(uint256 _chainId, Diamond.DiamondCutData calldata _diamondCut) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).executeUpgrade(_diamondCut);
}

/// @dev setPriorityTxMaxGasLimit for the specified chain
function setPriorityTxMaxGasLimit(uint256 _chainId, uint256 _maxGasLimit) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).setPriorityTxMaxGasLimit(_maxGasLimit);
}

/// @dev setTokenMultiplier for the specified chain
function setTokenMultiplier(uint256 _chainId, uint128 _nominator, uint128 _denominator) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).setTokenMultiplier(_nominator, _denominator);
}

/// @dev changeFeeParams for the specified chain
function changeFeeParams(uint256 _chainId, FeeParams calldata _newFeeParams) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).changeFeeParams(_newFeeParams);
}

/// @dev setValidator for the specified chain
function setValidator(uint256 _chainId, address _validator, bool _active) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).setValidator(_validator, _active);
}

/// @dev setPorterAvailability for the specified chain
function setPorterAvailability(uint256 _chainId, bool _zkPorterIsAvailable) external onlyOwner {
IZkSyncStateTransition(stateTransition[_chainId]).setPorterAvailability(_zkPorterIsAvailable);
}

/// registration

/// @dev we have to set the chainId at genesis, as blockhashzero is the same for all chains with the same chainId
Expand Down
Loading