GithubHelp home page GithubHelp logo

Comments (2)

0age avatar 0age commented on September 13, 2024 1

I think it’s important to draw a distinction between the different reasons we would want to make pagination available. (Of course, there are also plenty of scenarios where you just need to effectively query for a particular entry, which we already have covered.) Here’s my take on the main two cases:

  • consumption / usage in dapps - usually best suited to middleware like The Graph for displaying a large list, but good to be able to verify on-chain before submitting a related transaction.
  • on-chain data migrations - for this it’s important that no data gets lost or skipped somehow, which makes arrays desirable, but cost also should be a consideration.

The danger in an unbounded array like we currently have is that the gas cost of memory expansion will grow too large for the function to be called at all. This is less of a concern on the factories, but will be problematic for the actual elements on the registry if we elect to track them on-chain.

The approach we decided to take with TPL and proposed for EIP-1616 was to have two methods - one for getting a count of all elements, and one for getting an element by index. This is particularly nice in our case here because the arrays are append-only, so data will be consistent on every pass through a given range. (See here for an example of what I mean.)

Another option would be to still return an array of elements, but to specify a range between two indexes. This functionality can easily be encapsulated in a wrapper at the cost of some extra overhead.

from erasure-protocol.

thegostep avatar thegostep commented on September 13, 2024

Need to add same getters on registry contracts, will return range of addresses.

from erasure-protocol.

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.