mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-21 02:18:07 +00:00
core/vm: fix initNewContract logic
This commit is contained in:
parent
7f045f6c4c
commit
3f41dd1c5b
1 changed files with 6 additions and 6 deletions
|
|
@ -625,10 +625,9 @@ func (evm *EVM) initNewContract(contract *Contract, address common.Address) ([]b
|
|||
return ret, err
|
||||
}
|
||||
|
||||
// Check code validity once upfront.
|
||||
codeErr := CheckMaxCodeSize(&evm.chainRules, uint64(len(ret)))
|
||||
if codeErr == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsLondon {
|
||||
codeErr = ErrInvalidCode
|
||||
// Check prefix before gas calculation.
|
||||
if len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsLondon {
|
||||
return ret, ErrInvalidCode
|
||||
}
|
||||
|
||||
// Charge code storage gas.
|
||||
|
|
@ -660,8 +659,9 @@ func (evm *EVM) initNewContract(contract *Contract, address common.Address) ([]b
|
|||
}
|
||||
}
|
||||
|
||||
if codeErr != nil {
|
||||
return ret, codeErr
|
||||
// Verify max code size after gas calculation.
|
||||
if err := CheckMaxCodeSize(&evm.chainRules, uint64(len(ret))); err != nil {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
if len(ret) > 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue