Skip to content

Refactor code layout to prevent architectural confusion #1022

@ryardley

Description

@ryardley

Problem

The current ciphernode folder structure doesn't reflect our architectural dependency goals. Because we tried to keep things flat - it has meant that core business logic modules appear mixed with infrastructure code, making it unclear that core modules should never depend on EVM or networking code or anything else aside from the events module. This separation is essential for keeping core code easily testable.

Proposed Solution

Refactor the ciphernode code to clearly indicate component dependencies by colocating all core logic modules in a dedicated core/ folder.

Modules to move into core/:

  • keyshare
  • sortition
  • events
  • aggregator
  • request rename event-router
  • utility (*anything we use in core like ArcBytes)
  • fhe (to be deleted - although a couple of routine will need to be relocated)

Rules for core:

  • Must exist completely in memory and have no IO. (except the event bus)
  • All external capabilities come through events
  • No blocking

Rationale

We originally had this structure but flattened it under the assumption that "flat is better than nested." However, this lost the important distinction between core and non-core modules.

Implementation

  1. Create a core/ folder
  2. Move each listed crate into it, including the tests folder
  3. Add a README explaining the dependency rules: packages in core/ should never depend on external infrastructure packages (EVM, networking, etc.), with the sole exception of the events package which everything depends on

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciphernodeRelated to the ciphernode packagerefactoringimproving a software's internal structure without changing its external behavior or functionality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions