sui_core/authority/
epoch_start_configuration.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use enum_dispatch::enum_dispatch;
5use mysten_common::in_test_configuration;
6use serde::{Deserialize, Serialize};
7use sui_config::NodeConfig;
8use sui_types::accumulator_root::get_accumulator_root_obj_initial_shared_version;
9use sui_types::address_alias::get_address_alias_state_obj_initial_shared_version;
10use sui_types::display_registry::get_display_registry_obj_initial_shared_version;
11
12use std::fmt;
13use sui_types::authenticator_state::get_authenticator_state_obj_initial_shared_version;
14use sui_types::base_types::SequenceNumber;
15use sui_types::bridge::{get_bridge_obj_initial_shared_version, is_bridge_committee_initiated};
16use sui_types::coin_registry::get_coin_registry_obj_initial_shared_version;
17use sui_types::deny_list_v1::get_deny_list_obj_initial_shared_version;
18use sui_types::epoch_data::EpochData;
19use sui_types::error::SuiResult;
20use sui_types::messages_checkpoint::{CheckpointDigest, CheckpointTimestamp};
21use sui_types::randomness_state::get_randomness_state_obj_initial_shared_version;
22use sui_types::storage::ObjectStore;
23use sui_types::sui_system_state::epoch_start_sui_system_state::{
24    EpochStartSystemState, EpochStartSystemStateTrait,
25};
26
27#[enum_dispatch]
28pub trait EpochStartConfigTrait {
29    fn epoch_digest(&self) -> CheckpointDigest;
30    fn epoch_start_state(&self) -> &EpochStartSystemState;
31    fn flags(&self) -> &[EpochFlag];
32    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
33    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
34    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
35    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
36    fn bridge_committee_initiated(&self) -> bool;
37    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
38    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
39    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
40    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber>;
41
42    fn is_data_quarantine_active_from_beginning_of_epoch(&self) -> bool {
43        self.flags()
44            .contains(&EpochFlag::DataQuarantineFromBeginningOfEpoch)
45    }
46
47    fn use_commit_handler_v2(&self) -> bool {
48        self.flags().contains(&EpochFlag::UseCommitHandlerV2)
49    }
50}
51
52// IMPORTANT: Assign explicit values to each variant to ensure that the values are stable.
53// When cherry-picking changes from one branch to another, the value of variants must never
54// change.
55//
56// Unlikely: If you cherry pick a change from one branch to another, and there is a collision
57// in the value of some variant, the branch which has been released should take precedence.
58// In this case, the picked-from branch is inconsistent with the released branch, and must
59// be fixed.
60#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
61pub enum EpochFlag {
62    // The deprecated flags have all been in production for long enough that
63    // we have deleted the old code paths they were guarding.
64    // We retain them here in order not to break deserialization.
65    _InMemoryCheckpointRootsDeprecated = 0,
66    _PerEpochFinalizedTransactionsDeprecated = 1,
67    _ObjectLockSplitTablesDeprecated = 2,
68    _WritebackCacheEnabledDeprecated = 3,
69    _GlobalStateHashV2EnabledDeprecated = 4,
70    _GlobalStateHashV2EnabledTestnetDeprecated = 5,
71    _GlobalStateHashV2EnabledMainnetDeprecated = 6,
72    _ExecutedInEpochTableDeprecated = 7,
73    _UseVersionAssignmentTablesV3 = 8,
74
75    // This flag indicates whether data quarantining has been enabled from the
76    // beginning of the epoch.
77    DataQuarantineFromBeginningOfEpoch = 9,
78
79    // This flag indicates whether the new commit handler is enabled.
80    UseCommitHandlerV2 = 10,
81
82    // Used for `test_epoch_flag_upgrade`.
83    #[cfg(msim)]
84    DummyFlag = 11,
85}
86
87impl EpochFlag {
88    pub fn default_flags_for_new_epoch(_config: &NodeConfig) -> Vec<Self> {
89        // NodeConfig arg is not currently used, but we keep it here for future
90        // flags that might depend on the config.
91        Self::default_flags_impl()
92    }
93
94    // Return flags that are mandatory for the current version of the code. This is used
95    // so that `test_epoch_flag_upgrade` can still work correctly even when there are no
96    // optional flags.
97    pub fn mandatory_flags() -> Vec<Self> {
98        vec![EpochFlag::DataQuarantineFromBeginningOfEpoch]
99    }
100
101    /// For situations in which there is no config available (e.g. setting up a downloaded snapshot).
102    pub fn default_for_no_config() -> Vec<Self> {
103        Self::default_flags_impl()
104    }
105
106    fn default_flags_impl() -> Vec<Self> {
107        let mut flags = vec![EpochFlag::DataQuarantineFromBeginningOfEpoch];
108
109        if std::env::var("SUI_USE_NEW_COMMIT_HANDLER").is_ok() || in_test_configuration() {
110            flags.push(EpochFlag::UseCommitHandlerV2);
111        }
112
113        #[cfg(msim)]
114        {
115            flags.push(EpochFlag::DummyFlag);
116        }
117
118        flags
119    }
120}
121
122impl fmt::Display for EpochFlag {
123    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
124        // Important - implementation should return low cardinality values because this is used as metric key
125        match self {
126            EpochFlag::_InMemoryCheckpointRootsDeprecated => {
127                write!(f, "InMemoryCheckpointRoots (DEPRECATED)")
128            }
129            EpochFlag::_PerEpochFinalizedTransactionsDeprecated => {
130                write!(f, "PerEpochFinalizedTransactions (DEPRECATED)")
131            }
132            EpochFlag::_ObjectLockSplitTablesDeprecated => {
133                write!(f, "ObjectLockSplitTables (DEPRECATED)")
134            }
135            EpochFlag::_WritebackCacheEnabledDeprecated => {
136                write!(f, "WritebackCacheEnabled (DEPRECATED)")
137            }
138            EpochFlag::_GlobalStateHashV2EnabledDeprecated => {
139                write!(f, "GlobalStateHashV2EnabledDeprecated (DEPRECATED)")
140            }
141            EpochFlag::_ExecutedInEpochTableDeprecated => {
142                write!(f, "ExecutedInEpochTable (DEPRECATED)")
143            }
144            EpochFlag::_GlobalStateHashV2EnabledTestnetDeprecated => {
145                write!(f, "GlobalStateHashV2EnabledTestnet (DEPRECATED)")
146            }
147            EpochFlag::_GlobalStateHashV2EnabledMainnetDeprecated => {
148                write!(f, "GlobalStateHashV2EnabledMainnet (DEPRECATED)")
149            }
150            EpochFlag::_UseVersionAssignmentTablesV3 => {
151                write!(f, "UseVersionAssignmentTablesV3 (DEPRECATED)")
152            }
153            EpochFlag::DataQuarantineFromBeginningOfEpoch => {
154                write!(f, "DataQuarantineFromBeginningOfEpoch")
155            }
156            EpochFlag::UseCommitHandlerV2 => {
157                write!(f, "UseCommitHandlerV2")
158            }
159            #[cfg(msim)]
160            EpochFlag::DummyFlag => {
161                write!(f, "DummyFlag")
162            }
163        }
164    }
165}
166
167/// Parameters of the epoch fixed at epoch start.
168#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
169#[enum_dispatch(EpochStartConfigTrait)]
170pub enum EpochStartConfiguration {
171    V1(EpochStartConfigurationV1),
172    V2(EpochStartConfigurationV2),
173    V3(EpochStartConfigurationV3),
174    V4(EpochStartConfigurationV4),
175    V5(EpochStartConfigurationV5),
176    V6(EpochStartConfigurationV6),
177    V7(EpochStartConfigurationV7),
178    V8(EpochStartConfigurationV8),
179    V9(EpochStartConfigurationV9),
180    V10(EpochStartConfigurationV10),
181}
182
183impl EpochStartConfiguration {
184    pub fn new(
185        system_state: EpochStartSystemState,
186        epoch_digest: CheckpointDigest,
187        object_store: &dyn ObjectStore,
188        initial_epoch_flags: Vec<EpochFlag>,
189    ) -> SuiResult<Self> {
190        let authenticator_obj_initial_shared_version =
191            get_authenticator_state_obj_initial_shared_version(object_store)?;
192        let randomness_obj_initial_shared_version =
193            get_randomness_state_obj_initial_shared_version(object_store)?;
194        let coin_deny_list_obj_initial_shared_version =
195            get_deny_list_obj_initial_shared_version(object_store);
196        let bridge_obj_initial_shared_version =
197            get_bridge_obj_initial_shared_version(object_store)?;
198        let accumulator_root_obj_initial_shared_version =
199            get_accumulator_root_obj_initial_shared_version(object_store)?;
200        let coin_registry_obj_initial_shared_version =
201            get_coin_registry_obj_initial_shared_version(object_store)?;
202        let display_registry_obj_initial_shared_version =
203            get_display_registry_obj_initial_shared_version(object_store)?;
204        let address_alias_state_obj_initial_shared_version =
205            get_address_alias_state_obj_initial_shared_version(object_store)?;
206        let bridge_committee_initiated = is_bridge_committee_initiated(object_store)?;
207        Ok(Self::V10(EpochStartConfigurationV10 {
208            system_state,
209            epoch_digest,
210            flags: initial_epoch_flags,
211            authenticator_obj_initial_shared_version,
212            randomness_obj_initial_shared_version,
213            coin_deny_list_obj_initial_shared_version,
214            bridge_obj_initial_shared_version,
215            bridge_committee_initiated,
216            accumulator_root_obj_initial_shared_version,
217            coin_registry_obj_initial_shared_version,
218            display_registry_obj_initial_shared_version,
219            address_alias_state_obj_initial_shared_version,
220        }))
221    }
222
223    pub fn new_at_next_epoch_for_testing(&self) -> Self {
224        // We only need to implement this function for the latest version.
225        // When a new version is introduced, this function should be updated.
226        match self {
227            Self::V10(config) => Self::V10(EpochStartConfigurationV10 {
228                system_state: config.system_state.new_at_next_epoch_for_testing(),
229                epoch_digest: config.epoch_digest,
230                flags: config.flags.clone(),
231                authenticator_obj_initial_shared_version: config
232                    .authenticator_obj_initial_shared_version,
233                randomness_obj_initial_shared_version: config.randomness_obj_initial_shared_version,
234                coin_deny_list_obj_initial_shared_version: config
235                    .coin_deny_list_obj_initial_shared_version,
236                bridge_obj_initial_shared_version: config.bridge_obj_initial_shared_version,
237                bridge_committee_initiated: config.bridge_committee_initiated,
238                accumulator_root_obj_initial_shared_version: config
239                    .accumulator_root_obj_initial_shared_version,
240                coin_registry_obj_initial_shared_version: config
241                    .coin_registry_obj_initial_shared_version,
242                display_registry_obj_initial_shared_version: config
243                    .display_registry_obj_initial_shared_version,
244                address_alias_state_obj_initial_shared_version: config
245                    .address_alias_state_obj_initial_shared_version,
246            }),
247            _ => panic!(
248                "This function is only implemented for the latest version of EpochStartConfiguration"
249            ),
250        }
251    }
252
253    pub fn epoch_data(&self) -> EpochData {
254        EpochData::new(
255            self.epoch_start_state().epoch(),
256            self.epoch_start_state().epoch_start_timestamp_ms(),
257            self.epoch_digest(),
258        )
259    }
260
261    pub fn epoch_start_timestamp_ms(&self) -> CheckpointTimestamp {
262        self.epoch_start_state().epoch_start_timestamp_ms()
263    }
264}
265
266#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
267pub struct EpochStartConfigurationV1 {
268    system_state: EpochStartSystemState,
269    /// epoch_digest is defined as following
270    /// (1) For the genesis epoch it is set to 0
271    /// (2) For all other epochs it is a digest of the last checkpoint of a previous epoch
272    /// Note that this is in line with how epoch start timestamp is defined
273    epoch_digest: CheckpointDigest,
274}
275
276#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
277pub struct EpochStartConfigurationV2 {
278    system_state: EpochStartSystemState,
279    epoch_digest: CheckpointDigest,
280    flags: Vec<EpochFlag>,
281}
282
283#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
284pub struct EpochStartConfigurationV3 {
285    system_state: EpochStartSystemState,
286    epoch_digest: CheckpointDigest,
287    flags: Vec<EpochFlag>,
288    /// Does the authenticator state object exist at the beginning of the epoch?
289    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
290}
291
292#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
293pub struct EpochStartConfigurationV4 {
294    system_state: EpochStartSystemState,
295    epoch_digest: CheckpointDigest,
296    flags: Vec<EpochFlag>,
297    /// Do the state objects exist at the beginning of the epoch?
298    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
299    randomness_obj_initial_shared_version: Option<SequenceNumber>,
300}
301
302#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
303pub struct EpochStartConfigurationV5 {
304    system_state: EpochStartSystemState,
305    epoch_digest: CheckpointDigest,
306    flags: Vec<EpochFlag>,
307    /// Do the state objects exist at the beginning of the epoch?
308    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
309    randomness_obj_initial_shared_version: Option<SequenceNumber>,
310    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
311}
312
313#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
314pub struct EpochStartConfigurationV6 {
315    system_state: EpochStartSystemState,
316    epoch_digest: CheckpointDigest,
317    flags: Vec<EpochFlag>,
318    /// Do the state objects exist at the beginning of the epoch?
319    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
320    randomness_obj_initial_shared_version: Option<SequenceNumber>,
321    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
322    bridge_obj_initial_shared_version: Option<SequenceNumber>,
323    bridge_committee_initiated: bool,
324}
325
326#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
327pub struct EpochStartConfigurationV7 {
328    system_state: EpochStartSystemState,
329    epoch_digest: CheckpointDigest,
330    flags: Vec<EpochFlag>,
331    /// Do the state objects exist at the beginning of the epoch?
332    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
333    randomness_obj_initial_shared_version: Option<SequenceNumber>,
334    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
335    bridge_obj_initial_shared_version: Option<SequenceNumber>,
336    bridge_committee_initiated: bool,
337    accumulator_root_obj_initial_shared_version: Option<SequenceNumber>,
338}
339
340#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
341pub struct EpochStartConfigurationV8 {
342    system_state: EpochStartSystemState,
343    epoch_digest: CheckpointDigest,
344    flags: Vec<EpochFlag>,
345    /// Do the state objects exist at the beginning of the epoch?
346    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
347    randomness_obj_initial_shared_version: Option<SequenceNumber>,
348    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
349    bridge_obj_initial_shared_version: Option<SequenceNumber>,
350    bridge_committee_initiated: bool,
351    accumulator_root_obj_initial_shared_version: Option<SequenceNumber>,
352    coin_registry_obj_initial_shared_version: Option<SequenceNumber>,
353}
354
355#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
356pub struct EpochStartConfigurationV9 {
357    system_state: EpochStartSystemState,
358    epoch_digest: CheckpointDigest,
359    flags: Vec<EpochFlag>,
360    /// Do the state objects exist at the beginning of the epoch?
361    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
362    randomness_obj_initial_shared_version: Option<SequenceNumber>,
363    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
364    bridge_obj_initial_shared_version: Option<SequenceNumber>,
365    bridge_committee_initiated: bool,
366    accumulator_root_obj_initial_shared_version: Option<SequenceNumber>,
367    coin_registry_obj_initial_shared_version: Option<SequenceNumber>,
368    display_registry_obj_initial_shared_version: Option<SequenceNumber>,
369}
370
371#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
372pub struct EpochStartConfigurationV10 {
373    system_state: EpochStartSystemState,
374    epoch_digest: CheckpointDigest,
375    flags: Vec<EpochFlag>,
376    /// Do the state objects exist at the beginning of the epoch?
377    authenticator_obj_initial_shared_version: Option<SequenceNumber>,
378    randomness_obj_initial_shared_version: Option<SequenceNumber>,
379    coin_deny_list_obj_initial_shared_version: Option<SequenceNumber>,
380    bridge_obj_initial_shared_version: Option<SequenceNumber>,
381    bridge_committee_initiated: bool,
382    accumulator_root_obj_initial_shared_version: Option<SequenceNumber>,
383    coin_registry_obj_initial_shared_version: Option<SequenceNumber>,
384    display_registry_obj_initial_shared_version: Option<SequenceNumber>,
385    address_alias_state_obj_initial_shared_version: Option<SequenceNumber>,
386}
387
388impl EpochStartConfigurationV1 {
389    pub fn new(system_state: EpochStartSystemState, epoch_digest: CheckpointDigest) -> Self {
390        Self {
391            system_state,
392            epoch_digest,
393        }
394    }
395}
396
397impl EpochStartConfigTrait for EpochStartConfigurationV1 {
398    fn epoch_digest(&self) -> CheckpointDigest {
399        self.epoch_digest
400    }
401
402    fn epoch_start_state(&self) -> &EpochStartSystemState {
403        &self.system_state
404    }
405
406    fn flags(&self) -> &[EpochFlag] {
407        &[]
408    }
409
410    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
411        None
412    }
413
414    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
415        None
416    }
417
418    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
419        None
420    }
421
422    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
423        None
424    }
425
426    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
427        None
428    }
429
430    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
431        None
432    }
433
434    fn bridge_committee_initiated(&self) -> bool {
435        false
436    }
437
438    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
439        None
440    }
441
442    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
443        None
444    }
445}
446
447impl EpochStartConfigTrait for EpochStartConfigurationV2 {
448    fn epoch_digest(&self) -> CheckpointDigest {
449        self.epoch_digest
450    }
451
452    fn epoch_start_state(&self) -> &EpochStartSystemState {
453        &self.system_state
454    }
455
456    fn flags(&self) -> &[EpochFlag] {
457        &self.flags
458    }
459
460    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
461        None
462    }
463
464    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
465        None
466    }
467
468    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
469        None
470    }
471
472    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
473        None
474    }
475
476    fn bridge_committee_initiated(&self) -> bool {
477        false
478    }
479
480    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
481        None
482    }
483
484    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
485        None
486    }
487
488    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
489        None
490    }
491
492    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
493        None
494    }
495}
496
497impl EpochStartConfigTrait for EpochStartConfigurationV3 {
498    fn epoch_digest(&self) -> CheckpointDigest {
499        self.epoch_digest
500    }
501
502    fn epoch_start_state(&self) -> &EpochStartSystemState {
503        &self.system_state
504    }
505
506    fn flags(&self) -> &[EpochFlag] {
507        &self.flags
508    }
509
510    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
511        self.authenticator_obj_initial_shared_version
512    }
513
514    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
515        None
516    }
517
518    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
519        None
520    }
521
522    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
523        None
524    }
525    fn bridge_committee_initiated(&self) -> bool {
526        false
527    }
528
529    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
530        None
531    }
532
533    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
534        None
535    }
536
537    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
538        None
539    }
540
541    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
542        None
543    }
544}
545
546impl EpochStartConfigTrait for EpochStartConfigurationV4 {
547    fn epoch_digest(&self) -> CheckpointDigest {
548        self.epoch_digest
549    }
550
551    fn epoch_start_state(&self) -> &EpochStartSystemState {
552        &self.system_state
553    }
554
555    fn flags(&self) -> &[EpochFlag] {
556        &self.flags
557    }
558
559    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
560        self.authenticator_obj_initial_shared_version
561    }
562
563    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
564        self.randomness_obj_initial_shared_version
565    }
566
567    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
568        None
569    }
570
571    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
572        None
573    }
574
575    fn bridge_committee_initiated(&self) -> bool {
576        false
577    }
578
579    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
580        None
581    }
582
583    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
584        None
585    }
586
587    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
588        None
589    }
590
591    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
592        None
593    }
594}
595
596impl EpochStartConfigTrait for EpochStartConfigurationV5 {
597    fn epoch_digest(&self) -> CheckpointDigest {
598        self.epoch_digest
599    }
600
601    fn epoch_start_state(&self) -> &EpochStartSystemState {
602        &self.system_state
603    }
604
605    fn flags(&self) -> &[EpochFlag] {
606        &self.flags
607    }
608
609    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
610        self.authenticator_obj_initial_shared_version
611    }
612
613    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
614        self.randomness_obj_initial_shared_version
615    }
616
617    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
618        self.coin_deny_list_obj_initial_shared_version
619    }
620
621    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
622        None
623    }
624    fn bridge_committee_initiated(&self) -> bool {
625        false
626    }
627
628    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
629        None
630    }
631
632    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
633        None
634    }
635
636    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
637        None
638    }
639
640    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
641        None
642    }
643}
644
645impl EpochStartConfigTrait for EpochStartConfigurationV6 {
646    fn epoch_digest(&self) -> CheckpointDigest {
647        self.epoch_digest
648    }
649
650    fn epoch_start_state(&self) -> &EpochStartSystemState {
651        &self.system_state
652    }
653
654    fn flags(&self) -> &[EpochFlag] {
655        &self.flags
656    }
657
658    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
659        self.authenticator_obj_initial_shared_version
660    }
661
662    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
663        self.randomness_obj_initial_shared_version
664    }
665
666    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
667        self.coin_deny_list_obj_initial_shared_version
668    }
669
670    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
671        self.bridge_obj_initial_shared_version
672    }
673
674    fn bridge_committee_initiated(&self) -> bool {
675        self.bridge_committee_initiated
676    }
677
678    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
679        None
680    }
681
682    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
683        None
684    }
685
686    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
687        None
688    }
689
690    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
691        None
692    }
693}
694
695impl EpochStartConfigTrait for EpochStartConfigurationV7 {
696    fn epoch_digest(&self) -> CheckpointDigest {
697        self.epoch_digest
698    }
699
700    fn epoch_start_state(&self) -> &EpochStartSystemState {
701        &self.system_state
702    }
703
704    fn flags(&self) -> &[EpochFlag] {
705        &self.flags
706    }
707
708    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
709        self.authenticator_obj_initial_shared_version
710    }
711
712    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
713        self.randomness_obj_initial_shared_version
714    }
715
716    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
717        self.coin_deny_list_obj_initial_shared_version
718    }
719
720    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
721        self.bridge_obj_initial_shared_version
722    }
723
724    fn bridge_committee_initiated(&self) -> bool {
725        self.bridge_committee_initiated
726    }
727
728    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
729        self.accumulator_root_obj_initial_shared_version
730    }
731
732    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
733        None
734    }
735
736    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
737        None
738    }
739
740    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
741        None
742    }
743}
744
745impl EpochStartConfigTrait for EpochStartConfigurationV8 {
746    fn epoch_digest(&self) -> CheckpointDigest {
747        self.epoch_digest
748    }
749
750    fn epoch_start_state(&self) -> &EpochStartSystemState {
751        &self.system_state
752    }
753
754    fn flags(&self) -> &[EpochFlag] {
755        &self.flags
756    }
757
758    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
759        self.authenticator_obj_initial_shared_version
760    }
761
762    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
763        self.randomness_obj_initial_shared_version
764    }
765
766    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
767        self.coin_deny_list_obj_initial_shared_version
768    }
769
770    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
771        self.bridge_obj_initial_shared_version
772    }
773
774    fn bridge_committee_initiated(&self) -> bool {
775        self.bridge_committee_initiated
776    }
777
778    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
779        self.accumulator_root_obj_initial_shared_version
780    }
781
782    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
783        self.coin_registry_obj_initial_shared_version
784    }
785
786    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
787        None
788    }
789
790    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
791        None
792    }
793}
794
795impl EpochStartConfigTrait for EpochStartConfigurationV9 {
796    fn epoch_digest(&self) -> CheckpointDigest {
797        self.epoch_digest
798    }
799
800    fn epoch_start_state(&self) -> &EpochStartSystemState {
801        &self.system_state
802    }
803
804    fn flags(&self) -> &[EpochFlag] {
805        &self.flags
806    }
807
808    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
809        self.authenticator_obj_initial_shared_version
810    }
811
812    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
813        self.randomness_obj_initial_shared_version
814    }
815
816    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
817        self.coin_deny_list_obj_initial_shared_version
818    }
819
820    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
821        self.bridge_obj_initial_shared_version
822    }
823
824    fn bridge_committee_initiated(&self) -> bool {
825        self.bridge_committee_initiated
826    }
827
828    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
829        self.accumulator_root_obj_initial_shared_version
830    }
831
832    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
833        self.coin_registry_obj_initial_shared_version
834    }
835
836    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
837        self.display_registry_obj_initial_shared_version
838    }
839
840    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
841        None
842    }
843}
844
845impl EpochStartConfigTrait for EpochStartConfigurationV10 {
846    fn epoch_digest(&self) -> CheckpointDigest {
847        self.epoch_digest
848    }
849
850    fn epoch_start_state(&self) -> &EpochStartSystemState {
851        &self.system_state
852    }
853
854    fn flags(&self) -> &[EpochFlag] {
855        &self.flags
856    }
857
858    fn authenticator_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
859        self.authenticator_obj_initial_shared_version
860    }
861
862    fn randomness_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
863        self.randomness_obj_initial_shared_version
864    }
865
866    fn coin_deny_list_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
867        self.coin_deny_list_obj_initial_shared_version
868    }
869
870    fn bridge_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
871        self.bridge_obj_initial_shared_version
872    }
873
874    fn bridge_committee_initiated(&self) -> bool {
875        self.bridge_committee_initiated
876    }
877
878    fn accumulator_root_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
879        self.accumulator_root_obj_initial_shared_version
880    }
881
882    fn coin_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
883        self.coin_registry_obj_initial_shared_version
884    }
885
886    fn display_registry_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
887        self.display_registry_obj_initial_shared_version
888    }
889
890    fn address_alias_state_obj_initial_shared_version(&self) -> Option<SequenceNumber> {
891        self.address_alias_state_obj_initial_shared_version
892    }
893}