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

feat(statement-distribution) Implement FanIn approach to statement distribution #4390

Open
3 tasks
EclesioMeloJunior opened this issue Dec 9, 2024 · 1 comment · May be fixed by #4406
Open
3 tasks

feat(statement-distribution) Implement FanIn approach to statement distribution #4390

EclesioMeloJunior opened this issue Dec 9, 2024 · 1 comment · May be fixed by #4406
Assignees
Labels
C-simple Minor changes changes, no additional research needed. Good first issue/review. S-subsystems-backing issues related to polkadot host backing subsystem functionality. T-implementation this issue/pr is a new feature or functionality.

Comments

@EclesioMeloJunior
Copy link
Member

EclesioMeloJunior commented Dec 9, 2024

Issue summary

  • Currently, the statement distribution pkg already has the Run method that keeps listening from overseer
  • We need to improve this approach to enable it to also listen to other channels, like a FanIn pattern

Implementation details

Here is the pseudo code:

INSTANCE:
    chan v2_req_receiver
    
    // Collects reputation changes and sends them in one batch to relieve network cahnnels
    reputation ReputationAggregator

ENTRYPOINT:

    chan v2_comm_channel
    spawn -> task_responder 
                args[INSTANCE.v2_req_receiver, v2_comm_channel]       

infinity loop {
    
    await_for {
    
    reputation_delay:
        INSTANCE.reputation.send()
        reset(reputation_delay)
        continue
    
    FanIn(
        state,
        overseer_channel:
        v2_comm_channel,
    ):
        
        case message:
        From(SubsystemMsg):
            Handle_Subsystem_Message
        From(V1Requester):
            Handle_LegacyV1_Requester_Message
        From(V1Responder):
            Handle_LegacyV1_Responder_Message
        From(V2Responder):
            Handle_V2_Answer_Request
        From(Receive_Response):
            Handle_V2_Handle_Response
        From(Retry_Request)
            // do nothing
    
    }
    
    Dispatch_V2_Requests
}

The FanIn pseudo-code:

FanIn:
    req_manager, resp_manager = INSTANCE.state.req_res_manager()
    receiver_resp_ch := receive_resp(resp_manager)
    retry_req_ch := next_entry(req_manager)

    select {
    
    case msg <- overseer_channel:
        return SingleOutputCh <- MuxedMessage {
            SubsystemMsg: msg
        }
    case msg <- v2_comm_channel:
        return SingleOuputCh <- MuxedMessage {
            V2Responder: msg
        }
    case msg <- receiver_resp_ch:
        return SingleOutputCh <- MuxedMessage {
            Receive_Response: msg
        }
    case msg <- retry_request:
        return SingleOutputCh <- MuxedMessage {
            Retry_Request: msg
        }
    }

Other information and links

Acceptance criteria

  • Handle the incoming channels
  • Define interface for ReputationAggregator
  • Create a test function that setup the subsystems and returns the channels to communicate with the subsystems and receive messages from it.
@EclesioMeloJunior EclesioMeloJunior added T-implementation this issue/pr is a new feature or functionality. C-complex Complex changes across multiple modules. Possibly will require additional research. S-subsystems-backing issues related to polkadot host backing subsystem functionality. labels Dec 9, 2024
@DanielDDHM
Copy link

can i tackle this?

@EclesioMeloJunior EclesioMeloJunior added C-simple Minor changes changes, no additional research needed. Good first issue/review. and removed C-complex Complex changes across multiple modules. Possibly will require additional research. labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-simple Minor changes changes, no additional research needed. Good first issue/review. S-subsystems-backing issues related to polkadot host backing subsystem functionality. T-implementation this issue/pr is a new feature or functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants