Skip to content

Conversation

@PropzSaladaz
Copy link
Collaborator

@PropzSaladaz PropzSaladaz commented Dec 5, 2025

Description

  • Refactored all BITE-related functionality into 3 different classes:
    • BiteCodec - includes all logic of encoding / decoding BITE data to / from transactions. This includes knowing how BITE data is encoded into RLP, etc
    • BiteCore - includes all logic related to core crypto functionality - encryption, decryption, validation of ciphertexts
    • BiteEngine - includes mainstream logic like BITE tx parsing, validation, merging, etc

BiteManager is now mostly a glue layer that couples schain information with bite-related logic (things like thread executors, if sgx is enabled, if we want to use real crypto, totalSigners, requiredSigners, etc).
BiteManager keeps an isntance of BIteEngine that is initialized at the start, and holds state data itself.

Almost all code removals refer to moving code into its own file. This includes moving any serialization code into BiteCodec, as well as moving most of BiteManager functions into BiteEngine.

By decoupling all Bite data from schain instances, we can now add tests specifically for Bite-related logic.

Also improved thread handling on destruction of consensus:

  • Only join threads iff they can be joinable
  • Monitoring agent now awaits on a cond_var for X time instead of usleep. THis makes possible to stop the thread as soon as possible (which is the case during testing)
  • Added Schain destructor that joins any alive threads before destruction.
  • Added the fix from logThreadLocal_ causes SIGSEGV in unittests #967

IMPORTANT
All bite-2 functionality is exactly the same apart for 1 or 2 bugs, identified from the added tests, that were fixed in this branch

Tests

Added tests for all Bite logic that was refactored:

  • BITE tx parsing, serialization, merging, validation, encoding/decoding, encryption/decryption

Fixes #948

@PropzSaladaz PropzSaladaz self-assigned this Dec 5, 2025
@PropzSaladaz PropzSaladaz changed the base branch from develop to bite-2 December 10, 2025 19:45
@PropzSaladaz PropzSaladaz marked this pull request as ready for review December 22, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BITE Phase 2 support

2 participants