diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..4f9f14c00c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,19 @@ +name: publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@1.60.0 + - name: dry-run + run: cargo publish --dry-run + - name: publish + run: cargo publish --token ${CRATES_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 94bfb8efc2..672b315943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Nothing. +## [4.0.0] - 2023-03-13 + +### Added + +- support `tz4`, `sr1` hashes. +- `SecretKeyBls`, `PublicKeyBls` support. + +### Changed + +- minimum supported rust version bumped to `1.60`. +- `SecretKeyEd25519` now implements `Debug`, and can be encoded/decoded. +- `crypto` renamed to `tezos_crypto`. +- `tezos_encoding_derive` now supports deriving over generic structs. +- `tezos_encoding` `nom::list`, `nom::dynamic` no longer require `Clone`. +- `lib_sodium` dependency replaced with `cryptoxide` for improved Wasm support. + +### Removed + +- All crates, except for `crypto`, `tezos_encoding` & `tezos_encoding_derive`. +- `crypto::seeded_step`, `crypto::cryptobox` modules removed. + ## [3.1.1] - 2022-06-28 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 94fc0de9b8..9b26ae1a5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,23 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.8", - "once_cell", - "version_check", -] - [[package]] name = "aho-corasick" version = "0.7.20" @@ -64,15 +47,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -155,47 +129,12 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto" -version = "3.1.1" -dependencies = [ - "anyhow", - "base58", - "blst", - "byteorder", - "cryptoxide", - "ed25519-compact", - "fuzzcheck", - "hex", - "libsecp256k1", - "num-bigint", - "num-traits", - "p256", - "proptest", - "rand 0.7.3", - "serde", - "serde_json", - "strum", - "strum_macros", - "thiserror", - "zeroize", -] - [[package]] name = "crypto-bigint" version = "0.2.5" @@ -224,15 +163,6 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "382ce8820a5bb815055d3553a610e8cb542b2d767bbacea99038afda96cd760d" -[[package]] -name = "decent-synquote-alternative" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb1c933ca5ca726b7d4a5e1f60af8af3901642611fcfa927e80517d386f2fd9" -dependencies = [ - "proc-macro2", -] - [[package]] name = "der" version = "0.4.5" @@ -327,17 +257,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "flate2" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" -dependencies = [ - "crc32fast", - "libz-sys", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -350,47 +269,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" -[[package]] -name = "fuzzcheck" -version = "0.10.1" -source = "git+https://github.com/tezedge/fuzzcheck-rs.git#18c4e576d39153f8c4b2d24658ef5b20c15051d2" -dependencies = [ - "ahash", - "bincode", - "bitflags", - "cc", - "cfg-if", - "fastrand", - "flate2", - "fuzzcheck_common", - "fuzzcheck_mutators_derive", - "getopts", - "libc", - "md5", - "nu-ansi-term", - "object", - "regex-syntax", - "serde", - "serde_json", -] - -[[package]] -name = "fuzzcheck_common" -version = "0.10.0" -source = "git+https://github.com/tezedge/fuzzcheck-rs.git#18c4e576d39153f8c4b2d24658ef5b20c15051d2" -dependencies = [ - "getopts", -] - -[[package]] -name = "fuzzcheck_mutators_derive" -version = "0.10.0" -source = "git+https://github.com/tezedge/fuzzcheck-rs.git#18c4e576d39153f8c4b2d24658ef5b20c15051d2" -dependencies = [ - "decent-synquote-alternative", - "proc-macro2", -] - [[package]] name = "generic-array" version = "0.14.6" @@ -401,15 +279,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -585,44 +454,18 @@ dependencies = [ "libsecp256k1-core", ] -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "nom" version = "6.1.2" @@ -636,16 +479,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "nu-ansi-term" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e62e2187cbceeafee9fb7b5e5e182623e0628ebf430a479df4487beb8f92fd7a" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-bigint" version = "0.3.3" @@ -689,15 +522,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.17.1" @@ -710,12 +534,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "p256" version = "0.9.0" @@ -752,12 +570,6 @@ dependencies = [ "syn", ] -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1086,12 +898,35 @@ dependencies = [ ] [[package]] -name = "tezos_encoding" -version = "3.1.1" +name = "tezos_crypto" +version = "4.0.0" +dependencies = [ + "anyhow", + "base58", + "blst", + "byteorder", + "cryptoxide", + "ed25519-compact", + "hex", + "libsecp256k1", + "num-bigint", + "num-traits", + "p256", + "proptest", + "rand 0.7.3", + "serde", + "serde_json", + "strum", + "strum_macros", + "thiserror", + "zeroize", +] + +[[package]] +name = "tezos_data_encoding" +version = "4.0.0" dependencies = [ "bit-vec", - "crypto", - "fuzzcheck", "hex", "lazy_static", "nom", @@ -1099,13 +934,14 @@ dependencies = [ "num-traits", "serde", "serde_json", - "tezos_encoding_derive", + "tezos_crypto", + "tezos_data_encoding_derive", "thiserror", ] [[package]] -name = "tezos_encoding_derive" -version = "3.1.1" +name = "tezos_data_encoding_derive" +version = "4.0.0" dependencies = [ "lazy_static", "once_cell", @@ -1168,24 +1004,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "unicode-xid" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" diff --git a/README.md b/README.md index 405dc7b6be..1b26026fda 100644 --- a/README.md +++ b/README.md @@ -1,472 +1,27 @@ -# TezEdge [![Docs Status]][docs Link] [![Changelog][changelog-badge]][changelog] [![release-badge]][release-link] [![docker-badge]][docker-link] [![MIT licensed]][MIT link] +# TezEdge [![Changelog][changelog-badge]][changelog] [![MIT licensed]][MIT link] --- -The purpose of this project is to implement a secure, trustworthy and open-source Tezos node in Rust. -In addition to implementing a new node, the project seeks to maintain and improve the Tezos ecosystem wherever possible. +Utility crates, forked from [tezedge](github.com/tezedge/tezedge), used as part of the `Kernel SDK` for tezos smart rollups. -## Table of Contents -* [Build status](#build-status) -* [Quick demo](#quick-demo) - * [Prerequisites](#prerequisites) - * [Run demo](#run-demo) -* [Documentation](#documentation) -* [How to build](#how-to-build) - * [Supported OS distributions](#supported-os-distributions) - * [Prerequisites installation](#prerequisites-installation) - * [Build from source code](#build-from-source-code) -* [How to run](#how-to-run) - * [From source with `cargo run`](#running-node-with-cargo-run) - * [Using simplified script `run.sh`](#running-node-with-runsh-script) - * [Run docker image](#running-node-from-docker) - * [Graceful shutdown](#shutdown-running-node-gracefully) -* [How to use](#how-to-use) - * [Call RPC](#example-of-how-to-call-the-rpc) - * [Baking](#baking) - * [Prearranged-docker-compose-files](#prearranged-docker-compose-files) - * [Mainnet - node + explorer](#mainnet---light-node--tezedge-explorer) - * [Mainnet - node + explorer + debugger (eBPF)](#mainnet---light-node--tezedge-explorer--tezedge-debugger) - * [Mainnet - nodes with irmin vs memory storage + explorer](#mainnet---light-node-with-irmin-context--light-node-with-memory-context--tezedge-explorer) +Namely: +- [tezos_crypto](./crypto/README.md) +- [tezos_encoding](./tezos-encoding/README.md) +- [tezos_encoding_derive](./tezos-encoding-derive/README.md) -[comment]: <> ( * [Sandbox - node launcher + explorer + debugger](#sandbox---sandbox-launcher--light-node--tezedge-explorer)) +## Setup -## Build status +The following prerequisites are required: ---- - -| CI / branch | master | develop | -|----------|:-------------:|------:| -| GitHub Actions | [![Build Status master]][Build Link master] | [![Build Status develop]][Build Link develop] | -| Drone | [![Drone Status master]][Drone Link] | [![Drone Status develop]][Drone Link] | - -[Build Status master]: https://github.com/tezedge/tezedge/workflows/build/badge.svg?branch=master -[Build Status develop]: https://github.com/tezedge/tezedge/workflows/build/badge.svg?branch=develop -[Build Link master]: https://github.com/tezedge/tezedge/actions?query=workflow%3Abuild+branch%3Amaster -[Build Link develop]: https://github.com/tezedge/tezedge/actions?query=workflow%3Abuild+branch%3Adevelop - -[Drone Status master]: http://ci.tezedge.com/api/badges/tezedge/tezedge/status.svg?ref=refs/heads/master -[Drone Status develop]: http://ci.tezedge.com/api/badges/tezedge/tezedge/status.svg?ref=refs/heads/develop -[Drone Link]: http://ci.tezedge.com/tezedge/tezedge/ - -[Docs Status]: https://img.shields.io/badge/user--docs-master-informational -[Docs Link]: http://docs.tezedge.com/ - -[RustDoc Status]:https://img.shields.io/badge/code--docs-master-orange - -[MIT licensed]: https://img.shields.io/badge/license-MIT-blue.svg -[MIT link]: https://github.com/tezedge/tezedge/blob/master/LICENSE - -[changelog]: ./CHANGELOG.md -[changelog-badge]: https://img.shields.io/badge/changelog-Changelog-%23E05735 - -[release-badge]: https://img.shields.io/github/v/release/tezedge/tezedge -[release-link]: https://github.com/tezedge/tezedge/releases/latest - -[docker-badge]: https://img.shields.io/badge/docker-images-blue -[docker-link]: https://hub.docker.com/r/tezedge/tezedge/tags - -## Quick demo - ---- - -This demo launches two items: -- The **TezEdge node** (p2p application), which connects to the **Tezos Mainnet network**. -- The **TezEdge explorer** (web application), which connects to the TezEdge node and can be accessed from a browser to see what is going on inside the TezEdge node - -### Prerequisites -If you want to run this demo, you need to first install the following: -* Git (client) -* Docker - -### Run demo - -1. **Download the TezEdge source code** - ``` - # Open shell and type this code into the command line and then press Enter: - git clone https://github.com/tezedge/tezedge - cd tezedge - ``` -2. **Run docker (compose)** - ``` - # Open shell and type this code into the command line and then press Enter: - docker-compose pull - docker-compose up - ``` - ![alt text](https://raw.githubusercontent.com/tezedge/tezedge/master/docs/images/node_bootstrap.gif) -3. **Open your web browser by entering this address into your browser's URL bar: http://localhost:8080** - ![alt text](https://raw.githubusercontent.com/tezedge/tezedge/master/docs/images/tezedge_explorer.gif) - - -_**Docker for Windows**_ - -The images use the hostname `localhost` to access running services. -When using docker for windows, please check: -``` -docker-machine ip -``` -and make sure that port forwarding is set up correctly for docker or use docker-machine resolved ip instead of `http://localhost:8080` - -``` -TCP ports (:): - - "80:80" - - "4927:4927" - - "18732:18732" - - "19732:9732" -``` - -## Documentation - ---- -_Detailed project's documentation can be found here [Documentation][Docs Link]_ - - -## How to build - ---- - -### Supported OS distributions - -We are linking Rust code with a pre-compiled Tezos shared library. For your convenience, we have created pre-compiled binary files -for most of the more popular Linux distributions: - - -| OS | Versions | -|----------|:-------------:| -| Ubuntu | 16.04, 18.04, 18.10, 19.04, 19.10, 20.04, 20.10, 21.04, 21.10, 22.04 | -| Debian | 9, 10 | -| OpenSUSE | 15.1, 15.2 | -| CentOS | 8 | -| MacOS | *experimental* - newer or equal to 10.13 should work, Intel and M1 cpus | - -If you are missing support for your favorite Linux distribution, please submit a request with the [tezos-opam-builder](https://github.com/tezedge/tezos-opam-builder) project. - -To build from source please follow [these instructions](tezos/interop/README.md). - -### Prerequisites installation -If you want to build from source code, you need to install this before: -1. Install **Git** (client) -2. Install **Rust** command _(We recommend installing Rust through rustup.)_ - ``` - # Run the following in your terminal, then follow the onscreen instructions. - curl https://sh.rustup.rs -sSf | sh - ``` -3. Install **Rust toolchain** _(Our releases are built with 1.58.1.)_ - ``` - rustup toolchain install 1.58.1 - rustup default 1.58.1 - ``` -4. Install **required OS libs** - - OpenSSL and Zlib - ``` - sudo apt install openssl libssl-dev zlib1g - ``` - - Sodiumoxide package: - ``` - sudo apt install pkg-config libsodium-dev - ``` - - RocksDB package: - ``` - sudo apt install clang libclang-dev llvm llvm-dev linux-kernel-headers libev-dev - ``` - - In macOS, using [Homebrew](https://brew.sh/): - ``` - brew install pkg-config gmp libev libsodium hidapi libffi - ``` - - Sandbox/wallet requirements: - ``` - sudo apt install libhidapi-dev - ``` - -### Build from source code - -1. **Download TezEdge source code** - ``` - # Open shell, type this code into the command line and then press Enter: - git clone https://github.com/tezedge/tezedge - cd tezedge - ``` - -2. **Build** - - ``` - export SODIUM_USE_PKG_CONFIG=1 - cargo build --release - ``` - - _The node can built through the `cargo build` or `cargo build --release`, be aware, release build can take - much longer to compile._ - -3. **Test** - - ``` - export SODIUM_USE_PKG_CONFIG=1 - export DYLD_LIBRARY_PATH=$(pwd)/tezos/sys/lib_tezos/artifacts # currently needed for macOS - cargo test --release - ``` - -## How to run - ---- - -### Running node with `cargo run` - -To run the node manually, you need to first build it from the source code. When put together, the node can be run, for example, like this: - -``` -cargo build --release -cargo run --release --bin light-node -- --config-file ./light_node/etc/tezedge/tezedge.config --protocol-runner=./target/release/protocol-runner --network=mainnet -``` - -All parameters can also be provided as command line arguments in the same format as in the config file, in which case -they have a higher priority than the ones in the config file. For example, we can use the default config and change the log file path: - -``` -cargo build --release -cargo run --release --bin light-node -- --config-file ./light_node/etc/tezedge/tezedge.config --log-file /tmp/logs/tezdge.log --protocol-runner=./target/release/protocol-runner --network=mainnet -``` - -_Full description of all arguments is in the light_node [README](light_node/README.md) file._ - -### Running node with `run.sh` script - -For Linux systems, we have prepared a convenience script to run the node. It will automatically set all the necessary environmnent variables and then build and run the TezEdge node. -All arguments can be provided to the `run.sh` script in the same manner as described in the previous section. - -To run the node in release mode, execute the following: - -_KEEP_DATA - this flag controls, if all the target directories should be cleaned on the startup, 1 means do not clean_ - -``` -KEEP_DATA=1 ./run.sh release --network=mainnet -``` - -The following command will execute the node in debug node: - -``` -KEEP_DATA=1 ./run.sh node --network=mainnet -``` - -To run the node in debug mode with an address sanitizer, execute the following: - -``` -KEEP_DATA=1 ./run.sh node-saddr --network=mainnet -``` - -You can use the docker version to build and run node from the actual source code. -- you can experiment and change source code without installing all requirements, just docker. -- you can build/run node on Windows/OSX -- this is just for development, because docker is based on full Linux (pre-build docker images are Distroless) - -_If you do not need to build from souce code, just use our pre-build [docker images](#running-node-from-docker-images)_ - -``` -./run.sh docker --network=mainnet -``` - -Listening for updates. Node emits statistics on the websocket server, which can be changed by `--websocket-address` argument, for example: - -``` -KEEP_DATA=1 ./run.sh node --network=mainnet --websocket-address 0.0.0.0:12345 -``` +- rust 1.60, with the `wasm32-unknown-unknown` target. +- clang - tested with `v11`. -_Full description of all arguments is in the light_node [README](light_node/README.md) file._ +> If running on MacOS - you will need to install llvm with brew, and ensure the brew-install is available in your path, rather than the default installation. -### Running node from `binaries` +You should then be able to run: -_Note: This cmd runs from the main git sources directory_ +```shell +cargo build +cargo test +cargo build --target wasm32-unknown-unknown --no-default-features ``` -LD_LIBRARY_PATH=./tezos/sys/lib_tezos/artifacts ./target/release/light-node \ - --network "mainnet" \ - --identity-file "/tmp/data-dir-mainnet/identity.json" \ - --identity-expected-pow 26.0 \ - --tezos-data-dir "/tmp/data-dir-mainnet/context_data" \ - --bootstrap-db-path "/tmp/data-dir-mainnet/tezedge_data" \ - --peer-thresh-low 30 --peer-thresh-high 45 \ - --protocol-runner "./target/release/protocol-runner" \ - --init-sapling-spend-params-file "./tezos/sys/lib_tezos/artifacts/sapling-spend.params" \ - --init-sapling-output-params-file "./tezos/sys/lib_tezos/artifacts/sapling-output.params" \ - --p2p-port 9732 --rpc-port 18732 \ - --tokio-threads 0 \ - --ocaml-log-enabled false \ - --tezos-context-storage=irmin \ - --log terminal \ - --log file \ - --log-level info \ - --log-format simple -``` - -### Running node from docker images - -We provide automatically built images that can be downloaded from our [Docker hub][docker-link]. -For instance, this can be useful when you want to run the TezEdge node in your test CI pipelines. - -#### Images (distroless) -- `tezedge/tezedge:vX.Y.Z` - last versioned stable released version -- `tezedge/tezedge:latest-release` - last stable released version -- `tezedge/tezedge:latest` - actual stable development version -- `tezedge/tezedge:sandbox-vX.Y.Z` - last versioned stable released version for sandbox launcher -- `tezedge/tezedge:sandbox-latest-release` - last stable released version for sandbox launcher -- `tezedge/tezedge:sandbox-latest` - last stable released version for sandbox launcher - -_More about building TezEdge docker images see [here](docker/README.md)._ - -#### Run image - -``` -docker run -i -p 9732:9732 -p 18732:18732 -p 4927:4927 -t tezedge/tezedge:v3.1.1 --network=mainnet --p2p-port 9732 --rpc-port 18732 -``` -_A full description of all arguments can be found in the light_node [README](light_node/README.md) file._ - -### Shutdown running node gracefully - -Just press `Ctrl-c`, works for e.g. `cargo run` or `run.sh` script. - -Or you can send a `signal` to a running process, the dedicated signal is `SIGINT`, e.g.: -``` -kill -s SIGINT -``` - -## How to use - ---- - -### Example of how to call the RPC - -Open shell, type this code into the command line and then press Enter: - -``` -curl localhost:18732/chains/main/blocks/head -``` - -For a more detailed description of the RPCs, see the [shell](https://docs.tezedge.com/endpoints/shell) and the [protocol](https://docs.tezedge.com/endpoints/protocol) endpoints. - -### Baking - -- [Using Tezedge external baker](apps/baker/README.md) -- [Using Tezedge embedded baker](shell_automaton/src/baker/README.md) -- [Baking in the Ithaca testnet](baking/012-Psithaca/README.md) -- [Baking in the mainnet](baking/mainnet/README.md) - -### Prearranged docker-compose files - -#### Mainnet - light-node + tezedge explorer - -**Last released version:** -``` -docker-compose -f docker-compose.yml pull -docker-compose -f docker-compose.yml up -``` - -*(optional) Environment configuration:* - -``` -# (default: irmin) - choose context implementation, possible values: [irmin, tezedge, both] -TEZOS_CONTEXT_STORAGE= - -# explorer accesses node/debugger on 'localhost' by default, you can change it like, -NODE_HOSTNAME_OR_IP= - -e.g.: -TEZOS_CONTEXT_STORAGE=irmin NODE_HOSTNAME_OR_IP=123.123.123.123 docker-compose -f docker-compose.yml up -``` - -#### Mainnet - light-node + tezedge explorer + tezedge debugger - -**Last released version with TezEdge Debugger with integrated eBPF** - -_This requires Linux kernel at least 5.11_ -``` -docker-compose -f docker-compose.debug.yml pull -docker-compose -f docker-compose.debug.yml up -``` - -*(optional) Environment configuration:* - -``` -# (default: irmin) - choose context implementation, possible values: [irmin, tezedge, both] -TEZOS_CONTEXT_STORAGE= - -# explorer accesses node/debugger on 'localhost' by default, you can change it like, -NODE_HOSTNAME_OR_IP= - -e.g.: -TEZOS_CONTEXT_STORAGE=irmin NODE_HOSTNAME_OR_IP=123.123.123.123 docker-compose -f docker-compose.debug.yml up -``` - -#### Mainnet - light-node with irmin context + light-node with memory context + light-node with persistent context + tezedge-explorer - -This runs two explorers: -- http://localhost:8181 - with Irmin storage -- http://localhost:8282 - with Memory storage -- http://localhost:8383 - with Persistent storage - -``` -# Irmin context -docker-compose -f docker-compose.storage.irmin.yml pull -docker-compose -f docker-compose.storage.irmin.yml up - -# TezEdge in-memory context -docker-compose -f docker-compose.storage.memory.yml pull -docker-compose -f docker-compose.storage.memory.yml up - -# TezEdge persistent context -docker-compose -f docker-compose.storage.persistent.yml pull -docker-compose -f docker-compose.storage.persistent.yml up -``` - -*(optional) Environment configuration:* - -``` -# explorer accesses node on 'localhost' by default, you can change it like, -NODE_HOSTNAME_OR_IP= -``` - -[comment]: <> (#### Sandbox - sandbox launcher + light-node + tezedge-explorer) - -[comment]: <> (_See more info about sandbox [here](sandbox/README.MD)_) - -[comment]: <> (**Last released version:**) - -[comment]: <> (```) - -[comment]: <> (docker-compose -f docker-compose.sandbox.yml pull) - -[comment]: <> (docker-compose -f docker-compose.sandbox.yml up) - -[comment]: <> (```) - -[comment]: <> (**Actual development version:**) - -[comment]: <> (```) - -[comment]: <> (docker-compose -f docker-compose.sandbox.latest.yml pull) - -[comment]: <> (docker-compose -f docker-compose.sandbox.latest.yml up) - -[comment]: <> (```) - -[comment]: <> (#### Sandbox node launcher + tezedge-explorer + tezedge-debugger) - -[comment]: <> (**Last released version:**) - -[comment]: <> (```) - -[comment]: <> (docker-compose -f docker-compose.sandbox.yml pull) - -[comment]: <> (docker-compose -f docker-compose.sandbox.yml up) - -[comment]: <> (```) - -[comment]: <> (**Actual development version:**) - -[comment]: <> (```) - -[comment]: <> (docker-compose -f docker-compose.sandbox.latest.yml pull) - -[comment]: <> (docker-compose -f docker-compose.sandbox.latest.yml up) - -[comment]: <> (# stop and remove docker volume) - -[comment]: <> (docker-compose -f docker-compose.sandbox.latest.yml down -v) - -[comment]: <> (```) diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index bd85c87392..ad187264e5 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -1,9 +1,14 @@ [package] -name = "crypto" -version = "3.1.1" -authors = ["Tomas Sedlak "] +name = "tezos_crypto" +version = "4.0.0" +authors = ["TriliTech "] edition = "2021" rust-version = "1.60" +license = "MIT" +keywords = ["tezos"] +categories = ["cryptography::cryptocurrencies"] +description = "Utilities for tezos-related cryptographic operations." +repository = "https://github.com/trilitech/tezedge.git" [dependencies] anyhow = "1.0" @@ -24,7 +29,6 @@ ed25519-compact = { version ="2.0", default-features = false } cryptoxide = { version = "0.4.4", default-features = false, features = ["sha2", "blake2"] } blst = "0.3.10" -fuzzcheck = { git = "https://github.com/tezedge/fuzzcheck-rs.git", optional = true } proptest = { version = "1.1", optional = true } [dev-dependencies] @@ -33,4 +37,3 @@ serde_json = "1.0" [features] default = ["std"] std = ["rand/std", "num-bigint/rand", "libsecp256k1/std", "p256/std", "proptest"] -fuzzing = ["fuzzcheck"] diff --git a/crypto/README.md b/crypto/README.md index 1f93902f6e..cd0c39efcc 100644 --- a/crypto/README.md +++ b/crypto/README.md @@ -1,4 +1,12 @@ -Crypto +Tezos crypto =========== -Component contains cryptographic algorithms for encryption and decryption of messages \ No newline at end of file +Component contains cryptographic algorithms for hashing, signing & signature verification, with a slant towards +those used by [tezos](https://tezos.com/) - and in particular the `Kernel SDK` for [smart rollups](https://tezos.gitlab.io/alpha/smart_rollups.html). + +## Hash module + +`tezos_crypto::hash` contains definitions for common hashes in tezos - such as contract & address hashes. These +support `b58check` encoding/decoding with the same prefixes used in the rest of tezos - such as `tz1` for `ed25519` addresses. + +These support encoding/decoding to binary with the `tezos_encoding` crate. diff --git a/crypto/src/blake2b.rs b/crypto/src/blake2b.rs index 8b3e86de84..1a3aea1f6e 100644 --- a/crypto/src/blake2b.rs +++ b/crypto/src/blake2b.rs @@ -1,4 +1,6 @@ -// Copyright (c) SimpleStaking, Viable Systems, TriliTech and Tezedge Contributors +// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors +// SPDX-FileCopyrightText: 2023 TriliTech +// // SPDX-License-Identifier: MIT use cryptoxide::blake2b::Blake2b; @@ -47,12 +49,6 @@ pub fn digest(data: &[u8], out_len: usize) -> Result, Blake2bError> { hasher.input(data); - println!( - "DIGEST: out_len {} | output_bytes {} | output_bits {}", - out_len, - hasher.output_bytes(), - hasher.output_bits() - ); let mut result = vec![0; hasher.output_bytes()]; hasher.result(result.as_mut_slice()); diff --git a/tezos-encoding-derive/Cargo.toml b/tezos-encoding-derive/Cargo.toml index 3d5bde31cc..9ce288463b 100644 --- a/tezos-encoding-derive/Cargo.toml +++ b/tezos-encoding-derive/Cargo.toml @@ -1,11 +1,15 @@ [package] -name = "tezos_encoding_derive" -version = "3.1.1" -authors = ["Alexander Koptelov "] +name = "tezos_data_encoding_derive" +version = "4.0.0" +authors = ["TriliTech "] edition = "2021" rust-version = "1.60" +license = "MIT" +keywords = ["tezos"] +categories = ["encoding"] +description = "Procedural macros for tezos_encoding." +repository = "https://github.com/trilitech/tezedge.git" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] proc-macro = true diff --git a/tezos-encoding-derive/README.md b/tezos-encoding-derive/README.md new file mode 100644 index 0000000000..a6acc1061b --- /dev/null +++ b/tezos-encoding-derive/README.md @@ -0,0 +1,5 @@ +Tezos data encoding derive +===================== + +Procedural macro to allow automatic derivation of `HasEncoding`, `BinWriter` & `NomReader` traits - enabling +(de)serialization of rust structures to the `Data_encoding` binary format, with less boilerplate. diff --git a/tezos-encoding/Cargo.toml b/tezos-encoding/Cargo.toml index 7cc5087174..6df94aacae 100644 --- a/tezos-encoding/Cargo.toml +++ b/tezos-encoding/Cargo.toml @@ -1,9 +1,14 @@ [package] -name = "tezos_encoding" -version = "3.1.1" -authors = ["Tomas Sedlak "] +name = "tezos_data_encoding" +version = "4.0.0" +authors = ["TriliTech "] edition = "2021" rust-version = "1.60" +license = "MIT" +keywords = ["tezos"] +categories = ["encoding"] +description = "Utilities for encoding/decoding data compatible with tezos data encoding." +repository = "https://github.com/trilitech/tezedge.git" [dependencies] bit-vec = "0.6.2" @@ -15,12 +20,10 @@ serde = { version = "1.0", features = ["derive"] } nom = "6.1" lazy_static = "1.4" # local dependencies -crypto = { path = "../crypto", default-features = false } -tezos_encoding_derive = { path = "../tezos-encoding-derive" } -fuzzcheck = { git = "https://github.com/tezedge/fuzzcheck-rs.git", optional = true } +tezos_crypto = { path = "../crypto", default-features = false } +tezos_data_encoding_derive = { path = "../tezos-encoding-derive" } [features] -fuzzing = ["fuzzcheck", "crypto/fuzzing", "tezos_encoding_derive/fuzzing"] [dev-dependencies] serde_json = "1.0" diff --git a/tezos-encoding/README.md b/tezos-encoding/README.md index 339b8b0c6b..5a899481de 100644 --- a/tezos-encoding/README.md +++ b/tezos-encoding/README.md @@ -1,4 +1,5 @@ -Tezos encoding +Tezos data encoding =========== -All incoming messages are transformed into standard Rust structures for easy manipulation using de component. This component implements serialization and deserialization of all data types used in Tezos messages. \ No newline at end of file +Helpers for (de)serialization of rust structures, to match the binary format produced by the `Data_encoding` libary +used by [octez](https://gitlab.com/tezos/tezos). diff --git a/tezos-encoding/src/enc.rs b/tezos-encoding/src/enc.rs index 88b3567218..e1f969b417 100644 --- a/tezos-encoding/src/enc.rs +++ b/tezos-encoding/src/enc.rs @@ -9,7 +9,7 @@ use crate::bit_utils::BitReverse; use crate::types::{Mutez, Zarith}; use num_bigint::BigUint; -pub use tezos_encoding_derive::BinWriter; +pub use tezos_data_encoding_derive::BinWriter; use thiserror::Error; diff --git a/tezos-encoding/src/encoding.rs b/tezos-encoding/src/encoding.rs index 941a050768..342e106f58 100644 --- a/tezos-encoding/src/encoding.rs +++ b/tezos-encoding/src/encoding.rs @@ -7,7 +7,7 @@ use crypto::hash::{HashTrait, HashType}; use std::collections::HashMap; -pub use tezos_encoding_derive::HasEncoding; +pub use tezos_data_encoding_derive::HasEncoding; #[derive(Debug, Clone)] pub struct Field { diff --git a/tezos-encoding/src/lib.rs b/tezos-encoding/src/lib.rs index e7167ef727..60e9a19ec1 100644 --- a/tezos-encoding/src/lib.rs +++ b/tezos-encoding/src/lib.rs @@ -5,6 +5,8 @@ //! This crate provides serialization and deserialization functionality for the data types used by the Tezos shell. +extern crate tezos_crypto as crypto; + mod bit_utils; pub mod types; diff --git a/tezos-encoding/src/nom.rs b/tezos-encoding/src/nom.rs index d7521d8771..5e320b600c 100644 --- a/tezos-encoding/src/nom.rs +++ b/tezos-encoding/src/nom.rs @@ -15,7 +15,7 @@ use nom::{ Err, InputLength, Parser, Slice, }; use num_bigint::{BigInt, BigUint, Sign}; -pub use tezos_encoding_derive::NomReader; +pub use tezos_data_encoding_derive::NomReader; use crate::types::{Mutez, Zarith}; diff --git a/tezos-encoding/src/types.rs b/tezos-encoding/src/types.rs index 9339ef5200..bcc2ebff70 100644 --- a/tezos-encoding/src/types.rs +++ b/tezos-encoding/src/types.rs @@ -466,7 +466,7 @@ pub const BYTE_FIELD_NONE: u8 = 0; /// First we need to convert it to intermediate form represented by the [Value] type. /// Structure will be converted to: /// ```rust -/// use crate::tezos_encoding::types::Value; +/// use crate::tezos_data_encoding::types::Value; /// let intermediate = Value::Record(vec![ /// ("count".into(), Value::Int32(1)), /// ("diameter".into(), Value::Float(102.95))