GithubHelp home page GithubHelp logo

liuchengxu / pallet-manta-pay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manta-network/pallet-manta-pay

0.0 2.0 0.0 209.12 MB

A substrate pallet that enables Manta's decentialized anynonymous payment (MantaPay) protocol.

Home Page: https://manta.network

License: GNU General Public License v3.0

Rust 100.00%

pallet-manta-pay's Introduction

pallet-manta-pay

This is a pallet that enables decentralized anonymous payment (pay) protocol. The best way to use this repo is to invoke it with a manta-runtime, available from either manta-node or cumulus.

Disclaimer: This code is a proof-of-concept; is not properly reviewed or audited and is likely to have severe bugs or security pitfalls. Use at your own risk!

Documentations

cargo doc --open

Pre-computed tokens

cargo run --bin pre_comp --release

Test coverage

cargo install grcov
  • build and run test (extremely slow)
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
export RUSTDOCFLAGS="-Cpanic=abort"
cargo +nightly-2021-01-29 test
  • generate the report
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/
open target/debug/coverage/index.html
  • The report is also available within coverage folder.

Result

Benchmark

  • benchmark environment

Amazon EC2 Instance t3.large: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz; NVMe device Amazon Elastic Block Store; 8GB RAM; Ubuntu 20.04; rustc 1.52.1 (9bc8c42bb 2021-05-09);

  • with criterion (take some time)
cargo bench

sample output

deserialization/hash param                        
                        time:   [113.15 us 113.18 us 113.23 us]
deserialization/commit param                        
                        time:   [132.49 us 132.51 us 132.53 us]
perdersen/hash param gen                        
                        time:   [7.0316 ms 7.0321 ms 7.0326 ms]
perdersen/commit open   time:   [59.471 us 59.490 us 59.511 us]
merkle_tree/with 1 leaf time:   [1.1660 ms 1.1664 ms 1.1669 ms]
merkle_tree/with 2 leaf time:   [1.3025 ms 1.3030 ms 1.3035 ms]
merkle_tree/with 3 leaf time:   [1.5725 ms 1.5730 ms 1.5735 ms]
transfer/ZKP verification                        
                        time:   [8.8006 ms 8.8016 ms 8.8028 ms]                   
  • with frame-benchmarking: within manta-node repo, run
cargo +nightly build --release -p manta-node -Z package-features --package manta-runtime --features runtime-benchmarks --wasm-execution compiled
target/release/manta-node benchmark --pallet pallet_manta_pay --extrinsic init --repeat 100 --execution=wasm --wasm-execution compiled
target/release/manta-node benchmark --pallet pallet_manta_pay --extrinsic transfer --repeat 100 --execution=wasm --wasm-execution compiled
target/release/manta-node benchmark --pallet pallet_manta_pay --extrinsic mint --repeat 100 --execution=wasm --wasm-execution compiled
target/release/manta-node benchmark --pallet pallet_manta_pay --extrinsic manta_transfer --repeat 100 --execution=wasm --wasm-execution compiled
target/release/manta-node benchmark --pallet pallet_manta_pay --extrinsic reclaim --repeat 100 --execution=wasm --wasm-execution compiled

sample output

Function init transfer mint manta_transfer reclaim
Rust 640 us 13 us 1.9 ms 10.1 ms 8.8 ms
Wasm 2.8 ms 111 us 13.1 ms 130 ms 107 ms

pallet-manta-pay's People

Contributors

ghzlatarev avatar stechu avatar zhenfeizhang avatar

Watchers

 avatar  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.