Skip to content

Commit

Permalink
Remove unneded changes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Sep 23, 2024
1 parent 4892af8 commit 2f6ea06
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 78 deletions.
4 changes: 2 additions & 2 deletions system-contracts/contracts/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {ICompressor} from "./interfaces/ICompressor.sol";
import {IComplexUpgrader} from "./interfaces/IComplexUpgrader.sol";
import {IBootloaderUtilities} from "./interfaces/IBootloaderUtilities.sol";
import {IPubdataChunkPublisher} from "./interfaces/IPubdataChunkPublisher.sol";
import "./EvmGasManager.sol";
import {IEvmGasManager} from "./interfaces/IEvmGasManager.sol";

/// @dev All the system contracts introduced by ZKsync have their addresses
/// started from 2^15 in order to avoid collision with Ethereum precompiles.
Expand Down Expand Up @@ -85,7 +85,7 @@ address constant EVENT_WRITER_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x0d)
ICompressor constant COMPRESSOR_CONTRACT = ICompressor(address(SYSTEM_CONTRACTS_OFFSET + 0x0e));

IComplexUpgrader constant COMPLEX_UPGRADER_CONTRACT = IComplexUpgrader(address(SYSTEM_CONTRACTS_OFFSET + 0x0f));
EvmGasManager constant EVM_GAS_MANAGER = EvmGasManager(address(SYSTEM_CONTRACTS_OFFSET + 0x13));
IEvmGasManager constant EVM_GAS_MANAGER = IEvmGasManager(address(SYSTEM_CONTRACTS_OFFSET + 0x13));

IPubdataChunkPublisher constant PUBDATA_CHUNK_PUBLISHER = IPubdataChunkPublisher(
address(SYSTEM_CONTRACTS_OFFSET + 0x11)
Expand Down
10 changes: 1 addition & 9 deletions system-contracts/contracts/ContractDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,7 @@ contract ContractDeployer is IContractDeployer, SystemContractBase {
}

// In case of EVM contracts returnData is the new deployed code
bool success = SystemContractHelper.mimicCall(uint32(gasleft()), _newAddress, msg.sender, _input, true, false);

if (!success) {
assembly {
// Just propagate the error back
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
EfficientCall.mimicCall(uint32(gasleft()), _newAddress, _input, msg.sender, true, false);

bytes32 codeHash = _getEvmCodeHash(_newAddress);
require(codeHash != 0x0, "The code hash must be set after the constructor call");
Expand Down
2 changes: 0 additions & 2 deletions system-contracts/contracts/NonceHolder.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT

// solhint-disable reason-string, gas-custom-errors

pragma solidity 0.8.24;

import {INonceHolder} from "./interfaces/INonceHolder.sol";
Expand Down
2 changes: 0 additions & 2 deletions system-contracts/contracts/interfaces/IContractDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ interface IContractDeployer {

event AccountVersionUpdated(address indexed accountAddress, AccountAbstractionVersion aaVersion);

event EVMProxyHashUpdated(bytes32 indexed oldHash, bytes32 indexed newHash);

function getNewAddressCreate2(
address _sender,
bytes32 _bytecodeHash,
Expand Down
25 changes: 0 additions & 25 deletions system-contracts/contracts/interfaces/IEvmGasManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,12 @@
pragma solidity ^0.8.20;

interface IEvmGasManager {
// We need trust to use `storage` pointers
struct WarmAccountInfo {
bool isWarm;
}

struct SlotInfo {
bool warm;
uint256 originalValue;
}

// We dont care about the size, since none of it will be stored/pub;ushed anyway.
struct EVMStackFrameInfo {
bool isStatic;
uint256 passGas;
}

function warmAccount(address account) external payable returns (bool wasWarm);

function isSlotWarm(uint256 _slot) external view returns (bool);

function warmSlot(uint256 _slot, uint256 _currentValue) external payable returns (bool, uint256);

/*
The flow is the following:
When conducting call:
1. caller calls to an EVM contract pushEVMFrame with the corresponding gas
2. callee calls consumeEvmFrame to get the gas & make sure that subsequent callee won't be able to read it.
3. callee sets the return gas
4. callee calls popEVMFrame to return the gas to the caller & remove the frame
*/

function pushEVMFrame(uint256 _passGas, bool _isStatic) external;

function consumeEvmFrame() external returns (uint256 passGas, bool isStatic);
Expand Down
36 changes: 0 additions & 36 deletions system-contracts/contracts/libraries/SystemContractHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -359,40 +359,4 @@ library SystemContractHelper {
revert FailedToChargeGas();
}
}

function mimicCall(
uint32 gasLimit,
address to,
address whoToMimic,
bytes memory data,
bool isConstructorCall,
bool isSystemCall
) internal returns (bool success) {
address callAddr = MIMIC_CALL_CALL_ADDRESS;

uint32 dataStart;
assembly {
dataStart := add(data, 0x20)
}
uint32 dataLength = uint32(Utils.safeCastToU32(data.length));

// solhint-disable func-named-parameters
uint256 farCallAbi = SystemContractsCaller.getFarCallABI(
0,
0,
dataStart,
dataLength,
gasLimit,
// Only rollup is supported for now
0,
CalldataForwardingMode.UseHeap,
isConstructorCall,
isSystemCall
);

// Doing the system call directly
assembly {
success := call(to, callAddr, 0, farCallAbi, whoToMimic, 0, 0)
}
}
}
2 changes: 0 additions & 2 deletions system-contracts/contracts/libraries/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// We use a floating point pragma here so it can be used within other projects that interact with the ZKsync ecosystem without using our exact pragma version.
pragma solidity ^0.8.20;

// solhint-disable gas-custom-errors

import {EfficientCall} from "./EfficientCall.sol";
import {RLPEncoder} from "./RLPEncoder.sol";
import {MalformedBytecode, BytecodeError, Overflow} from "../SystemContractErrors.sol";
Expand Down

0 comments on commit 2f6ea06

Please sign in to comment.