1. Jun 19, 2024
  2. Jun 18, 2024
  3. Jun 17, 2024
  4. Jun 14, 2024
  5. Jun 13, 2024
  6. Jun 12, 2024
  7. Jun 11, 2024
    • cheme's avatar
      Append overlay optimization. (#1223) · ad862092
      cheme authored
      
      
      This branch propose to avoid clones in append by storing offset and size
      in previous overlay depth.
      That way on rollback we can just truncate and change size of existing
      value.
      To avoid copy it also means that :
      
      - append on new overlay layer if there is an existing value: create a
      new Append entry with previous offsets, and take memory of previous
      overlay value.
      - rollback on append: restore value by applying offsets and put it back
      in previous overlay value
      - commit on append: appended value overwrite previous value (is an empty
      vec as the memory was taken). offsets of commited layer are dropped, if
      there is offset in previous overlay layer they are maintained.
      - set value (or remove) when append offsets are present: current
      appended value is moved back to previous overlay value with offset
      applied and current empty entry is overwrite (no offsets kept).
      
      The modify mechanism is not needed anymore.
      This branch lacks testing and break some existing genericity (bit of
      duplicated code), but good to have to check direction.
      
      Generally I am not sure if it is worth or we just should favor
      differents directions (transients blob storage for instance), as the
      current append mechanism is a bit tricky (having a variable length in
      first position means we sometime need to insert in front of a vector).
      
      Fix #30.
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      Co-authored-by: default avatarEgorPopelyaev <[email protected]>
      Co-authored-by: default avatarAlexandru Vasile <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      ad862092
    • Sebastian Kunert's avatar
      finalization: Skip tree route calculation if no forks present (#4721) · 96ab6869
      Sebastian Kunert authored
      ## Issue
      
      Currently, syncing parachains from scratch can lead to a very long
      finalization time once they reach the tip of the chain. The problem is
      that we try to finalize everything from 0 to the tip, which can be
      thousands or even millions of blocks.
      
      We finalize sequentially and try to compute displaced branches during
      finalization. So for every block on the way, we compute an expensive
      tree route.
      
      ## Proposed Improvements
      
      In this PR, I propose improvements that solve this situation:
      
      - **Skip tree route calculation if `leaves().len() == 1`:** This should
      be enough for 90% of cases where there is only one leaf after sync.
      - **Optimize finalization for long distances:** It can happen that the
      parachain has imported some leaf and then receives a relay chain
      notification with the finalized block. In that case, the previous
      optimization will not trigger. A second mechanism should ensure that we
      do not need to compute the full tree route. If the finalization distance
      is long, we check the lowest common ancestor of all the leaves. If it is
      above the to-be-finalized block, we know that there are no displaced
      leaves. This is fast because forks are short and close to the tip, so we
      can leverage the header cache.
      
      ## Alternative Approach
      
      - The problem was introduced in #3962. Reverting that PR is another
      possible strategy.
      - We could store for every fork where it begins, however sounds a bit
      more involved to me.
      
      
      fixes #4614
      96ab6869
  8. Jun 10, 2024
  9. Jun 08, 2024
  10. Jun 07, 2024
  11. Jun 06, 2024