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

@aztec/world-state

v0.63.1

Published

## Overview

Downloads

789

Readme

World State

Overview

The primary functions of the world state package are to maintain the collection of Merkle Trees comprising the global state of the system and to offer an interface with which the trees can be queried.

The Merkle Tree DB, a collection of Merkle Trees of varying types.

As of the time of writing the collection consisted of the following trees.

Standard 'Append Only' trees

  • The Contract Tree. Every contract created within the system has a 'Function Tree', a tree of leaves generated from the functions on the contract. The root of the function tree is inserted as a leaf in the contracts tree.
  • The Contract Tree Roots Tree. A tree whose leaves are the historical roots of the contract tree.
  • The Note Hash Tree. A tree whose leaves are the note hashes of notes generated by the private contract function calls within the system.
  • The Note Hash Tree Roots Tree. A tree whose leaves are the historical roots of the note hash tree.

Indexed trees

  • The Nullifier Tree. A tree whose leaves contain the consumed values (commitments, tx hashes etc) of the system.

Sparse trees

  • The Public Data Tree. A tree whose leaves are the current value of every item of public state in the system, addressed as leaf_index = hash(contract_address, storage_slot_in_contract)

The Synchronizer

The synchronizer's role is to periodically poll for new block information and reconcile that information with the current state of the Merkle Trees.

Once a new block is received, the synchronizer checks the uncommitted root values of all of the trees against the roots published as part of the block. If they are all equal, the tree state is committed. If they are not equal, the tree states are rolled back to the last committed state before the published data is inserted and committed.

The Merkle Tree Interface

The interface to the Merkle Tree DB offers a unified asynchronous API to the set of trees available. Reads from the Merkle Trees need to be marked as to whether they should include uncommitted state. For this reason, the MerkleTreeReadOperationsFacade exists to abstract this detail away from the end consumer.

Building/Testing

Building the package is as simple as calling yarn build from the package root.

Running yarn test will execute the packages unit tests.