mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
core/vm: fix condition
This commit is contained in:
parent
b2e78c4861
commit
370af2ed06
1 changed files with 9 additions and 7 deletions
|
|
@ -27,14 +27,16 @@ import (
|
||||||
|
|
||||||
// CheckInitCodeSize checks the size of contract initcode against the protocol-defined limit.
|
// CheckInitCodeSize checks the size of contract initcode against the protocol-defined limit.
|
||||||
func CheckInitCodeSize(rules *params.Rules, size uint64) error {
|
func CheckInitCodeSize(rules *params.Rules, size uint64) error {
|
||||||
switch {
|
if rules.IsOsaka {
|
||||||
case rules.IsOsaka && size > params.MaxInitCodeSizeOsaka:
|
if size > params.MaxInitCodeSizeOsaka {
|
||||||
return fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, size, params.MaxInitCodeSizeOsaka)
|
return fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, size, params.MaxInitCodeSizeOsaka)
|
||||||
case rules.IsShanghai && size > params.MaxInitCodeSize:
|
}
|
||||||
return fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, size, params.MaxInitCodeSize)
|
} else if rules.IsShanghai {
|
||||||
default:
|
if size > params.MaxInitCodeSize {
|
||||||
return nil
|
return fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, size, params.MaxInitCodeSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcMemSize64 calculates the required memory size, and returns
|
// calcMemSize64 calculates the required memory size, and returns
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue