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

@nomad-xyz/contracts-da-bridge

v1.0.0

Published

Nomad bridge with Polygon Avil

Downloads

6

Readme

Nomad DA Bridge

Solidity implementation of the Nomad Avail Data Attestation Bridge. This application receive data roots from the Avail chain and stores them in a mapping of block numbers to data roots.

Setup

  • yarn bootstrap: yarn clean and yarn build

Build

  • yarn build: compile smart contracts and create definitions for the SDK

Test

For testing, we use Foundry.

  • Run yarn build:accumulator-cli from the root directory of the monorepo. It will build a rust-based cli tool that creates Sparse Merkle Tree proofs for arbitrary data. It's used in our testing suite via the --ffi flag for Forge. The binary is built in there /scripts top-level directory of the monorepo
  • --ffi means that Forge will run arbitrary shell commands as part of the testing suite. You should never run forge --ffi without knowing what exactly are the shell commands that will be executed, as the testing suite could be malicious and execute malicious commands. This is why the feature is disabled by default and must be explicitly enabled.
  • yarn test:unit will run all unit tests. Note that --ffi is enabled by default,
  • yarn snapshot will create a new .gas-snapshot. You can inspect the different gas usage via git diff
  • 'yarn snapshot:check' will run the test suite and check gas consumption against the existing .gas-snapshot. It will pass only if there is no change in the gas consumption
  • yarn gen-proof will execute the accumulator-cli binary

Suggested workflow

  • Define feature
  • Write tests based on Foundry best practices and the existing test structure
  • Run test suite with FOUNDRY_PROFILE=core forge test --ffi -vvv and verify that your new tests FAIL
  • Write the new feature
  • Run again the test suite and verify that the tests PASS
  • Run yarn snapshot to produce the new gas snapshot. You can't use yarn snapshot:check, since you added new tests that are not present in the current .gas-snapshot. Gas snapshots showcase how much gas your tests consume and are useful to serve as a benchmark for the gas consumption of your code. As you write new features and/or refactor your code, the gas snapshot can change, illustrating where your changes affected the already defined codepaths. You can read more about gas snapshots on the Foyndry book
  • Run yarn storage-inspect:check to see if the storage layout of the smart contracts have changed. If it has, this could potentially create problems in the upgrade process. If the new layout is correct, run yarn storage-inspect:generate to create a new layout file (replacing the old one) and commit the new file. If we don't commit the new layout, the CI will fail.

Tip: It is advised to run the forge commands on their own and not via yarn or npm for faster development cycle. yarn will add a few seconds of lag, due to the fact that it has to spin up a Node runtime and the interpret the yarn source code.

Static Analysis

We suggest all contributors to use slither while developing, to avoid common mistakes.

  • Install Slither
  • Run yarn test:static-analyze

We use a yarn command because we need to link the top-level node_modules directory in the core-contracts package. It's a known issue for which the workaround is to link the directory.