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 N09 renaming #307

Merged
merged 2 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 @@ -7,13 +7,13 @@ import {L2CanonicalTransaction} from "../common/Messaging.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
/// @param _governor address who can manage non-critical updates in the contract
/// @param _owner address who can manage non-critical updates in the contract
/// @param _validatorTimelock address that serves as consensus, i.e. can submit blocks to be processed
/// @param _genesisBatchHash Batch hash of the genesis (initial) batch
/// @param _genesisIndexRepeatedStorageChanges The serial number of the shortcut storage key for genesis batch
/// @param _genesisBatchCommitment The zk-proof commitment for the genesis batch
struct StateTransitionManagerInitializeData {
address governor;
address owner;
address validatorTimelock;
address genesisUpgrade;
bytes32 genesisBatchHash;
Expand All @@ -25,7 +25,7 @@ struct StateTransitionManagerInitializeData {

interface IStateTransitionManager {
// when a new Chain is added
event StateTransitionNewChain(uint256 indexed _chainId, address indexed _stateTransitionContract);
event NewHyperchain(uint256 indexed _chainId, address indexed _stateTransitionContract);

event SetChainIdUpgrade(
address indexed _stateTransitionChain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own
function initialize(
StateTransitionManagerInitializeData calldata _initializeData
) external reentrancyGuardInitializer {
require(_initializeData.governor != address(0), "StateTransition: governor zero");
_transferOwnership(_initializeData.governor);
require(_initializeData.owner != address(0), "StateTransition: owner zero");
_transferOwnership(_initializeData.owner);

genesisUpgrade = _initializeData.genesisUpgrade;
protocolVersion = _initializeData.protocolVersion;
Expand Down Expand Up @@ -232,7 +232,7 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own
address _stateTransitionContract
) external onlyOwner {
stateTransition[_chainId] = _stateTransitionContract;
emit StateTransitionNewChain(_chainId, _stateTransitionContract);
emit NewHyperchain(_chainId, _stateTransitionContract);
}

/// @notice called by Bridgehub when a chain registers
Expand Down Expand Up @@ -284,6 +284,6 @@ contract StateTransitionManager is IStateTransitionManager, ReentrancyGuard, Own
// set chainId in VM
_setChainIdUpgrade(_chainId, stateTransitionAddress);

emit StateTransitionNewChain(_chainId, stateTransitionAddress);
emit NewHyperchain(_chainId, stateTransitionAddress);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ contract AdminFacet is ZkSyncStateTransitionBase, IAdmin {
emit NewBaseTokenMultiplier(oldNominator, oldDenominator, _nominator, _denominator);
}

function setValidiumMode(PubdataPricingMode _validiumMode) external onlyAdmin {
function setPubdataPricingMode(PubdataPricingMode _pricingMode) external onlyAdmin {
require(s.totalBatchesCommitted == 0, "AdminFacet: set validium only after genesis"); // Validium mode can be set only before the first batch is committed
s.feeParams.pubdataPricingMode = _validiumMode;
emit ValidiumModeStatusUpdate(_validiumMode);
s.feeParams.pubdataPricingMode = _pricingMode;
emit ValidiumModeStatusUpdate(_pricingMode);
}

/*//////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ contract MailboxFacet is ZkSyncStateTransitionBase, IMailbox {
require(s.chainId == ERA_CHAIN_ID, "transferEthToSharedBridge only available for Era on mailbox");

uint256 amount = address(this).balance;
address sharedBridgeAddress = s.baseTokenBridge;
IL1SharedBridge(sharedBridgeAddress).receiveEth{value: amount}(ERA_CHAIN_ID);
address baseTokenBridgeAddress = s.baseTokenBridge;
IL1SharedBridge(baseTokenBridgeAddress).receiveEth{value: amount}(ERA_CHAIN_ID);
}

/// @notice when requesting transactions through the bridgehub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract ZkSyncStateTransitionBase is ReentrancyGuard {
}

modifier onlyBaseTokenBridge() {
require(msg.sender == s.baseTokenBridge, "Only shared bridge can call this function");
require(msg.sender == s.baseTokenBridge, "Only base token bridge can call this function");
_;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ interface IAdmin is IZkSyncStateTransitionBase {
/// @notice Change the token multiplier for L1->L2 transactions
function setTokenMultiplier(uint128 _nominator, uint128 _denominator) external;

/// @notice Used to set to validium directly after genesis
function setValidiumMode(PubdataPricingMode _validiumMode) external;
/// @notice Used to set to validium mode directly after genesis (rollup is default)
function setPubdataPricingMode(PubdataPricingMode _pricingMode) external;

function upgradeChainFromVersion(uint256 _protocolVersion, Diamond.DiamondCutData calldata _cutData) external;

Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/src.ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class Deployer {

const initCalldata = stateTransitionManager.encodeFunctionData("initialize", [
{
governor: this.ownerAddress,
owner: this.ownerAddress,
validatorTimelock: this.addresses.ValidatorTimeLock,
genesisUpgrade: this.addresses.StateTransition.GenesisUpgrade,
genesisBatchHash,
Expand Down Expand Up @@ -664,7 +664,7 @@ export class Deployer {
const diamondProxyAddress =
"0x" +
receipt.logs
.find((log) => log.topics[0] == stateTransitionManager.interface.getEventTopic("StateTransitionNewChain"))
.find((log) => log.topics[0] == stateTransitionManager.interface.getEventTopic("NewHyperchain"))
.topics[2].slice(26);
this.addresses.StateTransition.DiamondProxy = diamondProxyAddress;
if (this.verbose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Diamond} from "solpp/state-transition/libraries/Diamond.sol";
contract initializingSTMGovernorZeroTest is StateTransitionManagerTest {
function test_InitializingSTMWithGovernorZeroShouldRevert() public {
StateTransitionManagerInitializeData memory stmInitializeDataNoGovernor = StateTransitionManagerInitializeData({
governor: address(0),
owner: address(0),
validatorTimelock: validator,
genesisUpgrade: address(genesisUpgradeContract),
genesisBatchHash: bytes32(""),
Expand All @@ -20,7 +20,7 @@ contract initializingSTMGovernorZeroTest is StateTransitionManagerTest {
protocolVersion: 0
});

vm.expectRevert(bytes("StateTransition: governor zero"));
vm.expectRevert(bytes("StateTransition: owner zero"));
new TransparentUpgradeableProxy(
address(stateTransitionManager),
admin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract StateTransitionManagerTest is Test {
);

StateTransitionManagerInitializeData memory stmInitializeDataNoGovernor = StateTransitionManagerInitializeData({
governor: address(0),
owner: address(0),
validatorTimelock: validator,
genesisUpgrade: address(genesisUpgradeContract),
genesisBatchHash: bytes32(""),
Expand All @@ -89,15 +89,15 @@ contract StateTransitionManagerTest is Test {
protocolVersion: 0
});

vm.expectRevert(bytes.concat("StateTransition: governor zero"));
vm.expectRevert(bytes.concat("StateTransition: owner zero"));
new TransparentUpgradeableProxy(
address(stateTransitionManager),
admin,
abi.encodeCall(StateTransitionManager.initialize, stmInitializeDataNoGovernor)
);

StateTransitionManagerInitializeData memory stmInitializeData = StateTransitionManagerInitializeData({
governor: governor,
owner: governor,
validatorTimelock: validator,
genesisUpgrade: address(genesisUpgradeContract),
genesisBatchHash: bytes32(""),
Expand Down
Loading