stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

Feat: Nakamoto p2p block support

Open jbencin opened this issue 1 year ago • 4 comments

Description

Add support for Nakamoto blocks in p2p code

This is a work in progress. I'm marking it as ready for review even though I don't have tests written in order to get feedback

Applicable issues

  • fixes #4069

Additional info (benefits, drawbacks, caveats)

Issue Checklist

  • [x] Nakamoto block wire format
    • [x] Contains a ConsensusHash that identifies the tenure, and a Vec<NakamotoBlock> for the blocks themselves
    • [x] New StacksMessageID value and StacksMessageType variant
    • [x] New codec for the block message
  • [x] Updating stackslib/src/net/chat.rs to handle incoming Nakamoto blocks
    • [ ] Only if the current epoch is epoch 3.0 (I will add this once #3710 gets merged with DeserializeWithEpoch trait)
    • [ ] The block message's consensus hash should be in our burnchain history; otherwise the message is dropped
    • [x] The message needs to count towards that remote peer's bandwidth metering
  • [x] Updating NetworkResult to store received and validated Nakamoto blocks, and report that there is data to store
  • [x] Updating Relayer::process_network_result() to accept new Nakamoto blocks via Relayer::process_new_nakamoto_block()

Standard Checklist

  • [ ] Test coverage for new or modified code paths
  • [ ] Changelog is updated
  • [ ] Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • [ ] New clarity functions have corresponding PR in clarity-benchmarking repo
  • [ ] New integration test(s) added to bitcoin-tests.yml

jbencin avatar Dec 20 '23 16:12 jbencin

Codecov Report

Attention: 265 lines in your changes are missing coverage. Please review.

Comparison is base (3e21883) 82.91% compared to head (0e58dd6) 82.87%.

Files Patch % Lines
stackslib/src/net/relay.rs 30.83% 157 Missing :warning:
stackslib/src/net/codec.rs 45.19% 57 Missing :warning:
stackslib/src/net/chat.rs 90.66% 21 Missing :warning:
stackslib/src/net/mod.rs 26.08% 17 Missing :warning:
stackslib/src/chainstate/coordinator/comm.rs 36.36% 7 Missing :warning:
stackslib/src/monitoring/mod.rs 0.00% 4 Missing :warning:
stackslib/src/chainstate/stacks/db/blocks.rs 0.00% 1 Missing :warning:
testnet/stacks-node/src/neon_node.rs 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #4202      +/-   ##
==========================================
- Coverage   82.91%   82.87%   -0.05%     
==========================================
  Files         429      429              
  Lines      302864   303328     +464     
==========================================
+ Hits       251107   251368     +261     
- Misses      51757    51960     +203     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 20 '23 16:12 codecov[bot]

Hold off the merge until Network State machines are done

saralab avatar Feb 08 '24 15:02 saralab

Hold off the merge until Network State machines are done

https://github.com/stacks-network/stacks-core/pull/4476

wileyj avatar Mar 08 '24 18:03 wileyj

Was just checking through my PR review todos -- should this PR be revisited now?

obycode avatar May 03 '24 21:05 obycode

Closing this, it's being handled part of the block push changes

saralab avatar Jun 10 '24 16:06 saralab