ethereum / sharding

Sharding manager contract, and related software and tests
480 stars 105 forks source link

CREATE_COLLATION: incongruity between code and text #43

Closed jamesray1 closed 6 years ago

jamesray1 commented 6 years ago

https://github.com/ethereum/sharding/blob/develop/docs/doc.md#create_collation

This process has three parts. The first part can be called GUESS_HEAD(shard_id), with pseudocode here:

# Download a single collation and check if it is valid or invalid (memoized)
validity_cache = {}
def memoized_fetch_and_verify_collation(b):
    if b.hash not in validity_cache:
        validity_cache[b.hash] = fetch_and_verify_collation(b)
    return validity_cache[b.hash]

def main(shard_id): 
    head = None
    while 1:
        head = fetch_candidate_head(shard_id)
        b = head
        while 1:
            if not memoized_fetch_and_verify_collation(b):
                break
            b = get_parent(b)

fetch_and_verify_collation(c) involves fetching the full data of c (including witnesses) from the shard network, and verifying it.

This uses c but the preceding code uses b.

What's also confusing is that collation headers do not contain a hash member.