Skip to content

Stop using global variables for consensus module. #34

@sholsapp

Description

@sholsapp

Using global variables make testing hard, especially for the consensus module.

This becomes more apparent when you think about how to test GallocyState, GallocyServer, GallocyClient, and GallocyConfig together. Today, all of these major entities are global variables that are defined in entrypoint.h. Everything accesses these entities through these global handles, which makes unit testing hard.

This will require rethinking a few abstractions, since everything accesses these entities through the global handles. E.g., we'll need to rethink how we do HTTP callbacks in the consensus module because they depend on the ability to "change the state of the machine" based on HTTP responses, whereas the HTTP client only allows for a generic callback. This type of pattern is used in a few places, and each one will require a rethink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions