From 635dacc63ec3eb7c79793b1185de3b2e9eadcd13 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Tue, 20 Aug 2024 09:02:48 +0530 Subject: [PATCH 1/9] PIP-30: increased max code size limit to 32KB (#1310) * PIP-30: increased max code size limit to 32KB * fixed tests --- core/vm/evm.go | 10 ++++++++-- params/config.go | 5 +++++ params/protocol_params.go | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/vm/evm.go b/core/vm/evm.go index e6d1648901..8ec032cff4 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -495,8 +495,14 @@ 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 { - err = ErrMaxCodeSizeExceeded + 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. diff --git a/params/config.go b/params/config.go index 963a00b120..f8f7e005da 100644 --- a/params/config.go +++ b/params/config.go @@ -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 { diff --git a/params/protocol_params.go b/params/protocol_params.go index 204439c21c..7f66ce4d21 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -133,8 +133,9 @@ const ( DefaultBaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. - MaxCodeSize = 24576 // Maximum bytecode to permit for a contract - MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions + 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 From 46769159cf5621e4a23889aed7fffe4c4fc9a99f Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Tue, 27 Aug 2024 21:29:32 +0530 Subject: [PATCH 2/9] README, .github: update discord links (#1318) --- .github/ISSUE_TEMPLATE/bug.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 2 +- README.md | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 72bca49dd6..603cb7b582 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -6,7 +6,7 @@ labels: 'type:bug' assignees: '' --- -Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/0xPolygonDevs) server +Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/0xPolygonCommunity) server