From be16151d10e7c1bb2eb720a52ffab8d596bf4753 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 7 Nov 2024 08:26:09 +0100 Subject: [PATCH] chore: setting up repo Signed-off-by: Dr Maxim Orlovsky --- .github/FUNDING.yml | 1 + .github/workflows/build.yml | 67 +++ .github/workflows/codecov.yml | 40 ++ .github/workflows/lint.yml | 45 ++ .github/workflows/test.yml | 39 ++ .gitignore | 13 + .rustfmt.toml | 28 + CHANGELOG.md | 2 + CODE_OF_CONDUCT.md | 19 + CONTRIBUTING.md | 196 +++++++ Cargo.lock | 926 ++++++++++++++++++++++++++++++++++ Cargo.toml | 51 ++ DCO | 28 + LICENSE | 176 +++++++ MAINTAINERS.md | 10 + README.md | 95 ++++ SECURITY.md | 46 ++ _typos.toml | 13 + codecov.yml | 6 + rust-toolchain.toml | 2 + src/abi/mod.rs | 88 ++++ src/containers/mod.rs | 23 + src/lib.rs | 41 ++ src/persistence/mod.rs | 10 + 24 files changed, 1965 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/codecov.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .rustfmt.toml create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 DCO create mode 100644 LICENSE create mode 100644 MAINTAINERS.md create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 _typos.toml create mode 100644 codecov.yml create mode 100644 rust-toolchain.toml create mode 100644 src/abi/mod.rs create mode 100644 src/containers/mod.rs create mode 100644 src/lib.rs create mode 100644 src/persistence/mod.rs diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..08a2742 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [dr-orlovsky, UBIDECO] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..181aae4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: Build + +on: + push: + branches: + - master + tags: + - 'v[0-9]+[.0-9]*' + pull_request: + branches: + - master + - develop + - 'v[0-9]+[.0-9]*' + +env: + CARGO_TERM_COLOR: always + +jobs: + default: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo check --workspace + no-default: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo check --workspace --no-default-features + features: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + feature: [ stl, serde ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Feature ${{matrix.feature}} + run: cargo check --workspace --no-default-features --features=${{matrix.feature}} + - name: Feature ${{matrix.feature}} + run: cargo check --workspace --features=${{matrix.feature}} + platforms: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-22.04, ubuntu-latest, macos-13, macos-latest, windows-2019, windows-latest ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Platform ${{matrix.os}} + run: cargo check --workspace --all-features # we skip test targets here to be sure that the main library can be built + toolchains: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + toolchain: [ nightly, beta, stable, 1.77.0 ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{matrix.toolchain}} + - name: Toolchain ${{matrix.toolchain}} + run: cargo +${{matrix.toolchain}} check --workspace --all-targets --all-features diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..8624aba --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,40 @@ +name: Codecov + +on: + push: + branches: + - master + tags: + - 'v\d+\.*' + pull_request: + branches: + - master + - develop + - 'v\d+(\.\d+)*' + +env: + CARGO_TERM_COLOR: always + +jobs: + codecov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: llvm-tools-preview + - uses: taiki-e/install-action@cargo-llvm-cov + - uses: taiki-e/install-action@nextest + - name: Collect coverage data (including doctests) + run: | + cargo +nightly llvm-cov --no-report nextest --workspace --all-features + cargo +nightly llvm-cov --no-report --doc --workspace --all-features + cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info + - name: Upload coverage data to codecov + uses: codecov/codecov-action@v4 + with: + flags: rust + files: lcov.info + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..29e0ebc --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,45 @@ +name: Lints + +on: + pull_request: + branches: + - master + - develop + - 'v\d+(\.\d+)*' + +env: + CARGO_TERM_COLOR: always + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - name: Formatting + run: cargo +nightly fmt --all -- --check + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Formatting + run: cargo clippy --workspace --all-features --all-targets -- -D warnings + doc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rust-docs + - name: Formatting + run: cargo +nightly doc --workspace --all-features + typos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b6bd2c7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Tests + +on: + push: + branches: + - master + tags: + - 'v\d+\.*' + pull_request: + branches: + - master + - develop + - 'v\d+(\.\d+)*' + +env: + CARGO_TERM_COLOR: always + +jobs: + testing: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-13, macos-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Test ${{matrix.os}} + run: cargo test --workspace --all-features --no-fail-fast + wasm-testing: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + - uses: jetli/wasm-pack-action@v0.4.0 + - name: Add wasm32 target + run: rustup target add wasm32-unknown-unknown + - name: Test in headless Chrome + run: wasm-pack test --headless --chrome diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abf32c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Generated by Cargo +# will have compiled files and executables +/target + +# These are backup files generated by rustfmt +**/*.rs.bk + +.idea + +*.swp + +/dep_test +default*.profraw diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..7adebfc --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,28 @@ +edition = "2021" +style_edition = "2021" + +max_width = 120 +array_width = 120 +attr_fn_like_width = 120 +comment_width = 100 +chain_width = 60 +fn_call_width = 120 +single_line_if_else_max_width = 120 +struct_lit_width = 60 + +fn_single_line = true +format_code_in_doc_comments = true +format_macro_matchers = true +format_macro_bodies = true +format_strings = true +merge_derives = false +overflow_delimited_expr = true +reorder_modules = false +use_field_init_shorthand = true +use_try_shorthand = true +wrap_comments = true +where_single_line = true +unstable_features = true + +imports_granularity = "Module" +group_imports = "StdExternalCrate" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9a203e1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +Change Log +========== diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..784426e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,19 @@ +# Code of Conduct + +We do not apply any code of conduct expectations for contributors and +maintainers in their live and behaviour outside the scope of this project. +We believe that a restriction is the word of sin: free people write code, take +their decisions and act in a way they will, taking responsibility for the +consequences. + +Moreover, we will try to protect the freedom of speech of contributors, and +explicit distance from personal or public life of contributors, as long as +they behave in a civil and productive way when contributing and interacting +within the project, and will go to great lengths to not deny anyone +participation. + +Actions within the technical scope of the project (code quality, spamming etc), +as well as interaction with other maintainers and contributors of course is +a factor of the access to the project development and lifecycle. The decision in +these cases will be made by the project maintainers, with the right of veto or +overriding vote reserved for the original project author, Maxim Orlovsky. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..66acff9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,196 @@ +Contributing guidelines +======================= + +Contributions are very welcome. When contributing code, please follow these +simple guidelines. + +#### Table Of Contents +- [Contribution workflow](#contribution-workflow) + * [Proposing changes](#proposing-changes) + * [Preparing PRs](#preparing-prs) + * [Peer review](#peer-review) +- [Coding conventions](#coding-conventions) +- [Security](#security) +- [Testing](#testing) +- [Going further](#going-further) + +Overview +-------- + +* Before adding any code dependencies, check with the maintainers if this is okay. +* Write properly formatted comments: they should be English sentences, eg: + + // Return the current UNIX time. + +* Read the DCO and make sure all commits are signed off, using `git commit -s`. +* Follow the guidelines when proposing code changes (see below). +* Write properly formatted git commits (see below). +* Run the tests with `cargo test --workspace --all-features`. +* Make sure you run `rustfmt` on your code (see below details). +* Please don't file an issue to ask a question. Each repository - or + GitHub organization has a "Discussions" with Q&A section; please post your + questions there. You'll get faster results by using this channel. + +Contribution Workflow +--------------------- +The codebase is maintained using the "contributor workflow" where everyone +without exception contributes patch proposals using "pull requests". This +facilitates social contribution, easy testing and peer review. + +To contribute a patch, the workflow is a as follows: + +1. Fork Repository +2. Create topic branch +3. Commit patches + +In general commits should be atomic and diffs should be easy to read. For this +reason do not mix any formatting fixes or code moves with actual code changes. +Further, each commit, individually, should compile and pass tests, in order to +ensure git bisect and other automated tools function properly. + +When adding a new feature thought must be given to the long term technical debt. +Every new features should be covered by unit tests. + +When refactoring, structure your PR to make it easy to review and don't hesitate +to split it into multiple small, focused PRs. + +Commits should cover both the issue fixed and the solution's rationale. +These [guidelines](https://chris.beams.io/posts/git-commit/) should be kept in +mind. + +To facilitate communication with other contributors, the project is making use +of GitHub's "assignee" field. First check that no one is assigned and then +comment suggesting that you're working on it. If someone is already assigned, +don't hesitate to ask if the assigned party or previous commenters are still +working on it if it has been awhile. + +### Proposing changes + +When proposing changes via a pull-request or patch: + +* Isolate changes in separate commits to make the review process easier. +* Don't make unrelated changes, unless it happens to be an obvious improvement to + code you are touching anyway ("boyscout rule"). +* Rebase on `master` when needed. +* Keep your changesets small, specific and uncontroversial, so that they can be + merged more quickly. +* If the change is substantial or requires re-architecting certain parts of the + codebase, write a proposal in English first, and get consensus on that before + proposing the code changes. + +### Preparing PRs + +The main library development happens in the `master` branch. This branch must +always compile without errors (using Travis CI). All external contributions are +made within PRs into this branch. + +Prerequisites that a PR must satisfy for merging into the `master` branch: +* the tip of any PR branch must compile and pass unit tests with no errors, with + every feature combination (including compiling the fuzztests) on MSRV, stable + and nightly compilers (this is partially automated with CI, so the rule + is that we will not accept commits which do not pass GitHub CI); +* contain all necessary tests for the introduced functional (either as a part of + commits, or, more preferably, as separate commits, so that it's easy to + reorder them during review and check that the new tests fail without the new + code); +* contain all inline docs for newly introduced API and pass doc tests; +* be based on the recent `master` tip from the original repository at. + +NB: reviewers may run more complex test/CI scripts, thus, satisfying all the +requirements above is just a preliminary, but not necessary sufficient step for +getting the PR accepted as a valid candidate PR for the `master` branch. + +Additionally, to the `master` branch some repositories may have `develop` branch +for any experimental developments. This branch may not compile and should not be +used by any projects depending on the library. + +### Writing Git commit messages + +A properly formed git commit subject line should always be able to complete the +following sentence: + + If applied, this commit will _____ + +In addition, it should be capitalized and *must not* include a period. + +For example, the following message is well formed: + + Add support for .gif files + +While these ones are **not**: `Adding support for .gif files`, +`Added support for .gif files`. + +When it comes to formatting, here's a model git commit message[1]: + + Capitalized, short (50 chars or less) summary + + More detailed explanatory text, if necessary. Wrap it to about 72 + characters or so. In some contexts, the first line is treated as the + subject of an email and the rest of the text as the body. The blank + line separating the summary from the body is critical (unless you omit + the body entirely); tools like rebase can get confused if you run the + two together. + + Write your commit message in the imperative: "Fix bug" and not "Fixed bug" + or "Fixes bug." This convention matches up with commit messages generated + by commands like git merge and git revert. + + Further paragraphs come after blank lines. + + - Bullet points are okay, too. + + - Typically a hyphen or asterisk is used for the bullet, followed by a + single space, with blank lines in between, but conventions vary here. + + - Use a hanging indent. + +### Peer review + +Anyone may participate in peer review which is expressed by comments in the pull +request. Typically reviewers will review the code for obvious errors, as well as +test out the patch set and opine on the technical merits of the patch. PR should +be reviewed first on the conceptual level before focusing on code style or +grammar fixes. + +Coding Conventions +------------------ +Our CI enforces [clippy's](https://github.com/rust-lang/rust-clippy) +[default linting](https://rust-lang.github.io/rust-clippy/rust-1.52.0/index.html) +and [rustfmt](https://github.com/rust-lang/rustfmt) formatting defined by rules +in [.rustfmt.toml](./.rustfmt.toml). The linter should be run with current +stable rust compiler, while formatter requires nightly version due to the use of +unstable formatting parameters. + +If you use rustup, to lint locally you may run the following instructions: + +```console +rustup component add clippy +rustup component add fmt +cargo +stable clippy --workspace --all-features +cargo +nightly fmt --all +``` + +Security +-------- +Responsible disclosure of security vulnerabilities helps prevent user loss of +privacy. If you believe a vulnerability may affect other implementations, please +inform them. Guidelines for a responsible disclosure can be found in +[SECURITY.md](./SECURITY.md) file in the project root. + +Note that some of our projects are currently considered "pre-production". +Such projects can be distinguished by the absence of `SECURITY.md`. In such +cases there are no special handling of security issues; please simply open +an issue on GitHub. + +Going further +------------- +You may be interested in Jon Atack guide on +[How to review Bitcoin Core PRs][Review] and [How to make Bitcoin Core PRs][PR]. +While there are differences between the projects in terms of context and +maturity, many of the suggestions offered apply to this project. + +Overall, have fun :) + +[1]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[Review]: https://github.com/jonatack/bitcoin-development/blob/master/how-to-review-bitcoin-core-prs.md +[PR]: https://github.com/jonatack/bitcoin-development/blob/master/how-to-make-bitcoin-core-prs.md diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..cc88148 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,926 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aluvm" +version = "0.12.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2505dfdc1b6c3455b65b212c50a005ebd6c1bfb057e0536de33172620c6e0635" +dependencies = [ + "amplify", + "ascii-armor", + "baid64", + "commit_verify", + "getrandom", + "paste", + "serde", + "strict_encoding", + "strict_types", + "wasm-bindgen", +] + +[[package]] +name = "amplify" +version = "4.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "448cf0c3afc71439b5f837aac5399a1ef2b223f5f38324dbfb4343deec3b80cc" +dependencies = [ + "amplify_derive", + "amplify_num", + "amplify_syn", + "ascii", + "serde", + "stringly_conversions", + "wasm-bindgen", +] + +[[package]] +name = "amplify_derive" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a6309e6b8d89b36b9f959b7a8fa093583b94922a0f6438a24fb08936de4d428" +dependencies = [ + "amplify_syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "amplify_num" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99bcb75a2982047f733547042fc3968c0f460dfcf7d90b90dea3b2744580e9ad" +dependencies = [ + "serde", + "wasm-bindgen", +] + +[[package]] +name = "amplify_syn" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" +dependencies = [ + "serde", +] + +[[package]] +name = "ascii-armor" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ca6f0044fabe840af8db8de7f3bff0c85af2a5c2a173780248c1716e86f5cc1" +dependencies = [ + "amplify", + "baid64", + "base85", + "sha2", + "strict_encoding", +] + +[[package]] +name = "baid64" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30acc16368c00c4d3ce4526d0c1528e22d75814534b3dba97e871aa5f8395697" +dependencies = [ + "amplify", + "base64", + "mnemonic", + "sha2", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base85" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36915bbaca237c626689b5bd14d02f2ba7a5a359d30a2a08be697392e3718079" +dependencies = [ + "thiserror", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b9470d453346108f93a59222a9a1a5724db32d0a4727b7ab7ace4b4d822dc9" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "commit_encoding_derive" +version = "0.12.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b452b3e69f9cfd18d345684a7e06827c84798724f8a58addc387c401cab8fb" +dependencies = [ + "amplify", + "amplify_syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "commit_verify" +version = "0.12.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11148a1671ba7da121a145acf4474ae8712e09865d8cf569ac0a496c01e1118" +dependencies = [ + "amplify", + "commit_encoding_derive", + "ripemd", + "serde", + "sha2", + "strict_encoding", + "strict_types", + "vesper-lang", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minicov" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "mnemonic" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b8f3a258db515d5e91a904ce4ae3f73e091149b90cadbdb93d210bee07f63b" + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "serde_json" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_str_helpers" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b744a7c94f2f3785496af33a0d93857dfc0c521e25c38e993e9c5bb45f09c841" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "single_use_seals" +version = "0.12.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14aa388896f4aac3cb63580dee1d5e46cca95e2a99c49eb8e2175ae874add65f" +dependencies = [ + "amplify_derive", +] + +[[package]] +name = "sonare" +version = "0.12.0-nightly" +dependencies = [ + "aluvm", + "amplify", + "baid64", + "commit_verify", + "getrandom", + "rand", + "serde", + "single_use_seals", + "strict_encoding", + "strict_types", + "wasm-bindgen", + "wasm-bindgen-test", +] + +[[package]] +name = "strict_encoding" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b71b5ba13c289a8b6f0a3ed4abebb92ce2d57b805b1db26e543b4ac26237870" +dependencies = [ + "amplify", + "serde", + "strict_encoding_derive", + "wasm-bindgen", +] + +[[package]] +name = "strict_encoding_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34e3bc6e4a2450420b4dbfb6929d9ce005e8c36cf73bf215db99f0d09c9fa79f" +dependencies = [ + "amplify_syn", + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "strict_types" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2dcdbb3f239b310f3d07e81e8f4da3b5ffe17da980a360ca029e9bc263f049" +dependencies = [ + "amplify", + "ascii-armor", + "baid64", + "indexmap", + "serde", + "serde_json", + "serde_yaml", + "sha2", + "strict_encoding", + "toml", + "vesper-lang", + "wasm-bindgen", +] + +[[package]] +name = "stringly_conversions" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff63080f492dd4d289ffcaed8d7ece38adfb423db910eb342c0e04d409536a7a" +dependencies = [ + "paste", + "serde_str_helpers", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3c6efbfc763e64eb85c11c25320f0737cb7364c4b6336db90aa9ebe27a0bbd" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b607164372e89797d78b8e23a6d67d5d1038c1c65efd52e1389ef8b77caba2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vesper-lang" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd2b7e3e27aeb0524204e58042f6e4531a720745d1b1a3978d3a084f1885f63d" +dependencies = [ + "amplify", + "strict_encoding", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.87", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "minicov", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..aefbff8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,51 @@ +[package] +name = "sonare" +version = "0.12.0-nightly" +authors = ["Dr Maxim Orlovsky "] +description = "Runtime environment for formally-verifiable distributed software" +repository = "https://github.com/AluVM/sonare" +homepage = "https://ubideco.org/SONARE" +keywords = ["state-machines", "distributed-systems", "decentralized", "partially-replicated", "runtime-environment"] +categories = ["algorithms", "cryptography", "science"] +readme = "README.md" +license = "Apache-2.0" +edition = "2021" +rust-version = "1.77.0" # Due to `rustfix` +exclude = [".github"] + +[lib] +name = "sonare" + +[dependencies] +amplify = "~4.8.0" +baid64 = "~0.3.0" +strict_encoding = "~2.8.0" +strict_types = "~2.8.0" # TODO: Make strict types optional, used only in STL and by persistence dependencies +aluvm = { version = "~0.12.0-beta.1", features = ["zk-aluvm"] } +commit_verify = { version = "~0.12.0-alpha.2", features = ["derive"] } +single_use_seals = "~0.12.0-alpha.2" +serde = { version = "1", features = ["derive"], optional = true } + +[features] +default = [] +all = ["stl", "serde"] + +stl = ["commit_verify/stl", "aluvm/stl", "strict_types/armor"] +serde = [ + "dep:serde", + "amplify/serde", + "strict_types/serde", + "commit_verify/serde", + "aluvm/serde", +] + +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-bindgen = "0.2" +rand = { version = "0.8.4", optional = true } +getrandom = { version = "0.2", features = ["js"] } + +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +wasm-bindgen-test = "0.3" + +[package.metadata.docs.rs] +features = ["all"] diff --git a/DCO b/DCO new file mode 100644 index 0000000..69175c9 --- /dev/null +++ b/DCO @@ -0,0 +1,28 @@ +Developer's Certificate of Origin 1.1 +Copyright © 2004, 2006 The Linux Foundation and its contributors. + +--- + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d9a10c0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000..9e09b60 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,10 @@ +The project is maintained by Laboratories for Ubiquitous Deterministic Computing (UBIDECO), +Institute for Distributed and Cognitive Systems (InDCS), Switzerland. + +List of the project maintainers: + +1. Maxim Orlovsky + - GitHub: [@dr-orlovsky](https://github.com/dr-orlovsky) + - GPG: `EAE730CEC0C663763F028A5860094BAF18A26EC9` + - SSH: `BoSGFzbyOKC7Jm28MJElFboGepihCpHop60nS8OoG/A` + - EMail: [orlovsky@ubideco.org](mailto:orlovsky@ubideco.org) diff --git a/README.md b/README.md new file mode 100644 index 0000000..acfed6f --- /dev/null +++ b/README.md @@ -0,0 +1,95 @@ +# SONARE: Runtime environment for formally-verifiable distributed software + +![Build](https://github.com/AluVM/sonare/workflows/Build/badge.svg) +![Tests](https://github.com/AluVM/sonare/workflows/Tests/badge.svg) +[![codecov](https://codecov.io/gh/AluVM/sonare/branch/master/graph/badge.svg)](https://codecov.io/gh/AluVM/sonare) + +[![crates.io](https://img.shields.io/crates/v/sonare)](https://crates.io/crates/sonare) +[![Docs](https://docs.rs/sonare/badge.svg)](https://docs.rs/sonare) +[![License](https://img.shields.io/crates/l/sonare)](./LICENSE) + +## What is it + +**SONARE** allows to build are partially-replicated state machines, which utilize single-use seals +for the consensus and capability-based memory access, and whose history execution trace can be +compressed with recursive zk-STARKs (i.e. they have a fixed-length computational integrity proofs). + +What is capability-based memory access (or capability-addressable memory, **CAM**)? The computers we +all used to are random memory access machines (RAM), where a software accesses freely-addressable +global memory. This had opened a door for the all the vulnerabilities and hacks happening in +computer systems across the world for the past decades... CAM model instead, divides all memory into +parts (called *words*) addressable only with some access token (called *capability*). You may think +of this as of a memory where each part is "owned" by certain party, and can be accessed or modified +only given a proof of ownership (that is what single-use seals are for). This is [**UltraSONIC**], +the underlying layer for SONARE. + +Now, you can put this into a distributed context, such that the memory is accessible by multiple +parties with different permissions, and the state of the computation (*state machine*) is replicable +across all the parties - so you get CAM upgraded into a *partially-replicated state machine* +(**PRISM**). SONARE takes such PRISM computers and enhances them with zk-STARKS, such that the cost +of replication becomes fixed, independently of how long the system is run for. With that, you have +a programs which can be formally (i.e. mathematically) verified to be safe, and at the same time +run over a computer network in a trustless manner, with the same efficiency no matter how long they +run. + +## What I can build + +One of the main current applications for SONARE are smart contracts made with client-side +validation, abstracted from a specific underlying blockchain or other consensus mechanism; however, +as you can see, the number of applications for SONARE can be significantly larger. Using SONARE, one +may build distributed software with capability-based access to the memory, including: +- a replicable database with formal safety guarantees; +- distributed operating system with formal safety guarantees; +- remote code execution environments (like in browsers, but with formal safety guarantees); +- blockchain or a zk-rollup; +- client-side validated smart contracts; +- or even arbitrary distributed digital agents. + +What does "runtime environment" mean? If you think of other platforms, then it plays the same role +for client-side apps as NodeJS for JavaScript server apps, or JRE (Java Runtime Environment) for +Java apps. However, this repository does not provide executables, and is a library, which may be +used to host runtime in both third-party applications - or to write server-side daemons, executables +and desktop apps. + +## Ecosystem + +SONARE is a part of a larger ecosystem used to build safe distributed software, which includes: +- [Strict types]: strong type system made with [generalized algebraic data types][GADT] (*GADT*) and + [dependent types]; +- [AluVM]: a functional register-based virtual machine with a reduced instruction set (RISC); SONARE + uses a zk-STARK-compatible subset of its instruction set architecture (called zk-AluVM); +- [UltraSONIC]: a transactional execution layer with capability-based memory access on top of + zk-AluVM; +- [Cation]: a general-purpose high-level programming language made with category theory, which + features strict types, termination analysis and can be formally verified; +- [Contractum]: a domain-specific version of Cation for writing programs for SONARE. + +## License + + Designed in 2019-2024 by Dr Maxim Orlovsky + Written in 2024-2025 by Dr Maxim Orlovsky + + Copyright (C) 2019-2024 LNP/BP Standards Association, Switzerland. + Copyright (C) 2024-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO), + Institute for Distributed and Cognitive Systems (InDCS), Switzerland. + Copyright (C) 2019-2025 Dr Maxim Orlovsky. + All rights under the above copyrights are reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +in compliance with the License. You may obtain a copy of the License at +. + +Unless required by applicable law or agreed to in writing, software distributed under the License +is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +or implied. See the License for the specific language governing permissions and limitations under +the License. + +[Strict types]: https://strict-types.org +[AluVM]: https://aluvm.org +[UltraSONIC]: https://github.com/AlyVM/UltraSONIC +[**UltraSONIC**]: https://github.com/AlyVM/UltraSONIC +[Cation]: https://cation-lang.org +[Contractum]: https://contractum.org + +[GADT]: https://en.wikipedia.org/wiki/Generalized_algebraic_data_type +[dependent types]: https://en.wikipedia.org/wiki/Dependent_type diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..9d7204f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,46 @@ +# Security + +We take the security of our software products and services seriously, which +includes all source code repositories managed through our GitHub organizations. + +If you believe you have found a security vulnerability in any of our repository +that meets [definition of a security vulnerability][definition], please report +it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the repository maintainers by sending a **GPG +encrypted e-mail** to _all maintainers of a specific repo_ using their GPG keys. + +A list of repository maintainers and their keys and e-mail addresses are +provided inside MAINTAINERS.md file. + +You should receive a response within 72 hours. If for some reason you do not, +please follow up via email to ensure we received your original message. + +Please include the requested information listed below (as much as you can +provide) to help us better understand the nature and scope of the possible +issue: + +* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) +* Full paths of source file(s) related to the manifestation of the issue +* The location of the affected source code (tag/branch/commit or direct URL) +* Any special configuration required to reproduce the issue +* Step-by-step instructions to reproduce the issue +* Proof-of-concept or exploit code (if possible) +* Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +We follow the principle of [Coordinated Vulnerability Disclosure][disclosure]. + +[definition]: https://aka.ms/opensource/security/definition +[disclosure]: https://aka.ms/opensource/security/cvd diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..0c6e78b --- /dev/null +++ b/_typos.toml @@ -0,0 +1,13 @@ +[files] +# exclude the directory "stl/" +extend-exclude = ["stl/"] + +[default.extend-words] +# Don't correct the name "Jon Atack". +Atack = "Atack" + +[default] +extend-ignore-re = [ + # Don't correct URIs + "([a-z]+:)*[$!0-9A-Za-z-]+", +] diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..b27c8fc --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +codecov: + require_ci_to_pass: no + +coverage: + precision: 1 + round: nearest diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" diff --git a/src/abi/mod.rs b/src/abi/mod.rs new file mode 100644 index 0000000..d7eef51 --- /dev/null +++ b/src/abi/mod.rs @@ -0,0 +1,88 @@ +// SONARE: Runtime environment for formally-verifiable distributed software +// +// SPDX-License-Identifier: Apache-2.0 +// +// Designed in 2019-2024 by Dr Maxim Orlovsky +// Written in 2024 by Dr Maxim Orlovsky +// +// Copyright (C) 2019-2025 LNP/BP Standards Association, Switzerland. +// Copyright (C) 2024-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO), +// Institute for Distributed and Cognitive Systems (InDCS), Switzerland. +// Copyright (C) 2019-2025 Dr Maxim Orlovsky. +// All rights under the above copyrights are reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the License +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// or implied. See the License for the specific language governing permissions and limitations under +// the License. + +use aluvm::regs::Reg; +use aluvm::LibSite; +use amplify::confinement::{SmallOrdMap, TinyOrdMap, TinyOrdSet, TinyString, TinyVec}; +use strict_encoding::Ident; +use strict_types::SemId; + +pub type CallName = Ident; +pub type OwnedStateName = Ident; +pub type FreeStateName = Ident; +pub type ErrorName = Ident; +pub type InputName = Ident; +pub type IfaceName = Ident; + +pub struct OpAbi { + pub spent: TinyOrdSet, + pub input: TinyOrdMap, + // Unlike the free input above, assignments input is always a map from a single-use seal to the data type + pub assignments: TinyOrdMap, +} + +pub struct ReaderAbi { + pub script: Option, + pub return_ty: SemId, + pub return_reg: Reg, +} + +pub struct IfaceDecl { + pub name: IfaceName, + pub inherited: TinyVec, + pub extension: Interface, +} + +pub struct Interface { + // Readers have access to all the contract state, including known unspent assignments and all + // free state. + pub readers: SmallOrdMap, + pub errors: SmallOrdMap, + pub ops: SmallOrdMap, +} + +/// Adaptor converts strict type to a field element - and vice verse. +pub struct AdaptorCall { + pub script: LibSite, + pub strict_reg: Reg, + pub fiel_array_start: Reg, +} + +// Type adaptors must ship with the type library +pub struct TypeAdaptor { + pub sem_id: SemId, + pub strict_to_fiel: AdaptorCall, + pub fiel_to_strict: AdaptorCall, +} + +pub struct Contract { + pub implements: TinyVec, + + // this should be a bijection, meaning both keys and values must be used only once + pub errors: SmallOrdMap, + + // Here we map to semantic ids, not to a field elements. We must + pub free_state: TinyOrdMap, + pub owned_state: TinyOrdMap, + pub ops: SmallOrdMap, +} diff --git a/src/containers/mod.rs b/src/containers/mod.rs new file mode 100644 index 0000000..f2e518c --- /dev/null +++ b/src/containers/mod.rs @@ -0,0 +1,23 @@ +// SONARE: Runtime environment for formally-verifiable distributed software +// +// SPDX-License-Identifier: Apache-2.0 +// +// Designed in 2019-2024 by Dr Maxim Orlovsky +// Written in 2024 by Dr Maxim Orlovsky +// +// Copyright (C) 2019-2025 LNP/BP Standards Association, Switzerland. +// Copyright (C) 2024-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO), +// Institute for Distributed and Cognitive Systems (InDCS), Switzerland. +// Copyright (C) 2019-2025 Dr Maxim Orlovsky. +// All rights under the above copyrights are reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the License +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// or implied. See the License for the specific language governing permissions and limitations under +// the License. + diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..bd0c229 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,41 @@ +// SONARE: Runtime environment for formally-verifiable distributed software +// +// SPDX-License-Identifier: Apache-2.0 +// +// Designed in 2019-2024 by Dr Maxim Orlovsky +// Written in 2024 by Dr Maxim Orlovsky +// +// Copyright (C) 2019-2025 LNP/BP Standards Association, Switzerland. +// Copyright (C) 2024-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO), +// Institute for Distributed and Cognitive Systems (InDCS), Switzerland. +// Copyright (C) 2019-2025 Dr Maxim Orlovsky. +// All rights under the above copyrights are reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the License +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// or implied. See the License for the specific language governing permissions and limitations under +// the License. + +#![cfg_attr(docsrs, feature(doc_auto_cfg))] + +mod abi; +mod persistence; +mod containers; + +extern crate core; + +#[macro_use] +extern crate amplify; +#[macro_use] +extern crate strict_encoding; +#[macro_use] +extern crate commit_verify; + +#[cfg(feature = "serde")] +#[macro_use] +extern crate serde; diff --git a/src/persistence/mod.rs b/src/persistence/mod.rs new file mode 100644 index 0000000..1b367a9 --- /dev/null +++ b/src/persistence/mod.rs @@ -0,0 +1,10 @@ +// zk-AluVM Runtime Environment +// +// SPDX-License-Identifier: Apache-2.0 +// +// Written in 2024 by +// Dr Maxim Orlovsky +// +// Copyright (C) 2024 UBIDECO Labs, +// Institute for Distributed and Cognitive Systems, Switzerland +// Copyright (C) 2024 Dr Maxim Orlovsky. All rights reserved.