-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set PetersburgBlock as optional when checking Fork order #21447
Conversation
PetersburgBlock, if not explicitly set, is assumed to be active depending on whether ConstantinopleBlock is active. When checking fork ordering, PetersburgBlock is treated mandatory. In private chains which are running 1.8.27 with ConstantinopleBlock active, migration to 1.9 fails because PetersburgBlock is not explicitly set (although the gas calculation works as though Petersburg block is set). This PR sets PetersburgBlock to `optional`, so that such chains can upgrade to Geth 1.9.x and apply the `Istanbul` fork after upgrade.
I am not sure this is correct. Some context about the whole situation:
Now, if you make |
Thanks for your input @holiman . The "Are we after Petersburg" question is determined using the following two criteria:
Given the above, (ref: Lines 419 to 424 in 54add42
1.8.27 which do not have Petersburg set, but are mining blocks higher than what is set for Constantinople return true for IsPetersburg() -- in effect, they do not apply 1283 functionality. Such chains cannot upgrade to 1.9.x and apply Istanbul fork with the current constraints even though the client code behavior is exactly as though PetersburgBlock is set.
|
This is an oddball issue. I raised a concern in the original Petersburg PR that auto-enabling seems wrong. Now, the messy part is that the chain will auto-enable it with constantinople, BUT the forkid and other code will not, since they only look at the numbers. |
I was wrong. Fork ID dedups forks at the same block number, so that should still work ok. |
@vdamle Can't you just reinit your private chain's fork config with Petersburg enabled at the Constantinople block number? Wondering if Geth would accept that or complain that the new fork config is incompatible with the chain (could happen). I'd be leaning towards special casing the |
Thanks @karalabe. I thought of that as an alternative and spent time yesterday testing that. It works without issues for upgrade and also when adding nodes after upgrade (all blocks sync fine). Here's the proposed change, I created a separate PR (i'm pretty sure this is the special casing in |
Closing in favour of #21473 |
PetersburgBlock
, if not explicitly set, is assumed to be active depending on whetherConstantinopleBlock
is active. However, when checking fork ordering, PetersburgBlock is treated mandatory. In private chains which are running 1.8.27 with ConstantinopleBlock active, migration to 1.9 fails because PetersburgBlock is not explicitly set (even the gas calculation works as though Petersburg block is set). This PR sets PetersburgBlock tooptional
to reflect the treatment of the fork across the rest of the code. The main benefit of this change is that private chains which set the Constantinople fork and are running with Geth1.8.27
can upgrade to Geth 1.9.x and apply theIstanbul
fork after upgrade.I discussed this with @holiman on Discord, creating a PR as follow up to the discussion.