Thank you for the explanation, but I think (unfortunately) it's much more complicated than that.
It gets complicated because this procedure is executed 21 times in each round. I have tried to find a system, but I have not succeeded. For visual support, I wrote a programme with the help of Copilot to simulate the blockchain process. It took me a while because I had to make a lot of modifications until it matched the processes.
If you want to run it too, I'll post it as a separate comment so that it doesn't get too messy. However, I wrote it in C++ based on the steemd code.
The following output demonstrates the process (I hope it es self-explanatory - if not, feel free to ask).
I used a random selection of witnesses for now. In the next days I would play through your ‘extreme cases’...
bumps the gap up to 16 each round until witness21 produces a block. When that happens, the gap drops to 15.
As you see below this is not the case. The gap drops already before.
Round: 1
Witness: Top4; LconfB before: 63; LconfB after: 80;
Sorted last confirmed blocks: 4 60 61 62 64 (65) 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
HeadB: 80; LirrB: 65; Gap: 15
Witness: Top6; LconfB before: 65; LconfB after: 81;
Sorted last confirmed blocks: 4 60 61 62 64 (66) 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
HeadB: 81; LirrB: 66; Gap: 15
Witness: Top12; LconfB before: 71; LconfB after: 82;
Sorted last confirmed blocks: 4 60 61 62 64 (66) 67 68 69 70 72 73 74 75 76 77 78 79 80 81 82
HeadB: 82; LirrB: 66; Gap: 16
Witness: NonTop; LconfB before: 4; LconfB after: 83;
Sorted last confirmed blocks: 60 61 62 64 66 (67) 68 69 70 72 73 74 75 76 77 78 79 80 81 82 83
HeadB: 83; LirrB: 67; Gap: 16
Witness: Top8; LconfB before: 67; LconfB after: 84;
Sorted last confirmed blocks: 60 61 62 64 66 (68) 69 70 72 73 74 75 76 77 78 79 80 81 82 83 84
HeadB: 84; LirrB: 68; Gap: 16
Witness: Top5; LconfB before: 64; LconfB after: 85;
Sorted last confirmed blocks: 60 61 62 66 68 (69) 70 72 73 74 75 76 77 78 79 80 81 82 83 84 85
HeadB: 85; LirrB: 69; Gap: 16
Witness: Top16; LconfB before: 75; LconfB after: 86;
Sorted last confirmed blocks: 60 61 62 66 68 (69) 70 72 73 74 76 77 78 79 80 81 82 83 84 85 86
HeadB: 86; LirrB: 69; Gap: 17
Witness: Top1; LconfB before: 60; LconfB after: 87;
Sorted last confirmed blocks: 61 62 66 68 69 (70) 72 73 74 76 77 78 79 80 81 82 83 84 85 86 87
HeadB: 87; LirrB: 70; Gap: 17
Witness: Top13; LconfB before: 72; LconfB after: 88;
Sorted last confirmed blocks: 61 62 66 68 69 (70) 73 74 76 77 78 79 80 81 82 83 84 85 86 87 88
HeadB: 88; LirrB: 70; Gap: 18
Witness: Top17; LconfB before: 76; LconfB after: 89;
Sorted last confirmed blocks: 61 62 66 68 69 (70) 73 74 77 78 79 80 81 82 83 84 85 86 87 88 89
HeadB: 89; LirrB: 70; Gap: 19
Witness: Top2; LconfB before: 61; LconfB after: 90;
Sorted last confirmed blocks: 62 66 68 69 70 (73) 74 77 78 79 80 81 82 83 84 85 86 87 88 89 90
HeadB: 90; LirrB: 73; Gap: 17
Witness: Top10; LconfB before: 69; LconfB after: 91;
Sorted last confirmed blocks: 62 66 68 70 73 (74) 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
HeadB: 91; LirrB: 74; Gap: 17
Witness: Top14; LconfB before: 73; LconfB after: 92;
Sorted last confirmed blocks: 62 66 68 70 74 (77) 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
HeadB: 92; LirrB: 77; Gap: 15
Witness: Top3; LconfB before: 62; LconfB after: 93;
Sorted last confirmed blocks: 66 68 70 74 77 (78) 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
HeadB: 93; LirrB: 78; Gap: 15
Witness: Top7; LconfB before: 66; LconfB after: 94;
Sorted last confirmed blocks: 68 70 74 77 78 (79) 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
HeadB: 94; LirrB: 79; Gap: 15
Witness: Top9; LconfB before: 68; LconfB after: 95;
Sorted last confirmed blocks: 70 74 77 78 79 (80) 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
HeadB: 95; LirrB: 80; Gap: 15
Witness: Top15; LconfB before: 74; LconfB after: 96;
Sorted last confirmed blocks: 70 77 78 79 80 (81) 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
HeadB: 96; LirrB: 81; Gap: 15
Witness: Top18; LconfB before: 77; LconfB after: 97;
Sorted last confirmed blocks: 70 78 79 80 81 (82) 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
HeadB: 97; LirrB: 82; Gap: 15
Witness: Top19; LconfB before: 78; LconfB after: 98;
Sorted last confirmed blocks: 70 79 80 81 82 (83) 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
HeadB: 98; LirrB: 83; Gap: 15
Witness: Top20; LconfB before: 79; LconfB after: 99;
Sorted last confirmed blocks: 70 80 81 82 83 (84) 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
HeadB: 99; LirrB: 84; Gap: 15
Witness: Top11; LconfB before: 70; LconfB after: 100;
Sorted last confirmed blocks: 80 81 82 83 84 (85) 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
HeadB: 100; LirrB: 85; Gap: 15
Round: 2
Witness: Top11; LconfB before: 100; LconfB after: 101;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 95 96 97 98 99 101
HeadB: 101; LirrB: 85; Gap: 16
Witness: Top20; LconfB before: 99; LconfB after: 102;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 95 96 97 98 101 102
HeadB: 102; LirrB: 85; Gap: 17
Witness: Top19; LconfB before: 98; LconfB after: 103;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 95 96 97 101 102 103
HeadB: 103; LirrB: 85; Gap: 18
Witness: Top18; LconfB before: 97; LconfB after: 104;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 95 96 101 102 103 104
HeadB: 104; LirrB: 85; Gap: 19
Witness: Top15; LconfB before: 96; LconfB after: 105;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 95 101 102 103 104 105
HeadB: 105; LirrB: 85; Gap: 20
Witness: Top9; LconfB before: 95; LconfB after: 106;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 94 101 102 103 104 105 106
HeadB: 106; LirrB: 85; Gap: 21
Witness: Top7; LconfB before: 94; LconfB after: 107;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 93 101 102 103 104 105 106 107
HeadB: 107; LirrB: 85; Gap: 22
Witness: Top3; LconfB before: 93; LconfB after: 108;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 92 101 102 103 104 105 106 107 108
HeadB: 108; LirrB: 85; Gap: 23
Witness: Top14; LconfB before: 92; LconfB after: 109;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 91 101 102 103 104 105 106 107 108 109
HeadB: 109; LirrB: 85; Gap: 24
Witness: Top10; LconfB before: 91; LconfB after: 110;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 90 101 102 103 104 105 106 107 108 109 110
HeadB: 110; LirrB: 85; Gap: 25
Witness: Top2; LconfB before: 90; LconfB after: 111;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 89 101 102 103 104 105 106 107 108 109 110 111
HeadB: 111; LirrB: 85; Gap: 26
Witness: Top17; LconfB before: 89; LconfB after: 112;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 88 101 102 103 104 105 106 107 108 109 110 111 112
HeadB: 112; LirrB: 85; Gap: 27
Witness: Top13; LconfB before: 88; LconfB after: 113;
Sorted last confirmed blocks: 5 80 81 82 84 (85) 86 87 101 102 103 104 105 106 107 108 109 110 111 112 113
HeadB: 113; LirrB: 85; Gap: 28
Witness: Top4; LconfB before: 80; LconfB after: 114;
Sorted last confirmed blocks: 5 81 82 84 85 (86) 87 101 102 103 104 105 106 107 108 109 110 111 112 113 114
HeadB: 114; LirrB: 86; Gap: 28
Witness: Top16; LconfB before: 86; LconfB after: 115;
Sorted last confirmed blocks: 5 81 82 84 85 (87) 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
HeadB: 115; LirrB: 87; Gap: 28
Witness: Top5; LconfB before: 85; LconfB after: 116;
Sorted last confirmed blocks: 5 81 82 84 87 (101) 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
HeadB: 116; LirrB: 101; Gap: 15
Witness: Top8; LconfB before: 84; LconfB after: 117;
Sorted last confirmed blocks: 5 81 82 87 101 (102) 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
HeadB: 117; LirrB: 102; Gap: 15
Witness: NonTop; LconfB before: 5; LconfB after: 118;
Sorted last confirmed blocks: 81 82 87 101 102 (103) 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
HeadB: 118; LirrB: 103; Gap: 15
Witness: Top12; LconfB before: 82; LconfB after: 119;
Sorted last confirmed blocks: 81 87 101 102 103 (104) 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
HeadB: 119; LirrB: 104; Gap: 15
Witness: Top6; LconfB before: 81; LconfB after: 120;
Sorted last confirmed blocks: 87 101 102 103 104 (105) 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
HeadB: 120; LirrB: 105; Gap: 15
Witness: Top1; LconfB before: 87; LconfB after: 121;
Sorted last confirmed blocks: 101 102 103 104 105 (106) 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
HeadB: 121; LirrB: 106; Gap: 15
Agreed. I think my second table only considered the case of the first block per round. I am surprised to see gaps up to 28, though. I guess it makes sense, given that 42-28 is 14, which is one less than the threshold - but I haven't manually traced through the steps, yet.
Thank you for the code. I got it running today, and if I find time, I might play with it by reducing the number of witnesses to 3 (top-2 plus random) and increasing by one from there in order to understand how the patterns change as the number of witnesses grows. It might also be interesting to reintroduce random shuffling and simulate thousands of blocks in order to see the expected distribution over time. I don't think I'll have time this week, though.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I am curious.
Unfortunately, I only had the opportunity to test a specific case, but it didn't show any significant gap.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit