Fix development devnet on 3.1: pact service dies with "fork cannot be at genesis"#30
Closed
DaisukeFlowers wants to merge 1 commit into
Closed
Conversation
The development version sets every fork ForkAtGenesis, but MigratePlatformShare's guard (atNotGenesis) hard-errors on ForkAtGenesis and is consulted by applyUpgrades on every block. The pact service therefore dies on the first execNewBlock and a development devnet can never mine a block, fresh or seeded. Stage the one-shot migration at block height 2 (as recap-development does at 700); every other fork stays genesis-active. Verified with a fresh-genesis 20-chain devnet: blocks mine past the migration height, the platform-share keyset reset applies, and coin transfers plus SPV cross-chain succeed.
Author
|
Closing in favor of #28, which Pascal opened first and correctly disables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
A fresh-genesis devnet with
--chainweb-version developmentcannot produce any block on 3.1 (and currentmaster). The pact service dies on the first new-block attempt, before block 1 is ever mined:(captured on
ghcr.io/kda-community/chainweb-node/ubuntu:3.1; seeded databases are affected the same way). Found while testing on 3.1 —recap-developmentstill works because it stages forks at real heights.Root cause
MigratePlatformSharefork, guarded byatNotGenesis, which hard-errors when the fork is configured at genesis:src/Chainweb/Version/Guards.hs:118(atNotGenesis _ ForkAtGenesis = error "fork cannot be at genesis", used atGuards.hs:326).developmentversion configures every fork asForkAtGenesis:src/Chainweb/Version/Development.hs:35.applyUpgradesconsults the guard on every block:src/Chainweb/Pact5/TransactionExec.hs:545— so the firstexecNewBlockthrows and no block can ever be produced.--fork-upper-boundis not a workaround: it filters later forks out of the version map andgetForkHeightthen hits an unsafe lookup (^?!).Fix
Stage
MigratePlatformSharejust above genesis indevelopmentinstead of the blanketForkAtGenesis, mirroring howrecap-developmentstages it at 700 (src/Chainweb/Version/RecapDevelopment.hs:81).Why height 2:
atNotGenesisfires the one-shot migration exactly once at that height; every other fork stays genesis-active, preservingdevelopment's "everything on immediately" purpose, and the migration still lands within seconds of a fresh start. No existing history can break — no 3.1developmentchain can exist, since it cannot mine block 1.Rejected alternative: making
atNotGenesistolerateForkAtGenesis(e.g. treat it as height 1). That would silently change one-shot migration semantics for all versions and defeat the guard's intent; the version-local fix seemed safer.Verification
Built
exe:chainweb-nodefrom this branch (GHC 9.10.2, repocabal.project.freeze) and ran a fresh-genesis single-node devnet (--chainweb-version development,--disable-pow, constant-delay mining client, 20 chains):(describe-keyset "ns-admin-keyset")returns the platform-share keyset (user.pred.keys-3, the 5 migration keys) — same effect as onrecap-developmentat 700.@kadena/client):Negative control: the unpatched
ghcr.io/kda-community/chainweb-node/ubuntu:3.1image with the identical config produces the failure log at the top — zero blocks, fresh or seeded.