Git Product home page Git Product logo

Comments (3)

lazovicff avatar lazovicff commented on July 19, 2024

We will need a simpler form of caching where we save the latest root hash every few blocks, just so the clients can create proof against it and submit it before it changes. #8 (comment)

from anon.

lazovicff avatar lazovicff commented on July 19, 2024

The solution mentioned above will still leave some failing transactions so, in order to provide a smooth experience, a simpler solution can be like:

Just have a linked list of the last n root hashes, keep track of the head and the tail in the list. Every t blocks remove the tail root hash and insert the current one (taken from storage) to the head of the list. This linked list can be implemented with BTreeMap. This is done inside the on_finalize inside mixer pallet, but there will be a standalone function inside the Merkle pallet, so people can call it on demand

Improvements from the current caching strategy:

  1. No need to pass the block number to specify where is the root hash that you constructed proof for (for v1 at least)
  2. Smaller memory footprint

from anon.

drewstone avatar drewstone commented on July 19, 2024

So the feeling I'm getting is that we shouldn't touch the cache at all. It is sufficient for the use case atm and is efficiently implemented in the module's storage. It supports pruning to arbitrary length as specified in the runtime and we can set this to be anything reasonable for now.

As for block number, since we always carry it forward. You can just query latest block - 1 to get the previous root to prove against.

from anon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.