Rust implementation of the Mina protocol, targeting Wasm and ARM architectures.

Overview

Mina-rs

Apache License Discord

Continuous integration codecov dependency status loc

An implementation of Mina protocol in Rust, with focus on web and Wasm compatibility

** As you can probably tell this is a WIP! Don't use for anything yet **

ChainSafe Security Policy

Reporting a Security Bug

We take all security issues seriously, if you believe you have found a security issue within a ChainSafe project please notify us immediately. If an issue is confirmed, we will take all necessary precautions to ensure a statement and patch release is made in a timely manner.

Please email us a description of the flaw and any related information (e.g. reproduction steps, version) to security at chainsafe dot io.

License

Mina-rs is licensed under Apache 2.0.

Comments
  • [M1] Add missing variant and data structure in external transition

    [M1] Add missing variant and data structure in external transition

    • [X] Missing variants of TransactionStatus` --> Sample Block
    • [X] Missing variants of CoinBase: Two
    • [X] ~~Missing variants of UserCommand: SnappCommand~~
    • [X] ~~Missing variants of SignedCommandPayloadBody: Create_new_token Create_token_account Mint_tokens~~
    • [X] Add Tests
    opened by sudo-shashank 4
  • Lightweight & refactor staged ledger diff according to Mina Ocaml

    Lightweight & refactor staged ledger diff according to Mina Ocaml

    Summary of changes Changes introduced in this pull request:

    Add variants, refactor, update, fix, and lightweight the staged_ledger_diff.rs Originally posted by @jspada in https://github.com/ChainSafe/mina-rs/pull/94#discussion_r764134519 Here split into small PR #142 .

    • [x] feat: Add struct Parties in UserCommand
    • [x] feat: Update CoinBase variants
    • [x] feat: Add variant in TransactionStatus
    • [x] feat: Add variants in SignedCommandPayloadBody
    • [x] feat: Add SnappCommand to UserCommand
    • [x] feat: Add Parties in UserCommand
    • [x] feat: Update variants in enum SignedCommandPayloadBody
    • [ ] feat: Implement SnappCommand.rs
    • [ ] feat: Implement party.rs for UserCommand
    • [x] feat: Implement snapp_predicate.rs
    • [x] refactor: staged_ledger_diff.rs with transaction_status.rs, coinbase.rs, signed_command.rs & user_command.rs
    • [x] feat: Add variants in structs StakeDelegation, CreateNewTokenPayload, CreateTokenAccountPayload & MintTokensPayload
    • [x] feat: CoinBaseV1 according to Mina Ocaml coinbase
    • [x] docs: doc comment all above.
    • The following test will be in the next PR test coverage #143 .
    • [ ] test: StagedLedgerPreDiffOne
    • [ ] test: Implement test_coin_base_fee_transfer().
    • [ ] test: Implement test_coin_base_balance_data().
    • [ ] test: Implement test_fee_transfer_balance_data().
    • [ ] test: Implement test_snapp_command().

    nce issue to close (if applicable)**

    Closes

    Other information and links

    MinaProtocol staged_ledger_diff.ml MinaProtocol staged_ledger_diff.mli snapp_command.ml
    user_command.ml Reference version aacfe04245d14b3331e89ed76a4b77bec902b290

    opened by polarbeargo 4
  • Moving bin prot wire-protocol related crates under /protocol #77

    Moving bin prot wire-protocol related crates under /protocol #77

    Summary of changes Changes introduced in this pull request:

    Now the updated workspace Cargo.toml after this refactor look like the following

    [workspace]
    members = [
    	"base",
    	"consensus",
    	"crypto",
    	# All crates related to bin prot wire protocol
    	"protocol/bin-prot",
    	"protocol/wire-type",
    	"protocol/bin_prot_checker",
    	"protocol/wire-type-derive",
    	"protocol/test-fixtures",
    	"protocol/test-serialization",
    ]
    
    

    Reference issue to close (if applicable) Include the issue reference this pull request is connected to #77 Closes

    Screenshot (234) Screenshot (235)

    good first issue 
    opened by polarbeargo 4
  • M5 - Make mvp demo mpa(multi-page application)

    M5 - Make mvp demo mpa(multi-page application)

    Summary of changes Changes introduced in this pull request:

    • Converts the single-page demo to multi-page so that more functionalities can be integrated, e.g. readme, send transaction, etc.
    • Integrate with tailwindcss
    • Make chrome extension without sandboxing (requires chrome canary for now)
    • Render project readme.md on index page
    • Create page skeleton for graphql demo
    • Build chrome extension mv2 for chrome stable / edge and firefox
    • Instructions on using the extension chrome canary/stable, edge and firefox

    Reference issue to close (if applicable)

    Closes

    Other information and links

    ready for review 
    opened by hanabi1224 3
  • Implemented missing data structure for serialization and deserialization of external transition

    Implemented missing data structure for serialization and deserialization of external transition

    opened by sudo-shashank 3
  • [M1 Test]: Added test to validate full bytes vec

    [M1 Test]: Added test to validate full bytes vec

    Summary of changes Changes introduced in this pull request:

    • Implement Base58Encodable trait for PublicKey2 Type
    • Validate full byte vec for PublicKey2 Type Fields

    Reference issue to close (if applicable) Closes #158

    Other information and links

    opened by sudo-shashank 3
  • add polyvar deserialization support

    add polyvar deserialization support

    Some Mina data structures use a Polymorphic Variant (Polyvar) data structure. These are much like Sum types / enums but identify variants with a hash rather than an index when serialized. This hash needs to be stored along with the variant in a special data structure since Rust has no equivalent data type.

    Summary of changes Changes introduced in this pull request:

    • Adds deserialization support for Polyvars from loosely typed layouts
    • Add serialization support for polyvars from loose types
    • (TODO) Add data type to represent polyvars in Rust to strong type serialization and deserialization

    Other information and links

    opened by willemolding 3
  • Cleanup consensus crate and short range fork tests

    Cleanup consensus crate and short range fork tests

    Summary of changes Changes introduced in this pull request:

    • Cleans up consensus crate and relocates a few items to common.rs.
    • Moves the consensus constants under the Consensus trait as const, so APIs don't need to pass them around.
    • We cover the following tests for short range fork as part of this PR:
      • Same chain
      • Chains that are more than 1 epoch apart
      • Chains that are 1 epoch apart but beyond the seed update range.
      • Chains that are 1 epoch apart but have same lock checkpoint

    relevant section for ref: https://github.com/MinaProtocol/mina/blob/02dfc3ff0160ba3c1bbc732baa07502fe4312b04/docs/specs/consensus/README.md#532-short-range-fork-check

    Reference issue to close (if applicable)

    Closes #144

    Other information and links

    opened by creativcoder 3
  • [M4] key pair validation

    [M4] key pair validation

    Summary of changes Changes introduced in this pull request:

    • add data structure for private key
    • key pair validation functionality

    Reference issue to close (if applicable)

    Closes #102

    Other information and links

    opened by hanabi1224 3
  • Refine continuous integration setup

    Refine continuous integration setup

    Summary of changes Changes introduced in this pull request:

    • Merge 'check license' with 'cargo fmt check' into checks
    • Remove stale working-bee branch in the setup
    • Group jobs into checks, x86_64, wasm and codecov-x86_64
    • Avoid allocating CI VM for every small job (although GH does not have rate limit atm)
    • Run wasm tests for test-serialization against both node and headless chrome context
    • Add dependency badge
    • Replace/Remove insecure dependencies shown here: https://deps.rs/repo/github/ChainSafe/mina-rs
    • Add cargo deny check to checks job
    • Add benchmark tests for block(ExternalTransition) serde
    • Add cargo bench to x86_64 job
    • Upload benchmark (html) report as build artifacts

    Reference issue to close (if applicable)

    Closes

    Other information and links

    opened by hanabi1224 3
  • ADD initial account database work

    ADD initial account database work

    Summary of changes Changes introduced in this pull request:

    Milestone 4 Store and Update account database Merkle-ledger

    Reference issue to close (if applicable)

    Closes #39 Closes #40

    Other information and links

    Epic 
    opened by mmacedoeu 3
  • [OB4] Implement structures to store candidate chains for selection [M2]

    [OB4] Implement structures to store candidate chains for selection [M2]

    Issue summary

    • [X] The NCN will get the best block from the pool of trusted providers, it will run chain selection and select the best block,
    • [X] It will track n blocks behind that best block for stronger finality purposes (where n may = 20 (an arbitrary number) or the same number of blocks tracked by exchanges.)
    • [ ] As a user I can specify how many blocks in history that the NCN will store so that I have flexibility over the finality confidence of my node
    • [ ] Integration tests

    Other information and links

    documentation 
    opened by creativcoder 1
  • [OB4] Web node settings configuration page [M2]

    [OB4] Web node settings configuration page [M2]

    Issue summary

    • The user of an NCN can configure their own list of trusted service providers (usually will include nodes run by Bison Trails, Figment, etc. but can also be their own local node they’re running.) This can be done via the settings page for the web extension
    • Support for multiple networks and switching between them (eg testnets and mainnet) The above two could be something like { “testnet” : { “figment” : “”, …}, “mainnet” : { “bison_trails” : “” }} and also configurable through the settings page

    Other information and links

    opened by creativcoder 1
  • [M3] Block validation

    [M3] Block validation

    Issue summary

    Validate transitions with the following checks (in this order):

    • Checking for existence in the breadcrumb tree (we've already seen it)
    • Checking for consensus errors
    • Verifying the included SNARK

    Also:

    • [X] signatures (waiting on #231)
    • [ ] snark proofs
    • [ ] structure of block

    Other information and links

    Epic 
    opened by creativcoder 0
  • [M1] Implement Nat.UInt32 correctly

    [M1] Implement Nat.UInt32 correctly

    Task summary

    Mina uses its own unsigned numeric data type Nat.UInt32 for a number of internal types including AccountNonce and GlobalSlotNumber.

    This has slightly different serialization to a bin_prot integer from what I can tell. For the most part they are compatible but in some edge cases they are not.

    Our codebase uses i32 and coverts to u32 in order to maintain compatibility. This is a hack solution and can fail in certain cases (which are not covered properly by tests)

    Tasks for this issue

    • Explicitly support Nat.UInt32 as a serialization type. Currently we use ExtendedU32 wrapper around i32
    • Add conversions from this to rust types (e.g. u32)
    • Replace this in our other serialization-types where required
    • Add test coverage for edge cases for ExtendedU32 (e.g. minvalue, maxvalue etc)

    Specification reference

    • https://github.com/MinaProtocol/mina/blob/develop/src/lib/mina_numbers/nat.ml

    Other information and links

    opened by willemolding 0
Owner
ChainSafe
building the infrastructure for web3
ChainSafe
Distribute a wasm SPA as HTML by wrapping it as a polyglot "html+wasm+zip"

A packer that adds a webpage to WASM module, making it self-hosted! Motivation At the moment, Browsers can not execute WebAssembly as a native single

Andreas Molzer 3 Jan 2, 2023
A faster experimental wasm-based tar implementation for browsers.

@bytedance/tar-wasm A faster* experimental wasm-based tar implementation for browsers. *50-160x faster, see benchmarks below. Usage Install npm instal

Bytedance Inc. 65 Dec 16, 2022
Parametric surfaces drawn using the Rust + WASM toolchain with WebGL, React, and TypeScript.

Parametric Surfaces in the Browser My.Movie.3.mp4 Wanted to experiment with WebGL using the Rust + WASM toolchain, with React and TypeScript to glue e

Benji Nguyen 45 Oct 21, 2022
WASM bindings for React - enables you to write and use React components in Rust

This library enables you to write and use React components in Rust, which then can be exported to JS to be reused or rendered.

Yichuan Shen 55 Dec 24, 2022
Spine runtime for Rust (and wasm!) transpiled from the official C Runtime.

rusty_spine Spine runtime for Rust (and wasm!) transpiled from the official C Runtime. Supports Spine 4.1. [dependencies] rusty_spine = "0.4.0" Onlin

jabu 12 Dec 17, 2022
Facilitating high-level interactions between Wasm modules and JavaScript

wasm-bindgen Facilitating high-level interactions between Wasm modules and JavaScript. Guide | API Docs | Contributing | Chat Built with ?? ?? by The

Rust and WebAssembly 5.9k Jan 8, 2023
Instrument and transform wasm modules.

wasm-instrument A Rust library containing a collection of wasm module instrumentations and transformations mainly useful for wasm based block chains a

Parity Technologies 31 Dec 16, 2022
TSS of GG18 by WASM, for Confidential Transaction Generation and Signing

TSS WASM portable lightweight client application for threshold ECDSA (based on GG18), built on&for multi-party-ecdsa : Wasm HW friendly Dev yarn build

Eigen Labs 24 Dec 28, 2022
Lunatic based webserver embedding WASM. Supports scaling down to zero and up to infinity.

Frenezulo A WASM-embedding webserver build on top of submillisecond and lunatic. Build to serve as an entry point for microservices compiled to WASM.

Kai Jellinghaus 13 Oct 23, 2022
zzhack-cli is a Command Tool to help you quickly generate a WASM WebApp with simple configuration and zero code

English | 中文文档 zzhack-cli is a Command Tool that can help you quickly generate a WASM WebApp with simple configuration and zero code. It's worth menti

null 17 Feb 9, 2023
Rust based WASM/JS bindings for ur-rust

ur-wasm-js WASM/JS bindings for the ur-rust rust library Getting started Installation Either build the library yourself with wasm-pack or install for

Lightning Digital Entertainment 5 Feb 28, 2024
📦✨ your favorite rust -> wasm workflow tool!

?? ✨ wasm-pack Your favorite Rust → Wasm workflow tool! Docs | Contributing | Chat Built with ?? ?? by The Rust and WebAssembly Working Group About Th

Rust and WebAssembly 4.8k Jan 5, 2023
Gun port in rust & wasm

gun-rs-wasm Rust & WASM port of Gun. For a non-wasm version, check out gun-rs Example (source) Use npm install rusty-gun import { Node as Gun } from "

Martti Malmi 39 Dec 19, 2022
📝 A template for creating WASM + Typescript + Rust workflow libraries.

Create Rust + TypeScript libraries with ease! PR'S WELCOMED! ✨ Inspiration I wanted to create a WebAssembly/Rust library with additional JS features,

Shaoru Ian Huang 25 Dec 24, 2022
A self-guided learning project that includes Rust + Wasm together

A self-guided learning project that includes Rust + Wasm together. Who knows, maybe Typescript and React joins too..

M.Yavuz Yagis 1 Feb 14, 2022
Realtime audio processing / synthesis using Rust/WASM in the browser.

Rust Audio About This repo is my investigation into using Rust for creative audio coding on various platforms (e.g. desktop, web, etc.), but especiall

Austin Theriot 30 Jan 5, 2023
Rust bindings for the Wasm spec interpreter.

wasm-spec-interpreter This project shows how to use ocaml-interop to call into the Wasm spec interpreter. There are several steps to making this work:

Bytecode Alliance 9 Aug 23, 2022
Simple devcontainer for Rust + WASM development

Devcontainer WASM-Rust Simple devcontainer for Rust development Usage Github Codespaces Just click the button: Visual Studio Code Note this assumes th

null 2 Dec 22, 2022
Create WASM plugins easily in Rust.

Scotch Library for creating WASM plugins with Rust. Scotch allows you to pass complex types to/from functions in WASM plugins. It achieves that by enc

null 23 Feb 1, 2023