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

[network] Feature: support static node #280

Merged
merged 8 commits into from
Jan 12, 2023

Conversation

0xcb9ff9
Copy link

@0xcb9ff9 0xcb9ff9 commented Jan 10, 2023

Description

this PR add static node feature, static nodes configured for normal node not remove on runtime. unlike bootnode, node connections to static nodes is keep alive, if the connection is disconnected, node will actively try to reconnect static node (management connections is not affected by this PR)

command change

  1. command dogechain genesis add --staticnode Flag
  2. genesis file add staticnodes field
  3. command dogechain peers add add --static Flag, dynamically add static nodes

genesis file simple:

{
.......
    "bootnodes": [
        "/ip4/10.5.0.15/tcp/1478/p2p/16Uiu2HAm7oonKfext8YgFCAMNWZKuXP2dpvnamCrN2VxjqTS54y3"
    ],
    "staticnodes": [
        "/ip4/10.5.0.15/tcp/1478/p2p/16Uiu2HAm7oonKfext8YgFCAMNWZKuXP2dpvnamCrN2VxjqTS54y3"
    ]
}

Changes include

  • New feature (non-breaking change that adds functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

  1. create static nodes genesis file (1 boot node, 4 validator node, validator node configured boot node as a static node)
  2. start up dogechain node
  3. stop rpc node
  4. check validator node is try reconnect rpc node

@0xcb9ff9 0xcb9ff9 added the feature New update to Dogechain label Jan 10, 2023
@0xcb9ff9 0xcb9ff9 self-assigned this Jan 10, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2023

Codecov Report

Merging #280 (97f4c14) into dev (a840ee8) will decrease coverage by 3.32%.
The diff coverage is 40.51%.

@@            Coverage Diff             @@
##              dev     #280      +/-   ##
==========================================
- Coverage   51.21%   47.88%   -3.33%     
==========================================
  Files         117      127      +10     
  Lines       17525    19420    +1895     
==========================================
+ Hits         8975     9300     +325     
- Misses       7789     9329    +1540     
- Partials      761      791      +30     
Impacted Files Coverage Δ
blockchain/storage/kvstorage/kvstorage.go 54.16% <ø> (+2.46%) ⬆️
chain/chain.go 28.69% <ø> (ø)
consensus/ibft/hooks.go 55.26% <ø> (ø)
consensus/ibft/pos.go 0.00% <0.00%> (ø)
helper/keccak/keccak.go 0.00% <ø> (ø)
helper/keccak/pool.go 0.00% <ø> (ø)
jsonrpc/debug_endpoint.go 36.08% <0.00%> (-0.76%) ⬇️
jsonrpc/net_endpoint.go 0.00% <0.00%> (ø)
network/bootnodes.go 100.00% <ø> (ø)
network/connections.go 98.07% <ø> (ø)
... and 108 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

Good work.
Only a few suggestions here

network/staticnodes.go Outdated Show resolved Hide resolved
network/staticnodes.go Show resolved Hide resolved
network/server.go Outdated Show resolved Hide resolved
network/staticnodes.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

One question.

network/staticnodes.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

Thanks for the great job 🙌

@DarianShawn DarianShawn merged commit 24ab44e into dogechain-lab:dev Jan 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2023
@0xcb9ff9 0xcb9ff9 deleted the feature/static-node branch January 13, 2023 04:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Dogechain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants