ethereum / cbc-casper

GNU Affero General Public License v3.0
229 stars 44 forks source link

Add SkipBlockchain protocol to support skip blocks #182

Open naterush opened 6 years ago

naterush commented 6 years ago

Issue

Checking if one block is "in the blockchain" (in the prev block pointer chain) of another is linear in the length of the chain. Ideally, we could check it sublinearly!

Right now we follow prevblock pointers from the higher-sequence-number-block until we hit the other block (or not). Skipblocks would make checking agreement between blocks more efficient (sublinear instead of linear)

Proposed Implementation

Add a new protocol SkipBlockchain, where messages have pointers to more than just their previous block. A block has pointers to every 2^n blocks for blocks with sequence h, such that h % 2^n == 0, then we could do it in sublinear time.

Furthermore, implement all other functions with these skip blocks in mind, taking advantage of the efficiencies they provide!

staccDOTsol commented 1 year ago

The proposed implementation of the SkipBlockchain protocol sounds interesting. By adding additional pointers to blocks, specifically to blocks with sequence numbers that are multiples of 2^n, we can potentially achieve sublinear time complexity when checking if one block is in the blockchain of another.

This approach would allow us to skip over a certain number of blocks in the chain, reducing the number of steps required to reach the desired block. By leveraging these skip blocks, we can improve the efficiency of various functions that rely on block agreement.

Implementing the SkipBlockchain protocol would require modifying the existing block structure to include the additional pointers. Additionally, all relevant functions would need to be updated to take advantage of the efficiencies provided by the skip blocks.

Overall, this proposal has the potential to enhance the performance of blockchain operations by reducing the time complexity of certain operations. However, it would require careful implementation and testing to ensure its effectiveness and compatibility with the existing Ethereum ecosystem.