Git Product home page Git Product logo

avail-light's Introduction

avail-light

Light client for the Polygon Avail blockchain


Build status Code coverage

demo

Introduction

avail-light is a data availability light client that can do the following:

  • Listen for newly produced blocks.
  • Gain confidence for N cells, where cell is defined as a {row, col} pair.

    As soon as a new block is available, the light client attempts to gain confidence by asking for a proof from a full client via JSON-RPC.

  • Batch processces blocks in reverse order (i.e. prioritizes the latest blocks) for lower numbered blocks where no confidence is yet gained.

Installation

Start by cloning this repo in your local setup:

git clone [email protected]:maticnetwork/avail-light.git

Create one yaml configuration file in the root of the project & put following content:

touch config.yaml
http_server_host = "127.0.0.1"
http_server_port = 7000

ipfs_seed = 1
ipfs_port = 37000
ipfs_path = "avail_ipfs_store"

full_node_rpc = "http://127.0.0.1:9933"
full_node_ws = "ws://127.0.0.1:9944"
app_id = 0
confidence = 92.0
avail_path = "avail_path"

bootstraps = [["12D3KooWMm1c4pzeLPGkkCJMAgFbsfQ8xmVDusg272icWsaNHWzN", "/ip4/127.0.0.1/tcp/39000"]]

# See https://docs.rs/log/0.4.14/log/enum.LevelFilter.html for possible log level values
log_level = "INFO"

Now, run the client:

cargo run -- -c config.yaml  

Usage

Given a block number (as (hexa-) decimal number), return confidence obtained by the light client for this block:

curl -s localhost:7000/v1/confidence/ <block-number>

Result:

{
    "number": 223,
    "confidence": 99.90234375,
    "serialisedConfidence": "958776730446"
}

serialisedConfidence is calculated as: blockNumber << 32 | int32(confidence * 10 ** 7), where confidence is represented out of 10 ** 9.

Test Code Coverage Report

We are using grcov to aggregate code coverage information and generate reports.

To install grcov, run:

$> cargo install grcov

Source code coverage data is generated when running tests with:

$> env RUSTFLAGS="-C instrument-coverage" \
	LLVM_PROFILE_FILE="tests-coverage-%p-%m.profraw" \
	cargo test

To generate the report, run:

$> grcov . -s . \
	--binary-path ./target/debug/ \
	-t html \
	--branch \
	--ignore-not-existing -o \
	./target/debug/coverage/

To clean up generate coverage information files, run:

$> find . -name \*.profraw -type f -exec rm -f {} +

Open index.html from the ./target/debug/coverage/ folder to review coverage data.

avail-light's People

Contributors

tomaka avatar dependabot[bot] avatar itzmeanjan avatar aterentic-ethernal avatar kroos47 avatar expenses avatar luka-ethernal avatar raoulmillais avatar migueldd1 avatar prabal-banerjee avatar salmad3 avatar vthunder avatar florianfranzen avatar wirednkod avatar rakanalh avatar dependabot-preview[bot] avatar

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.