Skip to content

Commit

Permalink
Add check if contract is constructing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Aug 23, 2024
1 parent 19f0e0d commit 1c5c124
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions system-contracts/contracts/EvmGasManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 1c5c124

Please sign in to comment.