You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
The idea behind log2 ancestors is to keep a record of some block hashes in the history of the chain.
decl_storage!{Ancestors: map BlockNumber => (BlockNumber,Hash);}fninitialise(){let number = current_number() - 1;let parent_hash = parent_hash();letmut index = 0;letmut working_number = number;while index < 32{Ancestors::put(index,(number, parent_hash));// storageif working_number % 2 != 0{break}
working_number /= 2;
index += 1;}// post-condition: Ancestors(index) stores the hash and// number of the last block whose number was divisible by 2^index.}
We can use this module to safely skip backwards in the finalized chain, so long ancestry proofs become shorter.
The idea behind log2 ancestors is to keep a record of some block hashes in the history of the chain.
We can use this module to safely skip backwards in the finalized chain, so long ancestry proofs become shorter.