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

Implement block announces in full node #2143

Merged
merged 8 commits into from
Mar 18, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Mar 15, 2022

This PR implements announcing blocks to other peers when in full mode.
In other words, if node A is connected to B, and B is connected C, when A announces a block to B, B will now announce it to C.

After this PR, it is now possible to launch two smoldot full nodes and have them produce a chain.
The CLI flags I use for that are:

./full-node run --chain ./bin/substrate-node-template.json --tmp --listen-addr /ip4/127.0.0.1/tcp/30333 --libp2p-key 0x0000000000000000000000000000000000000000000000000000000000000000 --keystore-memory //Alice --jaeger 127.0.0.1:6831

And:

./full-node run --chain ./bin/substrate-node-template.json --tmp --additional-bootnode /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN --jaeger 127.0.0.1:6831 --json-rpc-address 127.0.0.1:0

The way it's done is rather simple: as soon as we import a block, we determine which sources to announce the block to by doing all_sources - sources_that_we_know_know_the_block. Once announced, we track the fact that this source knows this block.

Copy link
Contributor

@mergify mergify bot left a comment

Choose a reason for hiding this comment

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

Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 15, 2022

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼──────────────────
          +0 ┊ Σ [0 Total Rows]

@tomaka
Copy link
Contributor Author

tomaka commented Mar 15, 2022

This change doesn't make it to the changelog, since it's not relevant to the wasm node.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Mar 18, 2022
@mergify mergify bot merged commit 8136f62 into paritytech:main Mar 18, 2022
@tomaka tomaka deleted the full-block-announces branch March 18, 2022 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge pull request as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants