Skip to content

Conversation

@vsmk98
Copy link
Contributor

@vsmk98 vsmk98 commented Feb 20, 2020

Added maxCodeSizeChangeBlock to track the block number when the maxCodeSize changes from default 24K to the value given.
For long standing networks, it is possible that contracts which crossed default 24k size were deployed at some time and the network rejected the same with max code size exceeded error. If the network at later point changed the maxCodeSize to a higher value and post this if a new node joins the network, the new node will sync the old blocks with the higher max code size value and thus the gas computed on the historical block will be different from the network resulting in bad block error.
maxCodeSizeChangeBlock has been added track the block number where the new maxCodeSize value was set for the network overwriting the default value of 24K. This will ensure that any new nodes joining the network will be able to sync the historical blocks without the bad block error.

However, it should be noted that, if maxCodeSize has been changed several times at network level, maxCodeSizeChangeBlock will only track the last change and for all other prior blocks it will take 24K as the default maxCodeSize. In this scenario, its possible to get the bad blocks error at the time of network sync

#942

…Size changes from default value of 24K to the given value in genesis.json
@vsmk98 vsmk98 self-assigned this Feb 20, 2020
@vsmk98 vsmk98 requested review from jbhurat and jpmsam February 20, 2020 03:36
Copy link
Contributor

@jbhurat jbhurat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jpmsam
Copy link
Contributor

jpmsam commented Feb 21, 2020

if maxCodeSize has been changed several times at network level, maxCodeSizeChangeBlock will only track the last change and for all other prior blocks it will take 24K as the default maxCodeSize.

While this PR fix's the immediate issue, we'll need to look into handling possible multiple maxCodeSizes on the network.

@jpmsam jpmsam merged commit 439f529 into master Feb 21, 2020
@trung trung deleted the fix/max-code-size-sync branch February 25, 2020 15:02
@jimthematrix
Copy link
Contributor

thanks for making this update @vsmk98, we already have a customer that was hit by the issue and can benefit from the enhanced maxCodeSize configuration.

@jpmsam definitely agree having support for multiple settings each tied to a block number would be a very useful next step.

@jiakun9707
Copy link

Why not do the same tracking for the transaction size limit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants