mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
PIP-30: increased max code size limit to 32KB (#1310)
* PIP-30: increased max code size limit to 32KB * fixed tests
This commit is contained in:
parent
50092672c1
commit
635dacc63e
3 changed files with 16 additions and 4 deletions
|
|
@ -495,9 +495,15 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
|
|||
ret, err := evm.interpreter.PreRun(contract, nil, false, nil)
|
||||
|
||||
// Check whether the max code size has been exceeded, assign err if the case.
|
||||
if err == nil && evm.chainRules.IsEIP158 && len(ret) > params.MaxCodeSize {
|
||||
if err == nil && evm.chainRules.IsEIP158 {
|
||||
if evm.chainConfig.Bor != nil && evm.chainConfig.Bor.IsAhmedabad(evm.Context.BlockNumber) {
|
||||
if len(ret) > params.MaxCodeSizePostAhmedabad {
|
||||
err = ErrMaxCodeSizeExceeded
|
||||
}
|
||||
} else if len(ret) > params.MaxCodeSize {
|
||||
err = ErrMaxCodeSizeExceeded
|
||||
}
|
||||
}
|
||||
|
||||
// Reject code starting with 0xEF if EIP-3541 is enabled.
|
||||
if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsLondon {
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ type BorConfig struct {
|
|||
DelhiBlock *big.Int `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi)
|
||||
IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore)
|
||||
StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to`
|
||||
AhmedabadBlock *big.Int `json:"ahmedabadBlock"` // Ahmedabad switch block (nil = no fork, 0 = already on ahmedabad)
|
||||
}
|
||||
|
||||
// String implements the stringer interface, returning the consensus engine details.
|
||||
|
|
@ -657,6 +658,10 @@ func (c *BorConfig) CalculateStateSyncDelay(number uint64) uint64 {
|
|||
return borKeyValueConfigHelper(c.StateSyncConfirmationDelay, number)
|
||||
}
|
||||
|
||||
func (c *BorConfig) IsAhmedabad(number *big.Int) bool {
|
||||
return isBlockForked(c.AhmedabadBlock, number)
|
||||
}
|
||||
|
||||
// // TODO: modify this function once the block number is finalized
|
||||
// func (c *BorConfig) IsNapoli(number *big.Int) bool {
|
||||
// if c.NapoliBlock != nil {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ const (
|
|||
DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have.
|
||||
|
||||
MaxCodeSize = 24576 // Maximum bytecode to permit for a contract
|
||||
MaxCodeSizePostAhmedabad = 32768 // Maximum bytecode to permit for a contract post Ahmedabad hard fork (bor / polygon pos) (32KB)
|
||||
MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions
|
||||
|
||||
// Precompiled contract gas prices
|
||||
|
|
|
|||
Loading…
Reference in a new issue