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

Trusted state synchronization on a restricted basis for faster IBD #272

Open
dahlia opened this issue Jun 4, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@dahlia
Copy link
Member

commented Jun 4, 2019

In principle, every single node should calculate their own states from the given transactions and actions from scratch, even though every node will eventually have the same deterministic states. Unlike transactions signatures, the only way to verify states in itself is to simply calculate transactions from scratch and compare them with the calculated result. There's no way to digest the calculation in itself; calculating and verifying states cost the same.

The problem is that evaluating actions is hard to predict how long they will take. As a rule of thumb, according to @longfin, validating actions (which requires evaluating them) take more than 10% of the time during receiving new blocks.

If a node wants to leverage states already calculated by peers it must trust them first. However, blindly trusting peers makes the network fragile, because a malicious (or malfunctioning) node could send invalid states to peers. Therefore if we're willing to trust some peers, it has to be allowed on only a restricted basis.

So I suggest an option to trust peers to use states calculated by them in a restricted-enough manner. API-wise this would basically look like: the Swarm constructor has a new optional parameter named trustedStateValidators. The type of this is a set of peers, i.e., IImmutableSet<PublicKey>. Such a whitelist approach implements the decentralized trust model in the concept of web of trust. The basic idea is that a game player should decide what peers to trust, through a configuration file or, ideally, GUI. Although each node could make some wrong decision on whom to trust, these mistakes do not impact on the entire network on a bigger scale.

There should be one more restriction on it IMHO: precalculated states should be leveraged only for IBD. If a node once catches up the topmost block of the major blockchain, a node should calculate states from the received transactions by itself.

Opinions?

@dahlia dahlia added this to the 0.4.0 milestone Jun 4, 2019

@dahlia dahlia self-assigned this Jun 4, 2019

@earlbread

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

I agree with your suggestion.
It sounds good to have trustedStateValidators and use them only for IBD.

@longfin

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.