Skip to content

Commit

Permalink
chore: Initial cleanup in EvmInterpreter (#33)
Browse files Browse the repository at this point in the history
* Cleanup EvmInterpreterFunctions

* Cleanup in logs

* Remove unneded changes

* Use rawMimicCall
  • Loading branch information
0xVolosnikov authored Sep 23, 2024
1 parent 2edbd69 commit 62e0e04
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 493 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
16 changes: 9 additions & 7 deletions system-contracts/contracts/ContractDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,17 @@ contract ContractDeployer is IContractDeployer, SystemContractBase {
SystemContractHelper.setValueForNextFarCall(uint128(value));
}

// In case of EVM contracts returnData is the new deployed code
bool success = SystemContractHelper.mimicCall(uint32(gasleft()), _newAddress, msg.sender, _input, true, false);
bool success = EfficientCall.rawMimicCall({
_gas: uint32(gasleft()),
_address: _newAddress,
_data: _input,
_whoToMimic: msg.sender,
_isConstructor: true,
_isSystem: false
});

if (!success) {
assembly {
// Just propagate the error back
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
EfficientCall.propagateRevert();
}

bytes32 codeHash = _getEvmCodeHash(_newAddress);
Expand Down
Loading

0 comments on commit 62e0e04

Please sign in to comment.