This PR aims to handle the primary block forks properly. Basically, one incoming primary block import notification could mean multiple primary blocks we need to process in case the primary chain forks.
Tested in a local network with multiple farmers, now the domain forks whenever the primary chain forks.
2022-12-23 00:41:36.915 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #555,0x7e2d…c18a to #555,0x5e3e…d1f9, common ancestor #554,0x593d…9d31
2022-12-23 00:41:38.504 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #557,0xc0f0…68e2 to #557,0x94b8…d90e, common ancestor #556,0x787e…3d28
2022-12-23 00:41:38.506 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #557,0xe471…8a27 to #557,0xa594…fd25, common ancestor #556,0x77ab…8c41
2022-12-23 00:41:38.508 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #557,0xd008…fa6c to #557,0x11be…01dd, common ancestor #556,0x59a1…0cca
2022-12-23 00:41:44.321 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #560,0x1afc…6ad7 to #560,0xbbcd…1f74, common ancestor #559,0xfd68…a546
2022-12-23 00:41:44.360 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #560,0x0976…b034 to #560,0xe161…3528, common ancestor #559,0x4659…c933
2022-12-23 00:41:44.375 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #560,0xa8b0…3a23 to #560,0x7656…f0e1, common ancestor #559,0x488b…4a5f
2022-12-23 00:41:44.649 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #560,0xbbcd…1f74 to #561,0x9668…1737, common ancestor #559,0xfd68…a546
2022-12-23 00:41:44.679 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #560,0xe161…3528 to #561,0xd291…3f15, common ancestor #559,0x4659…c933
2022-12-23 00:41:48.664 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #562,0x1846…f0bf to #562,0x756d…d3cb, common ancestor #561,0x9668…1737
2022-12-23 00:41:48.682 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #562,0x74e9…4617 to #562,0x7d05…5784, common ancestor #561,0xd291…3f15
2022-12-23 00:41:48.693 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #562,0x11e4…e3ab to #562,0x5cda…248d, common ancestor #561,0xfa16…214a
2022-12-23 00:41:48.996 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #563,0x41db…089a to #563,0x951a…e429, common ancestor #561,0x9668…1737
2022-12-23 00:41:49.026 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #563,0xc445…8871 to #563,0xf00b…f148, common ancestor #561,0xd291…3f15
2022-12-23 00:42:06.215 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #575,0xdc48…bfe1 to #575,0x0497…ea24, common ancestor #574,0x4785…4fb5
2022-12-23 00:42:06.225 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #575,0x72cf…6ce7 to #575,0xcb82…af8c, common ancestor #574,0x77a7…c29a
2022-12-23 00:42:06.227 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #575,0x7bd5…251a to #575,0x1db0…5381, common ancestor #574,0xb45e…057b
2022-12-23 00:42:20.069 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #584,0x060d…03a9 to #584,0x8871…f48a, common ancestor #583,0xb522…4b91
2022-12-23 00:42:20.087 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #584,0x8d1d…8a5c to #584,0xb41e…21d0, common ancestor #583,0x7fa5…d4f1
2022-12-23 00:42:20.405 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #586,0x1e04…5650 to #586,0xa8d9…b9a8, common ancestor #585,0x9d06…1dd7
2022-12-23 00:42:20.408 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #586,0x4da2…3115 to #586,0xcd18…eaa0, common ancestor #585,0x3abf…49f6
2022-12-23 00:42:20.408 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #586,0xcc21…7b58 to #586,0x3ca7…d3fa, common ancestor #585,0xacf2…7f6d
2022-12-23 00:42:26.066 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #590,0xf57b…f879 to #590,0xe23c…51af, common ancestor #589,0x79fd…e6bd
2022-12-23 00:42:26.079 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #590,0xc052…32c5 to #590,0x67df…48c0, common ancestor #589,0x9b5c…d083
2022-12-23 00:42:26.080 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #590,0x6b47…3b77 to #590,0xed6b…6da2, common ancestor #589,0xea22…9d03
2022-12-23 00:42:27.422 INFO tokio-runtime-worker sc_informant: [PrimaryChain] ♻️ Reorg on #591,0x7385…0415 to #591,0xf609…b6f1, common ancestor #589,0x79fd…e6bd
2022-12-23 00:42:27.454 INFO tokio-runtime-worker sc_informant: [CoreDomain] ♻️ Reorg on #591,0xb923…83a8 to #591,0xd6a1…a7b0, common ancestor #589,0x9b5c…d083
2022-12-23 00:42:27.473 INFO tokio-runtime-worker sc_informant: [SecondaryChain] ♻️ Reorg on #591,0xe782…e23f to #591,0x879b…c623, common ancestor #589,0xea22…9d03
Close #1034
This is not the whole story, I still see some edge cases locally and need more time to test it both locally and on gemini-3b, but the meat is there, I hope it can be reviewed sooner than later.
Code contributor checklist: