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

Full and archive nodes #293

Merged
merged 12 commits into from Apr 4, 2020
Merged

Full and archive nodes #293

merged 12 commits into from Apr 4, 2020

Conversation

grantnoble
Copy link

This combines the changes made in PR #283

Grant Noble added 5 commits April 1, 2020 16:47
priv_getCode API method (#145)
Include a section (in Pruning.md) about the difference between the two nodes and how to run them. Misc changes to the various pruning options and sync mode options.

Signed-off-by: grantnoble <grant.noble@consensys.net>
Signed-off-by: grantnoble <grant.noble@consensys.net>
Signed-off-by: grantnoble <grant.noble@consensys.net>
Included a "Fast Synchronization" section in Pruning.md

Signed-off-by: grantnoble <grant.noble@consensys.net>
grantnoble added 2 commits April 2, 2020 11:18
Specifically:
- Archive node is full sync and not pruned
- Full node is fast sync and pruned
- Pruning is default on for fast sync and off for full sync. Can turn pruning on/off explicitly if they so choose.
- Full nodes have the current state, so can’t serve the network with any data request (i.e. balance of address X at block Y, where Y is old). You can guarantee the latest state for everything (and some older states, but not all).

Signed-off-by: grantnoble <grant.noble@consensys.net>
Signed-off-by: grantnoble <grant.noble@consensys.net>
@grantnoble grantnoble requested a review from timbeiko April 2, 2020 01:25
Copy link
Contributor

@NicolasMassart NicolasMassart 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 to me.

@@ -49,7 +49,7 @@ the revert reason as an ABI-encoded string.
The revert reason is not included in the transactions receipts root hash. Not including the
revert reason in the transactions receipts root hash means the revert reason is only available
to nodes that execute the transaction when importing the block. That is, the revert reason is
not available if using fast sync.
not available if using fast synchronization (`--sync-mode=FAST`).
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a link to ../../Reference/CLI/CLI-Syntax.md#sync-mode ?

Copy link
Author

Choose a reason for hiding this comment

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

Done.


Besu supports two node types, commonly referred to as _full nodes_ and _archive nodes_.

Full nodes have just the current state of the blockchain so cannot serve the network with all data
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove the just to reflect that they can have more than the current state.

Copy link
Author

Choose a reason for hiding this comment

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

Done.


Archive nodes require significantly more disk space (approximately 3TB) than full nodes
(approximately 750GB).

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe one thing we should add is that it is possible to re-generate all the data for an archive node using a full node (it's long, inconvenient, etc., but the data is not lost).

Copy link
Author

Choose a reason for hiding this comment

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

What is the process for this? If we say you can do it, we should document how.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not trivial, not something that most people will want to do (easier to just sync an archive node), but it just speaks to the security properties of a full node. Thinking about it again, I'm not sure how relevant it is here 😅

Copy link
Author

Choose a reason for hiding this comment

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

OK. We'll leave it as is. Thanks!

contract for every block since the genesis block. With an archive node you can do everything you
do with a full node, as well as access historical state data.

Archive nodes require significantly more disk space (approximately 3TB) than full nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth adding these are Besu numbers, as they differ from other client implementations, especially for full nodes. We should also precise this is for mainnet.

Copy link
Author

Choose a reason for hiding this comment

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

Done.


Instead of a full synchronization ([`--sync-mode=FULL`](../Reference/CLI/CLI-Syntax.md#sync-mode)),
which starts from the genesis block and reprocesses all transactions, fast synchronization
([`--sync-mode=FAST`](../Reference/CLI/CLI-Syntax.md#sync-mode)) downloads the transaction receipts
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't it also verify some blocks? I thought it did verify 1/n blocks, see: ethereum/go-ethereum#1889. I'm not sure if our implementation is the same, though. cc: @RatanRSur

Also, it's worth highlighting that past the pivot block, fast sync switches to full sync.

Copy link
Contributor

Choose a reason for hiding this comment

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

It verifies the chain of headers from the genesis until a block when it switches to processing blocks in their entirety (full sync as you mentioned).

I would mention that it downloads the headers but I wouldn't mention that it switches to full sync at because it's an implementation detail and isn't really something they can rely on. The guarantee we give them is that they'll have the full current state but we don't want them assuming they'll have full state from any previous block because the pivot block switches many times while downloading the world state.

Copy link
Author

Choose a reason for hiding this comment

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

Done.


Use pruning to reduce storage required for the world state. Pruning removes state trie nodes that
are not required.
Pruning reduces the storage required for the world state, removing state trie nodes that are not
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't it reduce the storage required by removing state trie nodes from previous states? cc: @RatanRSur

Copy link
Contributor

Choose a reason for hiding this comment

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

Pruning reduces the storage required for by Besu by removing state trie nodes that are unreachable from recent blocks

You can then link to the option --pruning-blocks-retained after the recent blocks statement to make it explicit how "recent" is defined.

Copy link
Author

Choose a reason for hiding this comment

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

Excellent!

@grantnoble grantnoble merged commit c67cdae into hyperledger:master Apr 4, 2020
@grantnoble grantnoble deleted the grantnoble-grantnoble-full-archive-nodes branch April 4, 2020 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants