paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.8k stars 652 forks source link

Use relay chain block number in the broker pallet instead of block number #5656

Open davidk-pt opened 2 weeks ago

davidk-pt commented 2 weeks ago

Based on https://github.com/paritytech/polkadot-sdk/pull/3331

Implements migrations with customizable block number to relay height number translation function.

Adds block to relay height migration code for rococo and westend.

xlc commented 2 weeks ago

this will break all the UI and indexers and I am not sure if there exists a good solution...

paritytech-cicd-pr commented 2 weeks ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: test-linux-stable 3/3 Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7340522

kianenigma commented 1 week ago

this will break all the UI and indexers and I am not sure if there exists a good solution...

Yeah, only solution that comes to mind is something like https://github.com/polkadot-api/polkadot-api/issues/689

xlc commented 1 week ago

a backward compatible approach will be use relaychain block number / 2 + offset so we don’t need complicated migration and existing dapps will still be functional without changes

joepetrowski commented 1 week ago

a backward compatible approach will be use relaychain block number / 2 + offset so we don’t need complicated migration and existing dapps will still be functional without changes

Why would you use the RC block number? The offset should account for the difference in block height, but the coefficient (here, 1/2) should be w/r/t the block time.

xlc commented 1 week ago

the idea is simulate 12s block time regardless local block time so the meaning of the block numbers in storage stays the same and keep UI compatible

joepetrowski commented 1 week ago

I still don't understand from that description. So you are saying that if a parachain goes 24 second between two blocks, that those would be n and n+2?

xlc commented 1 week ago

Yes. I have bit more explanation here and maybe we should move the discussion over there as well https://github.com/paritytech/polkadot-sdk/issues/3268#issuecomment-2357045461