-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Description
handleStateAnchor has special case for stateAchor.GetStateIndex() == 0. It assumes chain initialization is in progress, so it calls InitChainByStateMetadataBytes. But what is chain was already initialized, but just no other block was produced yet? We get double initialization.
Although it sounds like not an issue, it becomes (a minor) one in combination with a fact, that L1 parameters change after time. On alphanet L1 parameters change pretty often. That means, that if we deploy chain localy, then restart node after 5 minutes we will get an error Ignoring InitialAO.
We need to review if there is a way to add some additional condition in addition to stateAchor.GetStateIndex() == 0 to check not only state index, but also the fact, that chain was already initialized. Sounda potentially simple, but need to be guided by @kape1395 , because I'm not sure how that change would influence consensus.
To Reproduce
- Remove
waspdbbeforehand - Start wasp:
wasp -c config.json - Get some funds:
wasp-cli wallet request-funds - Log in:
wasp auth login(wasp:wasp) - Deploy chain:
wasp-cli chain deploy --chain=testchain - Restart wasp
- See
InitChainByStateMetadataBytesis called again, becauseif stateAchor.GetStateIndex() == 0case inhandleStateAnchoris still valid