Funding proposal PIBD implementation for Grin++
This is the start of Funding Proposal to implement Parallel Independent Block download (PIBD) [REF] in Grin++.
Why invest in implementing PIBD in Grin++?
The motivation is quite simple. Grin nodes consist for a large part, let’s say around 50%, of Grin++ nodes. Currently Grin++ uses the “. Zip” method to download chain data. There are numerous issues with using zip files such as a) being centralized, b) being vulnerable to attacks, c) easily leading to corrupted or failed downloads, in which case you need to download the whole file again and d) creating zip files requires a lit of memory and cpu recources, making nodes very busy and unavailable, often leading to them being banned because of becoming not responsive.
The grin rust node has switched to using PIBD which is more robust, decentralized and with some further optimizations could easily become a much faster syncing method than downloading zip files from a single peer. This was proven by MWcoin which can sync their chain in 11 minutes with a slightly modified PIBD version [REF].
What is a Funding Proposal?
Some of you might be familiar with Funding Requests by developers but might wonder what a “Funding Proposal” might be. A Funding Proposal is roughly the same as a Funding Requests, but it is initiated by the community or a council, which means it is less of a hassle for developers since there is no question anymore if there is interest to fund implementing a certain function, the only questions to discuss are practicalities like the exact deliverables, estimate time for delivering these deliverables and the amount of funding that is appropriate.
Input from developers is very useful here. Grin rust has PIBD implemented and good documentation exists for PIBD which make implementation easier. However, many optimizations have not been implemented yet in grin rust node. It would be forward thinking to consider the need of a few optimizations in implementation in Grin++ and perhaps put some first optimizations in the deliverables. That might mean some small changes or additions in the existing PIBD messaging are needed.
For who is this Funding Proposal meant?
Although this is an open call, the main idea is to invite @david and @davidtavarez as maintainers of Grin++ and ask if they are interested in taking on this large but important next step in the development of Grin++.
Your input on exact deliverables, how much time you think would be need and appropriate funding, would be examples of valuable contributions to this discussion.
What do we need from community members?
First of all, we discussed this topic shortly between CC members but I would like to invite them formally to give their endorsement and input on how to shape this Funding Proposal:
@Cobragrin @Neo @renzokuken @trab @Trinitron
Also from community members, it would be good to know if you support this initiative and if what you think would be needed to make this endeavor successful.
Pitfalls
We have consider that in the past some of funding towards Grin++ did not lead to a permanent fix. For example, a fix for "no peer " issues was funded before, however this issue persists although for only a few users. It is therefore important to clearly define our deliverables, perhaps put funding to certain deliverables and for developers it is important to inform as early as possible if some unforeseen bottlenecks are encountered that would for example mean deliverables cannot be achieved and perhaps more time and funding are needed?
Deliverables
[Below a list deliverables and update deliverables based on feedback from everyone, below some initial thoughts]
- A working PIBD messaging implementation for Grin++. Nodes need to be compatible in their messaging with other peers like grin Rust nodes.
- A permanent fix to Grin++ nodes mostly connecting to other Grin++ nodes. Probably due to lack of PIBD support for Grin++ but perhaps as well due to different peer banning rules, currently Grin++ nodes mostly connect to other Grin++ nodes. In a dystopian world this could break decentralization and lead to sub networks of grin nodes. Therefore, this issue needs to be investigated and solved to avoid it ever from happening. It should be to difficult ones PIBD has been implemented.
- Some first optimizations, perhaps asking for a list of fragments, or just increasing default segment size. The challenge is that any improvements should not break compatibility with other nodes such as grin rust nodes that not yet have these optimizations implemented.
Funding amount
[Will be based on the discussion]
Information for optimizing PIBD
→ Paralel Initial Block Download PIBD TESTING - #32 by Anynomous
→ MWC coin claims they significantly increased node sync
→ Line 347 mwc-node/core/src/core/pmmr/segment.rs at master · mwcproject/mwc-node · GitHub
→ Line 338 grin/core/src/core/pmmr/segment.rs at master · mimblewimble/grin · GitHub
→ do not check intermediate hashes
- more peers
- Start requesting last 48 hours blocks before end of PIBD
- Larger default segment size, or perhaps a flexible size, increase when a peer has fast response, decrease with slow peers the size
- Skip checks for intermediate hashes of fragments