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

add(network): Adds a network magic field to testnet::Parameters and the config #8524

Merged
merged 12 commits into from
May 18, 2024

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented May 14, 2024

Motivation

We want to allow for configuring the network magic on custom testnets.

Part of #7845.
Depends-On: #8518.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

Solution

  • Moves network Magic type from zebra-network to zebra-chain
  • Adds a network_magic field on testnet::Parameters and uses it in the network codec
  • Reads a network magic from the config

Testing

  • Adds a stored test config
  • Updates a Magic debug impl test
  • Adds a test to check that the codec returns an error when messages have unexpected network magics

We could also add a test for the constraints in testnet::ParametersBuilder::with_network_magic() (can't be the network magic of a default network) if we want.

Review

Anyone can review.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

Follow Up Work

Accept peer IPs in the config as initial peers.

@arya2 arya2 added A-network Area: Network protocol updates or fixes NU-6 Network Upgrade: NU6 specific tasks C-testing Category: These are tests P-Medium ⚡ labels May 14, 2024
@arya2 arya2 self-assigned this May 14, 2024
@arya2 arya2 requested review from a team as code owners May 14, 2024 01:02
@arya2 arya2 requested review from oxarbitrage and removed request for a team May 14, 2024 01:02
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label May 14, 2024
@arya2 arya2 requested a review from oxarbitrage May 17, 2024 19:38
Base automatically changed from params-target-difficulty-limit to main May 17, 2024 23:06
Copy link
Contributor

@oxarbitrage oxarbitrage 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. Thanks.

mergify bot added a commit that referenced this pull request May 18, 2024
@mergify mergify bot merged commit 5ca40aa into main May 18, 2024
191 checks passed
@mergify mergify bot deleted the params-network-magic branch May 18, 2024 20:31
@mpguerra mpguerra linked an issue May 21, 2024 that may be closed by this pull request
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: Network protocol updates or fixes C-testing Category: These are tests C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG NU-6 Network Upgrade: NU6 specific tasks P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: Add parameters to Network::Testnet variant
2 participants