From 1c5c124d6458a17051a28d96390ee1a38d624227 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Fri, 23 Aug 2024 12:33:55 +0200 Subject: [PATCH] Add check if contract is constructing --- system-contracts/contracts/EvmGasManager.sol | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system-contracts/contracts/EvmGasManager.sol b/system-contracts/contracts/EvmGasManager.sol index e165043b1..f4ea2ba21 100644 --- a/system-contracts/contracts/EvmGasManager.sol +++ b/system-contracts/contracts/EvmGasManager.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import "./EvmConstants.sol"; +import "./libraries/Utils.sol"; import {ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT} from "./Constants.sol"; @@ -42,10 +43,13 @@ contract EvmGasManager { } if (!isEVM) { - isEVM = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.isAccountEVM(msg.sender); + bytes32 bytecodeHash = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(msg.sender); + isEVM = Utils.isCodeHashEVM(bytecodeHash); if (isEVM) { - assembly { - tstore(transient_slot, isEVM) + if (!Utils.isContractConstructing(bytecodeHash)) { + assembly { + tstore(transient_slot, isEVM) + } } } }