Provide on-chain and off-chain information for Spork information

There is lack of information needed related to Sporks.

First of all, the previous Mainnet must stop generating blocks, we can see how Mainnet 18 is still producing blocks while Mainnet 19 is still active. That creates a hardfork.

flow blocks get 35858812 --host access-001.mainnet18.nodes.onflow.org:9000
Block ID		357c8f53d725e7b356fe43570e5b6235cd64dbd6019935af01216f47ef732c0f
Parent ID		c318dc350d31270ef8969df8e83cd828cb5e4723ede2ead1400e5df565c66bf3
Timestamp		2022-08-24 15:00:05.014643817 +0000 UTC
Height			35858812

flow blocks get 35858812 --host access-001.mainnet19.nodes.onflow.org:9000
Block ID		a8a0b1f620f37fd7960541e34d99a958b829b1ed560bcc3471f725e59f849c8f
Parent ID		5690a5f4a21f565ac7416eca7302f2cb1aa4dd9b1baf0b0873901a776ee7f7c4
Timestamp		2022-08-24 15:07:07 +0000 UTC
Height			35858812

To avoid that happen there must be a on-chain mechanism to determine when a mainnet stop. For example the Mainnet X will stop at block Y.

To make things easier for developers to consume the blocks there must be a HTTP endpoint with the block information Something like:

curl https://rest-mainnet.onflow.org/v1/sporks

[
    {
        "spork": 1,
        "block_start: 1,
        "block_end: 999
    },
    {
        "spork": 2,
        "block_start: 1000,
        "block_end: 1999
    }
]
1 Like

Thank you for this suggestion! Iā€™m gonna pass it around to get more eyes on it,

Thanks @yagop for flagging these issues!

You are right, we are unfortunately generating finalized blocks on the old chain which are abandoned.
This happens because we stop the old network at a sealed block, say at height X but there are always some blocks beyond that sealed block which have been finalized but yet to be sealed at height X+1, X+2 etc. Then, after the spork, when we start the new network at block height X+1, there ends up being sealed blocks at X+1, X+2 different from the finalized blocks on the old chain at the same height.

We are working on figuring out a long term solution for this.

However, in the interim, we plan to do the following to address this:

  1. Changes to Flow CLI - Flow CLI currently returns the latest finalized block when used to query a block by height. It also does not report the status of the block, one of - finalized, executed, sealed. We have created this issue to address that problem. Flow CLI could then be used to follow the chain and stop at the last sealed block height (optionally) on the old chain after a spork.

  2. Change to the Access API - Similar to the Flow CLI change to additionally provide the block status, this issue will make all the Access API block responses to also additionally include the block status to help the client differentiate between a finalized and a sealed block.

Finally, you mentioned about publishing the sporks heights. We do maintain this JSON file which provides the spork height. That can be used to determine the start and end of a spork.

Hope this helps in addressing your concerns.

Let us know what you think.