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

Guarantee net_plugin processes votes after it has has processed the block the vote was for #3

Closed
arhag opened this issue Apr 10, 2024 · 2 comments · Fixed by #24
Closed
Assignees
Labels
👍 lgtm OCI Work exclusive to OCI team

Comments

@arhag
Copy link
Member

arhag commented Apr 10, 2024

Depends on AntelopeIO/leap#2102.

The net_plugin will be responsible for respecting this order per connection. It can leverage the existing cache of block IDs received and sent per connection to know when it is the appropriate time to process the votes per each connection.

We also need to make sure we process the block (add to fork database) before we process the votes for that block, otherwise they will be dropped.

@arhag arhag changed the title IF: Guarantee net_plugin processes votes after it has has processed the block the vote was for Guarantee net_plugin processes votes after it has has processed the block the vote was for Apr 10, 2024
@arhag arhag added this to the Savanna: Production-Ready milestone Apr 10, 2024
@heifner
Copy link
Member

heifner commented Apr 10, 2024

  • 3000 vote_message (size 32+1+96+192) is less than 1MB.
    • Limit to 3000 votes per connection, drop incoming votes if > 3000
    • Maintain count per connection for quick check
  • Purge votes on LIB (index by block_num)
  • Active thread pool for processing
    • We know we don't want to use net threads
    • Chain threads would compete with trx signature verification. Don't want trx sig verification slowing down votes.
    • New thread pool (vote processing)
      • --vote-threads default to 2 4
    • vote_processor in chain library
   atomic<uint32_t> latest_block_num;
   atomic<uint32_t> lib;
   set_lib(lib) { lib = lib; notify_one(); }
   add_vote( v ) { append(v); latest_block_num = std::max(latest_block_num, v.block_num); notify_one(); }

   each thread:
      while (true) {
         _cond.wait([]() {
            if (stopped || !empty) return true;
         }
         if (stopped) break;
         remove_votes_before_lib();
         uint32_t block_num = latest_block_num;
         block_state_ptr bsp = forkdb.get(block_num);
         for each connection by latency {
            if( block_num != latest_block_num) {
               block_num = latest_block_num;
               bsp = forkdb.get(block_num);
            }
            process_votes_for_block(conn_id, bsp);
            block_num = idx.get_latest_block_num();
         }
      }

   process_votes_for_block(conn_id, bsp) {
      for bsp->finalizer_size():
         process_vote(conn_id, bsp);
   }

@heifner
Copy link
Member

heifner commented Apr 10, 2024

heifner added a commit that referenced this issue Apr 11, 2024
heifner added a commit that referenced this issue Apr 11, 2024
heifner added a commit that referenced this issue Apr 11, 2024
@heifner heifner moved this from Todo to In Progress in Team Backlog Apr 11, 2024
@heifner heifner linked a pull request Apr 11, 2024 that will close this issue
heifner added a commit that referenced this issue Apr 11, 2024
heifner added a commit that referenced this issue Apr 11, 2024
heifner added a commit that referenced this issue Apr 12, 2024
…at time of C production it will not get a block until A turn. Need to wait at least 7 seconds. Used 10 here to provide a bit of buffer.
heifner added a commit that referenced this issue Apr 12, 2024
heifner added a commit that referenced this issue Apr 16, 2024
heifner added a commit that referenced this issue Apr 16, 2024
heifner added a commit that referenced this issue Apr 17, 2024
heifner added a commit that referenced this issue Apr 17, 2024
heifner added a commit that referenced this issue Apr 18, 2024
heifner added a commit that referenced this issue Apr 18, 2024
heifner added a commit that referenced this issue Apr 18, 2024
heifner added a commit that referenced this issue Apr 18, 2024
heifner added a commit that referenced this issue Apr 18, 2024
heifner added a commit that referenced this issue Apr 19, 2024
IF: Process votes in a dedicated thread pool
@heifner heifner closed this as completed Apr 19, 2024
@github-project-automation github-project-automation bot moved this from Awaiting Review to Done in Team Backlog Apr 19, 2024
systemzax added a commit that referenced this issue Jul 25, 2024
… leave room for additional test covering joint finalizer policies
systemzax added a commit that referenced this issue Aug 8, 2024
systemzax added a commit that referenced this issue Aug 8, 2024
systemzax added a commit that referenced this issue Aug 21, 2024
systemzax added a commit that referenced this issue Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 lgtm OCI Work exclusive to OCI team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants