Skip to content


Generates the specification for a given ABCI app in YAML/JSON/Mermaid format.


def validate_fsm_spec(data: Dict) -> None

Validate FSM specificaiton file.

DFASpecificationError Objects

class DFASpecificationError(Exception)

Simple class to raise errors when parsing a DFA.

FSMSpecificationLoader Objects

class FSMSpecificationLoader()

FSM specification loader utilities.

OutputFormats Objects

class OutputFormats()

Output formats.


def from_yaml(file: Path) -> Dict

Load from yaml.


def from_json(file: Path) -> Dict

Load from json.


def load(cls, file: Path, spec_format: str = OutputFormats.YAML) -> Dict

Load FSM specification.


def dump_json(dfa: "DFA", file: Path) -> None

Dump to a json file.


def dump_yaml(dfa: "DFA", file: Path) -> None

Dump to a yaml file.


def dump_mermaid(dfa: "DFA", file: Path) -> None

Dumps this DFA spec. to a file in Mermaid format.


def dump(cls,
         dfa: "DFA",
         file: Path,
         spec_format: str = OutputFormats.YAML) -> None

Dumps this DFA spec. to a file in YAML/JSON/Mermaid format.

DFA Objects

class DFA()

Simple specification of a deterministic finite automaton (DFA).


def __init__(label: str, states: Set[str], default_start_state: str,
             start_states: Set[str], final_states: Set[str],
             alphabet_in: Set[str], transition_func: Dict[Tuple[str, str],

Initialize DFA object.


def validate_naming_conventions() -> None

Validate state names to see if they follow the naming conventions below

  • A round name should end with Round
  • ABCI app class name should end with AbciApp


def is_transition_func_total() -> bool

Outputs True if the transition function of the DFA is total.

A transition function is total when it explicitly defines all the transitions for all the possible pairs (state, input_symbol). By convention, when a transition (state, input_symbol) is not defined for a certain input_symbol, it will be automatically regarded as a self-transition to the same state.


True if the transition function is total. False otherwise.


def get_transitions(input_sequence: List[str]) -> List[str]

Runs the DFA given the input sequence of symbols, and outputs the list of state transitions.


def parse_transition_func() -> Dict[str, Dict[str, str]]

Parse the transition function from the spec to a nested dictionary.


def __eq__(other: object) -> bool

Compares two DFAs


def generate() -> Dict[str, Any]

Retrieves an exportable representation for YAML/JSON dump of this DFA.


def load(
        file: Path,
        spec_format: str = FSMSpecificationLoader.OutputFormats.YAML) -> "DFA"

Loads a DFA JSON specification from file.


def abci_to_dfa(cls, abci_app_cls: Any, label: str = "") -> "DFA"

Translates an AbciApp class into a DFA.


def check_unreferenced_events(abci_app_cls: Any) -> List[str]

Checks for unreferenced events in the AbciApp.

Checks that events defined in the AbciApp transition function are referenced in the source code of the corresponding rounds or their superclasses. Note that the function simply checks references in the "raw" source code of the rounds and their (non builtin) superclasses. Therefore, it does not do any kind of static analysis on the source code, nor checks for actual reachability of a return statement returning such events.


  • abci_app_cls: AbciApp to check unreferenced events.


List of error strings