Skip to content

Commit

Permalink
fix(EVM): Check bytecodehash version in create functions of ContractD…
Browse files Browse the repository at this point in the history
…eployer (#1182)
  • Loading branch information
0xVolosnikov authored Jan 3, 2025
1 parent 969886c commit b194c86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system-contracts/contracts/ContractDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Utils} from "./libraries/Utils.sol";
import {EfficientCall} from "./libraries/EfficientCall.sol";
import {SystemContractHelper} from "./libraries/SystemContractHelper.sol";
import {SystemContractBase} from "./abstract/SystemContractBase.sol";
import {Unauthorized, InvalidNonceOrderingChange, ValueMismatch, EmptyBytes32, EVMEmulationNotSupported, NotAllowedToDeployInKernelSpace, HashIsNonZero, NonEmptyAccount, UnknownCodeHash, NonEmptyMsgValue} from "./SystemContractErrors.sol";
import {Unauthorized, InvalidNonceOrderingChange, ValueMismatch, EmptyBytes32, EVMBytecodeHash, EVMEmulationNotSupported, NotAllowedToDeployInKernelSpace, HashIsNonZero, NonEmptyAccount, UnknownCodeHash, NonEmptyMsgValue} from "./SystemContractErrors.sol";

/**
* @author Matter Labs
Expand Down Expand Up @@ -398,6 +398,9 @@ contract ContractDeployer is IContractDeployer, SystemContractBase {
if (_bytecodeHash == bytes32(0x0)) {
revert EmptyBytes32();
}
if (Utils.isCodeHashEVM(_bytecodeHash)) {
revert EVMBytecodeHash();
}
if (uint160(_newAddress) <= MAX_SYSTEM_CONTRACT_ADDRESS) {
revert NotAllowedToDeployInKernelSpace();
}
Expand Down
2 changes: 2 additions & 0 deletions system-contracts/contracts/SystemContractErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ error EmptyVirtualBlocks();
error EncodedAndRealBytecodeChunkNotEqual(uint64 expected, uint64 provided);
// 0x2bfbfc11
error EncodedLengthNotFourTimesSmallerThanOriginal();
// 0x39bae0e6
error EVMBytecodeHash();
// 0xb9e6e31f
error EVMEmulationNotSupported();
// 0xe95a1fbe
Expand Down

0 comments on commit b194c86

Please sign in to comment.