-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblockchain-interface.tex
1145 lines (1074 loc) · 31.3 KB
/
blockchain-interface.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\section{Blockchain interface}
\label{sec:blockchain-interface}
\newcommand{\DIEnv}{\type{DIEnv}}
\newcommand{\DIState}{\type{DIState}}
\newcommand{\UPIEnv}{\type{UPIEnv}}
\newcommand{\UPIState}{\type{UPIState}}
\subsection{Delegation interface}
\label{sec:delegation-interface}
\begin{figure}[htb]
\emph{Delegation interface environments}
\begin{equation*}
\DIEnv =
\left(
\begin{array}{r@{~\in~}lr}
\mathcal{K} & \powerset{\VKeyGen} & \text{allowed delegators}\\
\var{e} & \Epoch & \text{current epoch}\\
\var{s} & \Slot & \text{current slot}
\end{array}
\right)
\end{equation*}
\emph{Delegation interface states}
\begin{equation*}
\DIState
= \left(
\begin{array}{r@{~\in~}lr}
\var{dms} & \VKeyGen \mapsto \VKey & \text{delegation map}\\
\var{dws} & \VKeyGen \mapsto \Slot & \text{when last delegation occurred}\\
\var{sds} & \seqof{(\Slot \times (\VKeyGen \times \VKey))} & \text{scheduled delegations}\\
\var{eks} & \powerset{(\Epoch \times \VKeyGen)} & \text{key-epoch delegations}
\end{array}
\right)
\end{equation*}
\emph{Delegation transitions}
\begin{equation*}
\_ \vdash \_ \trans{deleg}{\_} \_ \in
\powerset (\DIEnv \times \DIState \times \seqof{\DCert} \times \DIState)
\end{equation*}
\caption{Delegation interface transition-system types}
\label{fig:ts-types:delegation-interface}
\end{figure}
\subsubsection{Delegation interface rules}
\label{sec:delegation-interface-rules}
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:delegation-interface-init}
\inference
{
{\left(\begin{array}{l}
\mathcal{K}\\
e\\
s
\end{array}\right)}
\vdash
\trans{\hyperref[eq:sdeleg-bootstrap]{sdeleg}}{}
{\left(
\begin{array}{l}
\var{sds_0}\\
\var{eks_0}
\end{array}
\right)}
&
{
\mathcal{K}
\vdash
\trans{\hyperref[eq:adeleg-bootstrap]{adeleg}}{}
\left(
\begin{array}{l}
\var{dms_0}\\
\var{dws_0}
\end{array}
\right)
}
}
{
{\left(\begin{array}{l}
\mathcal{K} \\
e\\
s
\end{array}\right)}
\vdash
\trans{deleg}{}
{
\left(
\begin{array}{l}
\var{dms_0}\\
\var{dws_0}\\
\var{sds_0}\\
\var{eks_0}
\end{array}
\right)
}
}
\end{equation}
\nextdef
\begin{equation}
\label{eq:rule:delegation-interface}
\inference
{
{\left(\begin{array}{l}
\mathcal{K} \\
e\\
s
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{sds}\\
\var{eks}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:delegation-scheduling-seq]{sdelegs}}{\Gamma}
{
\left(
\begin{array}{l}
\var{sds'}\\
\var{eks'}
\end{array}
\right)
}
&
{\begin{array}{l}
\mathcal{K}
\end{array}}
\vdash
{
\left(
\begin{array}{l}
\var{dms}\\
\var{dws}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:delegation-seq]{adelegs}}{[.., s] \restrictdom \var{sds'}}
{
\left(
\begin{array}{l}
\var{dms'}\\
\var{dws'}
\end{array}
\right)
}
}
{
{\left(\begin{array}{l}
\mathcal{K} \\
e\\
s
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{dms}\\
\var{dws}\\
\var{sds}\\
\var{eks}
\end{array}
\right)
}
\trans{deleg}{\Gamma}
{
\left(
\begin{array}{l}
\var{dms'}\\
\var{dws'}\\
\var{[s+1, ..]} \restrictdom \var{sds'}\\
\var{[e, ..]} \restrictdom \var{eks'}
\end{array}
\right)
}
}
\end{equation}
\caption{Delegation interface rules}
\label{fig:rules:delegation-interface}
\end{figure}
\subsection{Update-proposals interface}
\label{sec:update-proposals-interface}
Figure~\ref{fig:ts-types:upi} defines the types of the transition systems
related with the update-proposals interface. The acronyms in the transition
labels have the following meaning:
\begin{description}
\item[UPIREG] Update-proposal-interface registration.
\item[UPIVOTE] Update-proposal-interface vote.
\item[UPIEND] Update-proposal-interface endorsement.
\item[UPIEC] Update-proposal-interface epoch-change.
\end{description}
In these rules we make use of the abstract constant $\var{ngk}$, defined in
\cref{fig:defs:upi}, which determines the number of genesis keys:
\begin{figure}[ht]
\emph{Abstract functions}
%
\begin{equation*}
\begin{array}{r@{~\in~}lr}
\var{ngk} & \mathbb{N} & \text{number of genesis keys}\\
\fun{firstSlot} & \in ~ \Epoch \to \Slot
& \text{first slot of an epoch}
\end{array}
\end{equation*}
\caption{Update interface types and functions}
\label{fig:defs:upi}
\end{figure}
\begin{figure}[htb]
\emph{Update-proposals interface environments}
\begin{align*}
& \UPIEnv
= \left(
\begin{array}{r@{~\in~}lr}
\var{s_n} & \Slot & \text{current slot number}\\
\var{dms} & \VKeyGen \mapsto \VKey & \text{delegation map}
\end{array}\right)
\end{align*}
%
\emph{Update-proposals interface states}
\begin{align*}
& \UPIState = \\
& \left(
\begin{array}{r@{~\in~}lr}
(\var{pv}, \var{pps}) & \ProtVer \times \PPMMap
& \text{current protocol information}\\
\var{fads} & \seqof{(\Slot \times (\ProtVer \times \PPMMap))}
& \text{future protocol version adoptions}\\
\var{avs} & \ApName \mapsto (\ApVer \times \Slot \times \Metadata)
& \text{application versions}\\
\var{rpus} & \UPropId \mapsto (\ProtVer \times \PPMMap)
& \text{registered protocol update proposals}\\
\var{raus} & \UPropId \mapsto (\ApName \times \ApVer \times \Metadata)
& \text{registered software update proposals}\\
\var{cps} & \UPropId \mapsto \Slot & \text{confirmed proposals}\\
\var{vts} & \powerset{(\UPropId \times \VKeyGen)} & \text{proposals votes}\\
\var{bvs} & \powerset{(\ProtVer \times \VKeyGen)}
& \text{endorsement-key pairs}\\
\var{pws} & \UPropId \mapsto \Slot & \text{proposal timestamps}
\end{array}\right)\\
\end{align*}
%
\emph{Update-proposals interface transitions}
\begin{equation*}
\begin{array}{r@{~\in~}l}
\_ \vdash \_ \trans{upireg}{\_} \_ &
\powerset (\UPIEnv \times \UPIState \times \UProp \times \UPIState)\\
\_ \vdash \_ \trans{upivote}{\_} \_ &
\powerset (\UPIEnv \times \UPIState \times \Vote \times \UPIState)\\
\_ \vdash \_ \trans{upiend}{\_} \_ &
\powerset (\UPIEnv \times \UPIState
\times (\ProtVer \times \VKey) \times \UPIState)\\
\_ \vdash \_ \trans{upiec}{} \_ &
\powerset (\Epoch \times \UPIState \times \UPIState)
\end{array}
\end{equation*}
\caption{Update-proposals interface transition-system types}
\label{fig:ts-types:upi}
\end{figure}
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:upi-reg-interface}
\inference
{
{\left(
\begin{array}{l}
\var{pv}\\
\var{pps}\\
\var{avs}\\
\var{dms}
\end{array}
\right)}
\vdash
{
\left(
\begin{array}{l}
\var{rpus}\\
\var{raus}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:up-registration]{upreg}}{\var{up}}
{
\left(
\begin{array}{l}
\var{rpus'}\\
\var{raus'}
\end{array}
\right)
}
&
pws' \leteq pws \unionoverrideRight \{ \upId{up} \mapsto s_n\}
}
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
\trans{upireg}{\var{up}}
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus'}\\
\var{raus'}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws'}
\end{array}
\right)
}
}
\end{equation}
\caption{Update-proposals registration rules}
\label{fig:rules:upi-reg-interface}
\end{figure}
\clearpage
Rule~\ref{eq:rule:upi-vote} models the effect of voting on an update proposal.
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:upi-vote}
\inference
{
\var{upAdptThd} \mapsto q \in \var{pps}\\
{\left(
\begin{array}{l}
s_n\\
\floor{q \cdot \var{ngk}}\\
\var{\dom~pws}\\
\var{dms}
\end{array}
\right)}
\vdash
{
\left(
\begin{array}{l}
\var{cps}\\
\var{vts}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:up-vote-reg]{upvote}}{\var{v}}
{
\left(
\begin{array}{l}
\var{cps'}\\
\var{vts'}
\end{array}
\right)
}
}
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
\trans{upivote}{\var{v}}
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps'}\\
\var{vts'}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
}
\end{equation}
\caption{Voting on update-proposals rules}
\label{fig:rules:upi-vote}
\end{figure}
Figure~\ref{fig:st-diagram-sw-up} shows the different states in which a
software proposal update might be: if valid, a software update proposal becomes
active whenever it is included in a block. If the update proposal gets enough
votes, then the corresponding software update proposal becomes confirmed. After
this confirmation becomes stable, the new software version gets adopted. If the
voting period ends without an update proposal being confirmed, then the
corresponding software update proposal gets rejected.
%
Protocol updates on the other hand, involve a slightly different logic, and the
state transition diagram for these kind of updates is shown in
Figure~\ref{fig:st-diagram-pt-up}.
\begin{figure}[ht]
\centering
\begin{tikzpicture}[ align = center
, node distance = 6em and 12em
, text width = 5em
, font = \footnotesize
, >={Latex[width=0.5em, length=0.5em]}
, every node/.style = { rectangle
, rounded corners
, draw = black
, align = center
, minimum height = 4em }
]
\node (active) [fill = blue!10] {Active};
\node (rejected) [below = of active, fill = red!10] {Rejected};
\node (confirmed) [right = of active, fill = green!30] {Confirmed};
\node (adopted) [below = of confirmed, fill = green!30] {Adopted};
\tikzset{every node/.style={align=center, text width=10em, text=brown}}
\draw[->] (active)
edge node [above] {Software Update proposal\\ gets enough votes}
(confirmed);
\draw[->] (active)
edge node [left] {Voting period \\ends}
(rejected);
\draw[->] (confirmed)
edge node [right, text width=8em]
{Proposal was confirmed at least $4 \cdot k$ slots ago}
(adopted);
\end{tikzpicture}
\caption{State-transition diagram for software-updates}
\label{fig:st-diagram-sw-up}
\end{figure}
\clearpage
A sequence of votes can be applied using $\trans{upivotes}{}$ transitions. The
inference rules for them are presented in \cref{fig:rules:apply-votes}. After
applying a sequence of votes, proposals might get confirmed, which means that
they will be added to the set $\var{cps'}$. In such case, the mapping of
application names to their latest version known to the ledger will be updated to
include the information about the confirmed proposals. Note that, unlike
protocol updates, software updates take effect as soon as a proposal is
confirmed (we cannot wait for stability since we need to preserve compatibility
with the existing chain, where there are software update proposals that were
adopted without waiting for $2\cdot k$ slots). In this rule, we also delete the
confirmed id's from the set of registered application update proposals
($\var{raus}$), since this information is no longer needed once the
application-name to software-version map ($\var{avs}$) is updated.
Also note that, unlike the rules of \cref{fig:rules:upi-ec}, we need not remove
other update proposals that refer to the software names whose versions were
changed in $\var{avs_{new}}$. The reason for this is that the range of $\var{raus}$
can contain only one pair of the form $(\var{an}, \wcard, \wcard)$ for any given
application name $\var{an}$ (see Rule~\ref{eq:rule:up-av-validity}).
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:apply-votes-base}
\inference
{
}
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
\var{us}
\trans{applyvotes}{\epsilon}
\var{us}
}
\end{equation}
%
\nextdef
%
\begin{equation}
\label{eq:rule:apply-votes-ind}
\inference
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
\var{us}
\trans{applyvotes}{\Gamma}
\var{us'}
&
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
\var{us'}
\trans{\hyperref[fig:rules:upi-vote]{upivote}}{v}
\var{us''}
}
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
\var{us}
\trans{applyvotes}{\Gamma;v}
\var{us''}
}
\end{equation}
%
\nextdef
%
\begin{equation}
\label{eq:rule:upivotes}
\inference{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
{\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)}
\trans{applyvotes}{\Gamma}
{\left(
\begin{array}{l}
(\var{pv'}, \var{pps'})\\
\var{fads'}\\
\var{avs'}\\
\var{rpus'}\\
\var{raus'}\\
\var{cps'}\\
\var{vts'}\\
\var{bvs'}\\
\var{pws'}
\end{array}
\right)}\\
%
{\begin{array}{r@{~\leteq~}l}
\var{cfm_{raus}} & \dom~(cps') \restrictdom \var{raus'}\\
\var{avs_{new}} & \{ \var{an} \mapsto (\var{av}, \var{s_n}, m)
\mid (\var{an}, \var{av}, m) \in \var{cfm_{raus}} \}
\end{array}}
}{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
{\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)}
\trans{upivotes}{\Gamma}
{\left(
\begin{array}{l}
(\var{pv'}, \var{pps'})\\
\var{fads'}\\
\var{avs'} \unionoverrideRight \var{avs_{new}}\\
\var{rpus'}\\
\dom~(cps') \subtractdom \var{raus'}\\
\var{cps'}\\
\var{vts'}\\
\var{bvs'}\\
\var{pws'}
\end{array}
\right)}
}
\end{equation}
\caption{Applying multiple votes on update-proposals rules}
\label{fig:rules:apply-votes}
\end{figure}
\clearpage
The interface rule for protocol-version endorsement makes use of the
$\trans{upend}{}$ transition, where we set the threshold for proposal adoption
to: the number of genesis keys ($\var{ngk}$) times the minimum proportion of
genesis keys that need to endorse an update proposal for it to become a
candidate for adoption (given by the protocol parameter $\var{upAdptThd}$). In
addition, the unconfirmed proposals that are older than $u$ blocks are removed
from the parts of the state that hold:
\begin{itemize}
\item the registered protocol and software update proposals,
\item the votes associated with the proposals,
\item the set of endorsement-key pairs, and
\item the block number in which proposals where added.
\end{itemize}
In Rule~\ref{eq:rule:upi-pend}, the set of proposal id's $\var{pid_{keep}}$
contains only those proposals that haven't expired yet or that are confirmed.
Once a proposal $\var{up}$ is confirmed, it is removed from the set of
confirmed proposals ($\var{cps}$) when a new a protocol version gets adopted
(see Rule~\ref{eq:rule:upi-ec-pv-change}).
%
The set of endorsement-key pairs is cleaned here as well as in the epoch change
rule (Rule~\ref{eq:rule:upi-ec-pv-change}). The reason for this is that this set grows at
each block, and it can get considerably large if no proposal gets adopted at
the end of an epoch.
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:upi-pend}
\inference
{
\var{upAdptThd} \mapsto q \in \var{pps} \\
\left({
\begin{array}{l}
s_n\\
\floor{q \cdot \var{ngk}}\\
\var{dms}\\
\var{cps}\\
\var{rpus}
\end{array}
}\right)
\vdash
{
\left(
\begin{array}{l}
\var{fads}\\
\var{bvs}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:up-end]{upend}}{(\var{bv}, \var{vk})}
{
\left(
\begin{array}{l}
\var{fads'}\\
\var{bvs'}
\end{array}
\right)
}\\
\var{upropTTL} \mapsto u \in \var{pps}\\
{
\begin{array}{r@{~\leteq~}l}
\var{pids_{keep}} & \dom~(pws \restrictrange [s_n - u, ..]) \cup \dom~\var{cps}\\
\var{vs_{keep}} & \dom~(\range~\var{rpus'})\\
\var{rpus'} & \var{pids_{keep}} \restrictdom \var{rpus}
\end{array}
}
}
{
{\left(
\begin{array}{l}
s_n\\
\var{dms}
\end{array}
\right)}
\vdash
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
\trans{upiend}{(\var{bv}, \var{vk})}
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads'}\\
\var{avs}\\
\var{rpus'}\\
\var{pids_{keep}} \restrictdom \var{raus}\\
\var{cps}\\
\var{pids_{keep}} \restrictdom \var{vts}\\
\var{vs_{keep}} \restrictdom \var{bvs'}\\
\var{pids_{keep}} \restrictdom \var{pws}
\end{array}
\right)
}
}
\end{equation}
\caption{Proposal endorsement rules}
\label{fig:rules:upi-pend}
\end{figure}
\clearpage
Rule~\ref{eq:rule:upi-ec-pv-change} models how the protocol-version and its
parameters are changed depending on an epoch change signal.
%
On an epoch change, this rule will pick a candidate that gathered enough
endorsements at least $4 \cdot k$ slots ago. If a protocol-version candidate
cannot gather enough endorsements $4 \cdot k$ slots before the end of an epoch,
the proposal can only be adopted in the next epoch. The reason for the $4 \cdot
k$ slot delay is to allow a period between knowing when a proposal will be
adopted, and the event of its being adopted. Since update proposals can and will
make large changes to the way the chain operates, it is useful to be able to
guarantee a window in which it is known that no update will take place.
%
Figure~\ref{fig:up-confirmed-too-late} shows an example of a proposal being
confirmed too late in an epoch, where it is not possible to get enough
endorsements in the remaining window. In this Figure we take $k = 2$, and we
assume $4$ endorsements are needed to consider a proposal as candidate for
adoption.
%
Note that, in the final state, we use union override to define the updated
parameters ($\var{pps} \unionoverrideRight \var{pps'}$). This is because candidate
proposal might only update some parameters of the protocol.
In Rule~\ref{eq:rule:upi-ec-pv-change}, when a new proposal gets adopted, all
the state components that refer to protocol update proposals get emptied. The
reason for this is that at the moment of registering a proposal, we evaluated
it in a state where the protocol parameters that we used for this are no longer
up to date (see for instance \cref{eq:func:can-update}). For instance, assume
we register a proposal $\var{up}$ which only changes the maximum transaction
size to $x$, and the current block size is set to $x + 1$. Then,
$\fun{canUpdate}$ holds, since the maximum transaction size is less than the
maximum block size. If now a new proposal gets adopted that changes the maximum
block size to $x - 1$, then this invalidates $\var{up}$ since $\fun{canUpdate}$
no longer holds.
%
If there are no candidates for adoption, then the state variables remain
unaltered (Rule~\ref{eq:rule:upi-ec-pv-unchanged}).
Also note that the registered software-update proposals need not be cleaned
here, since this is done either when a proposal gets confirmed or when it
expires.
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:pvbump-change-epoch-only}
\inference
{
[.., s_n - 4 \cdot k] \restrictdom \var{fads} = \epsilon
}
{
{\left(\begin{array}{l}
s_n\\
\var{fads}
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{pv}, \var{pps}\\
\end{array}
\right)
}
\trans{pvbump}{}
{
\left(
\begin{array}{l}
\var{pv}, \var{pps}\\
\end{array}
\right)
}
}
\end{equation}
\nextdef
\begin{equation}
\label{eq:rule:pvbump-change}
\inference
{
\wcard ; (\wcard , (\var{pv_c}, \var{pps_c})) \leteq [.., s_n - 4 \cdot k] \restrictdom \var{fads}
}
{
{\left(\begin{array}{l}
s_n\\
\var{fads}
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{pv}, \var{pps}\\
\end{array}
\right)
}
\trans{pvbump}{}
{
\left(
\begin{array}{l}
\var{pv_c}, \var{pps_c}\\
\end{array}
\right)
}
}
\end{equation}
\caption{Protocol version bump rules}
\label{fig:rules:pvbump}
\end{figure}
\begin{figure}[htb]
\begin{equation}
\label{eq:rule:upi-ec-pv-unchanged}
\inference
{
{\left(\begin{array}{l}
\fun{firstSlot}~e_n\\
\var{fads}
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{pv}, \var{pps}
\end{array}
\right)
}
\trans{\hyperref[fig:rules:pvbump]{pvbump}}{}
{
\left(
\begin{array}{l}
\var{pv'}, \var{pps'}\\
\end{array}
\right)
} &\var{pv} = \var{pv'}
}
{
(e_n)
\vdash
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
\trans{upiec}{}
{
\left(
\begin{array}{l}
(\var{pv}, \var{pps})\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
}
\end{equation}
\nextdef
\begin{equation}
\label{eq:rule:upi-ec-pv-change}
\inference
{
{\left(\begin{array}{l}
\fun{firstSlot}~e_n\\
\var{fads}
\end{array}\right)}
\vdash
{
\left(
\begin{array}{l}
\var{pv}, \var{pps}\\
\end{array}
\right)
}
\trans{\hyperref[fig:rules:pvbump]{pvbump}}{}
{
\left(
\begin{array}{l}
\var{pv'}, \var{pps'}\\
\end{array}
\right)
}
& \var{pv} \neq \var{pv'}
}
{
(e_n)
\vdash
{
\left(
\begin{array}{l}
\var{(\var{pv}, \var{pps})}\\
\var{fads}\\
\var{avs}\\
\var{rpus}\\
\var{raus}\\
\var{cps}\\
\var{vts}\\
\var{bvs}\\
\var{pws}
\end{array}
\right)
}
\trans{upiec}{}
{
\left(
\begin{array}{l}
(\var{pv'}, \var{pps'})\\
\epsilon\\
\var{avs}\\
\emptyset\\
\emptyset\\
\emptyset\\
\emptyset\\
\emptyset\\
\emptyset\\
\end{array}
\right)
}
}