Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticking without ARB packet / Improvement on computor list #213

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

fnordspace
Copy link

Overview

This PR implements a mechanism for nodes to compute and validate their own computor list during epoch transitions.

Key Features

  • Implements computor index assignment logic:
    • Requalifying computors retain their previous indices
    • New computors are assigned to available indices sequentially
  • Computation occurs between EndEpoch() and StartEpoch(), using system.futureComputors
  • Added useSelfGeneratedComputor flag to track list status and ARB signature verification
  • New validation system for ARB-signed computor lists:
    • If lists match: Continue operation and mark as verified
    • If lists differ: Trigger Critical Situation 2 and pause ticking
    • Automatic recovery when matching ARB list is received while in Critical Situation 2
  • Added safeguards in processBroadcastComputors() to hinder broadcasting self-generated list
  • Extends critical situation system with code 2 which stops tickProcessor.

Testing

Nothing tested yet. The following tests are needed:

  • Epoch transitions with both requalifying and new computors
  • Handling of ARB-signed list arrival
  • Recovery from Critical Situation 2
  • Index assignment consistency across nodes

- Add self-generated computor list and related flags
- Implement saving of future computors at end of epoch for next epoch use
- Update beginEpoch to use self-generated computor list when available
- Modify processBroadcastComputors to compare ARB list with self-generated list
- Modify tickProcessor to handle self-generated computor list scenarios
- Add warnings and debug messages for unverified self-generated lists
- Update main loop to display warning for unverified self-generated lists

This commit allows the network to continue ticking with a self-generated
computor list in the case of seamless transition when the ARB list is not
 available, improving network resilience while maintaining the ability to
 verify against the official ARB list when received.
- Add logic to maintain indices for computors keeping their status
- Introduce temporary arrays to manage computor list reorganization
- Implement two-phase approach for computor list generation:
  1. Preserve indices for continuing computors
  2. Fill remaining spots with new computors
- Add error handling for unexpected scenarios
- Update selfGeneratedComputors with the newly organized list

This commit ensures that computors maintaining their status across
epochs keep their original indices, while new computors are assigned
to the remaining available slots. This change enhances the continuity
and predictability of the network's computor assignment process.
Instead of allocating seperate memory for the temporary computor list
we use the reorgBuffer. This also solves a problem where the compiler
tries to optimize the function with the use of memset, which is not
available.
In the case that the computorlist is self generated and not signed by
the arbitrator we do not send computorlist to other nodes.
In case that the self-generated computorlist and the list of ARB is
different.
If a new list of ARB is broadcasted which matches continue ticking
again.
@fnordspace fnordspace self-assigned this Nov 6, 2024
@philippwerner philippwerner linked an issue Nov 7, 2024 that may be closed by this pull request
Copy link
Contributor

@philippwerner philippwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! But I have some minor requests, see inline comments.

src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
Fix issues during review.
Make use of clang-format with style 'Microsoft' for formating.
Switch bs->SetMem and bs->CopyMem to setMem and copyMem functions.
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
src/qubic.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@philippwerner philippwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor issues are left.

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.

Ticking without ARB packet / Improvement on computor list
2 participants