Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Trusted state synchronization on a restricted basis for faster IBD #272
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
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.