npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

optimistic-roll-in

v0.0.16

Published

Layer-Agnostic Optimistic Roll-Ins - A Proof of Concept.

Downloads

36

Readme

optimistic-roll-in

Status

Just a Proof Of Concept, with Smart Contracts and JS Client. Only "happy path" tested. No security review. Feedback welcome and wanted.

Brief

If your contract(s) has any functionality that results in isolated state changes for individual accounts (which means you could rewrite certain function to take in the user's state, and some arguments, and result in a new state, via a pure function) then this library should allow your users to perform Optimistic Roll Ins. Effectively, your users can assert their intent to the chain, by providing their current state, the call data they would have sent to the chain normally, and their expected new state, and optimistically update their state, without wasting any gas actually performing the on-chain verifications and logic. They can perform as many of these state transitions as they want, one at a time, or even cheeper in batch (allowing for offline play and syncing afterwards), and any other users can validate their proposed state changes after the fact, and prove if anyone committed fraud. Users can enter and exit this "optimistic" state at will (some conditions) so that they can perform non-optimistic transitions that are the result on non-pure functions in your contract.

Things to note:

  • There is a small overhead for each call, associated with the Optimistic functionality, so if all or most of your normal state transitions are cheaper than that, then it may not make sense to use this. The overhead varies, depending on the type of data.
  • This is ideal for things like games that have some single-player component, since many account state transitions don't rely on the shared world's state.
  • This is ideal for things that involve very expensive proofs (like ZKPs, where 90%+ of transaction gas is spent verifying the proof), since they can be performed optimistically, and verified offline by others, and challenged on-chain.
  • This is not ideal not ideal if the "world state" (i.e. global/shared variables) are used throughout your code, since it means your state transitions are not "pure".
  • There is no L2 here. As a matter of fact, this is layer-agnostic, which means that while it could run on its own on mainnet, it could theoretically run on EVM-based L2s (like Optimism / Optimistic Roll Up).

Examples and more coming soon. Feel free to reach out with questions.