diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..b257030 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +# TODO(template) check if needed +[target.wasm32-unknown-unknown] +rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..31e0113 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,32 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.DS_Store +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/secrets.dev.yaml +**/values.dev.yaml +./target +/target +LICENSE +README.md diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml new file mode 100644 index 0000000..d397645 --- /dev/null +++ b/.github/workflows/book.yml @@ -0,0 +1,28 @@ +name: book + +# TODO(template) enable GH pages Settings -> Pages -> Build and deployment -> Source Github Actions +# Documentation should be built and tested on every pull-request, and additionally deployed on push onto next. +on: + pull_request: + path: ['docs/**'] + push: + branches: [next] + path: ['docs/**'] + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Always build and test the mdbook documentation whenever the docs folder is changed. + # + # The documentation is uploaded as a github artifact IFF it is required for deployment i.e. on push into next. + book: + # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages + permissions: + contents: read + pages: write + id-token: write + uses: 0xMiden/.github/.github/workflows/book.yml@main diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..1d7f8e2 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,23 @@ +name: Docker Build Check + +on: + push: + branches: [main, next] + pull_request: + types: [opened, reopened, synchronize] + +jobs: + docker-build: + permissions: + contents: read + id-token: write + uses: 0xMiden/.github/.github/workflows/build-docker.yml@main + with: + component: mybinary # TODO(template) update for the project + dockerfile_path: 'bin/mybinary/Dockerfile' + use_cache: false # TODO(template) or provide AWS configuration secrets to use cache + secrets: + gh_token: ${{ secrets.GITHUB_TOKEN }} + # aws_region: ${{ secrets.AWS_REGION }} + # aws_role: ${{ secrets.AWS_ROLE }} + # aws_cache_bucket: ${{ secrets.AWS_CACHE_BUCKET }} \ No newline at end of file diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..4fc8335 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,9 @@ +name: changelog + +on: + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled] + +jobs: + changelog: + uses: 0xMiden/.github/.github/workflows/changelog.yml@main diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..778c732 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +name: lint + +on: + push: + branches: [main, next] + pull_request: + types: [opened, reopened, synchronize] + + +# Limits workflow concurrency to only the latest commit in the PR. +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + lint: + uses: 0xMiden/.github/.github/workflows/lint.yml@main diff --git a/.github/workflows/publish-debian.yml b/.github/workflows/publish-debian.yml new file mode 100644 index 0000000..d3c9e96 --- /dev/null +++ b/.github/workflows/publish-debian.yml @@ -0,0 +1,47 @@ +name: Publish Debian Package + +on: + workflow_dispatch: + inputs: + service: + description: "Name of service to publish" + required: true + type: choice + options: + - miden-mybinary # TODO(template) update for the project + crate_dir: + required: true + description: "Name of crate directory" + type: choice + options: + - mybinary # TODO(template) update for the project + package: + required: true + description: "Name of packaging directory" + type: choice + options: + - mybinary # TODO(template) update for the project + crate: + description: "Name of the binary crate to publish" + required: true + type: choice + options: + - miden-mybinary # TODO(template) update for the project + version: + description: "Version to release (E.G. v0.10.0-rc.1, v0.10.0). Corresponding git tag must already exist." + required: true + type: string + +jobs: + publish: + permissions: + id-token: write + contents: write + uses: 0xMiden/.github/.github/workflows/publish-debian.yml@main + with: + gh_token: ${{ secrets.GITHUB_TOKEN }} + gitref: ${{ inputs.version }} + crate_dir: ${{ inputs.crate_dir }} + service: ${{ inputs.service }} + package: ${{ inputs.package }} + crate: ${{ inputs.crate }} diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..b8ef693 --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,35 @@ +name: Publish Docker Image + +on: + release: + types: [prereleased, released] + + workflow_dispatch: + inputs: + version: + description: "Version to release (E.G. v0.10.0-rc.1, v0.10.0). Corresponding git tag must already exist." + required: true + type: string + +env: + version: ${{ inputs.version || github.ref_name }} + + +jobs: + publish: + permissions: + id-token: write + contents: write + packages: write + attestations: write + uses: 0xMiden/.github/.github/workflows/publish-docker.yml@main + with: + component: mybinary # TODO(template) update for the project + version: ${{ env.version }} + secrets: + gh_token: ${{ secrets.GITHUB_TOKEN }} + aws_region: ${{ secrets.AWS_REGION }} + aws_role: ${{ secrets.AWS_ROLE }} + aws_cache_bucket: ${{ secrets.AWS_CACHE_BUCKET }} + + \ No newline at end of file diff --git a/.github/workflows/release-plz-dry-run.yml b/.github/workflows/release-plz-dry-run.yml new file mode 100644 index 0000000..d5e739b --- /dev/null +++ b/.github/workflows/release-plz-dry-run.yml @@ -0,0 +1,14 @@ +name: Release-plz (dry-run) + +on: + push: + branches: [main, next] + +jobs: + release-plz-dry-run-release: + permissions: + contents: read + uses: 0xMiden/.github/.github/workflows/release-plz-dry-run.yml@main + secrets: + gh_token: ${{ secrets.GITHUB_TOKEN }} + cargo_registry_token: "test-dry-run" diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..d1b6250 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,14 @@ +name: Release-plz (main) + +on: + release: + types: [published] + +jobs: + release-plz-release: + permissions: + contents: read + uses: 0xMiden/.github/.github/workflows/release-plz.yml@main + secrets: + gh_token: ${{ secrets.GITHUB_TOKEN }} + cargo_registry_token: ${{ secrets.CARGO_REGISTRY_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0256d8b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: test + +on: + push: + branches: [main, next] + pull_request: + types: [opened, reopened, synchronize] + +# Limits workflow concurrency to only the latest commit in the PR. +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + test: + uses: 0xMiden/.github/.github/workflows/test.yml@main diff --git a/.gitignore b/.gitignore index e47cc30..f21c722 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,8 @@ env/ *.out node_modules/ *DS_Store -*.iml \ No newline at end of file +*.iml +book/ + +# TODO(template) uncomment if not a binary +# Cargo.lock diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5b25493 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## v0.2.0 (TODO(template) add date) + +### Enhancements + +### Changes + +### Fixes + +## 0.1.0 (TODO(template) add date) + +- Initial release. diff --git a/Cargo.lock b/Cargo.lock index 15dfcfd..2420a0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,1509 @@ version = 4 [[package]] +<<<<<<< HEAD name = "template" version = "0.1.0" +======= +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "axum" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" +dependencies = [ + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "h2" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "io-uring" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miden-mybinary" +version = "0.1.0" +dependencies = [ + "anyhow", + "miden-mycrate", + "tokio", + "tracing", +] + +[[package]] +name = "miden-mycrate" +version = "0.1.0" +dependencies = [ + "anyhow", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry_sdk", + "thiserror", + "tokio", + "tonic", + "tracing", + "tracing-opentelemetry", + "tracing-subscriber", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "opentelemetry" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf416e4cb72756655126f7dd7bb0af49c674f4c1b9903e80c009e0c37e552e6" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "pin-project-lite", + "thiserror", + "tracing", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbee664a43e07615731afc539ca60c6d9f1a9425e25ca09c57bc36c87c55852b" +dependencies = [ + "http", + "opentelemetry", + "opentelemetry-proto", + "opentelemetry_sdk", + "prost", + "thiserror", + "tokio", + "tonic", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e046fd7660710fe5a05e8748e70d9058dc15c94ba914e7c4faa7c728f0e8ddc" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost", + "tonic", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f644aa9e5e31d11896e024305d7e3c98a88884d9f8919dbf37a9991bc47a4b" +dependencies = [ + "futures-channel", + "futures-executor", + "futures-util", + "opentelemetry", + "percent-encoding", + "rand", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" + +[[package]] +name = "rustls" +version = "0.23.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tokio" +version = "1.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "pin-project-lite", + "slab", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e581ba15a835f4d9ea06c55ab1bd4dce26fc53752c69a04aac00703bfb49ba9" +dependencies = [ + "async-trait", + "axum", + "base64", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost", + "rustls-native-certs", + "socket2", + "tokio", + "tokio-rustls", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcf5959f39507d0d04d6413119c04f33b623f4f951ebcbdddddfad2d0623a9c" +dependencies = [ + "js-sys", + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "smallvec", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", + "web-time", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[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 = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +>>>>>>> c8ff501 (initial) diff --git a/Cargo.toml b/Cargo.toml index 0ed2b17..8f33ce4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,48 @@ -[package] -name = "template" -version = "0.1.0" -edition = "2024" +# TODO(template) update members +[workspace] +members = ["bin/mybinary", "crates/mycrate"] -[dependencies] +resolver = "2" + +[workspace.package] +authors = ["Miden contributors"] +edition = "2024" +exclude = [".github/"] +homepage = "https://miden.xyz" +license = "MIT" +readme = "README.md" +repository = "" # TODO(template) update for the repo url +rust-version = "1.87" +version = "0.1.0" + +[workspace.dependencies] +# Workspace crates (path-based dependencies) +miden-mycrate = { path = "crates/mycrate", version = "0.1" } + +# miden-base aka protocol dependencies (git = "https://github.com/0xMiden/miden-base"). These should be updated in sync. + +# Other miden dependencies. These should align with those expected by miden-base. +miden-air = { version = "0.15" } + +# External dependencies +anyhow = { version = "1.0" } +thiserror = { default-features = false, version = "2.0" } +tokio = { version = "1.46" } +tonic = { version = "0.13" } +tracing = { version = "0.1" } +tracing-subscriber = { features = ["env-filter", "fmt", "json"], version = "0.3" } + +# Lints are set to warn for development, which are promoted to errors in CI. +[workspace.lints.clippy] +# Pedantic lints are set to a lower priority which allows lints in the group to be selectively enabled. +pedantic = { level = "warn", priority = -1 } + +cast_possible_truncation = "allow" # Overly many instances especially regarding indices. +ignored_unit_patterns = "allow" # Stylistic choice. +large_types_passed_by_value = "allow" # Triggered by BlockHeader being Copy + 334 bytes. +missing_errors_doc = "allow" # TODO: fixup and enable this. +missing_panics_doc = "allow" # TODO: fixup and enable this. +module_name_repetitions = "allow" # Many triggers, and is a stylistic choice. +must_use_candidate = "allow" # This marks many fn's which isn't helpful. +should_panic_without_expect = "allow" # We don't care about the specific panic message. +# End of pedantic lints. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1a473d5 --- /dev/null +++ b/Makefile @@ -0,0 +1,123 @@ +.DEFAULT_GOAL := help + +.PHONY: help +help: + @echo "Available commands:" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + @echo + @echo "Prerequisites:" + @echo "\033[36mcargo install taplo-cli --locked\033[0m" + @echo "\033[36mcargo install mdbook --locked\033[0m" + @echo "\033[36mcargo install mdbook-linkcheck --locked\033[0m" + @echo "\033[36mcargo install mdbook-katex --locked\033[0m" + @echo "\033[36mcargo install mdbook-alerts --locked\033[0m" + @echo "\033[36mcargo install cargo-nextest --locked\033[0m" + @echo "\033[36mcargo install typos-cli --locked\033[0m" + +# -- variables ------------------------------------------------------------------------------------ + +WARNINGS=RUSTDOCFLAGS="-D warnings" + +# -- linting -------------------------------------------------------------------------------------- + +.PHONY: clippy +clippy: ## Runs Clippy with configs + CLIPPY_CONF_DIR=configs cargo clippy --locked --all-targets --all-features --workspace -- -D warnings + + +.PHONY: fix +fix: ## Runs Fix with configs + cargo fix --allow-staged --allow-dirty --all-targets --all-features --workspace + + +.PHONY: format +format: ## Runs Format using nightly toolchain + cargo +nightly fmt --all -- --config-path configs/rustfmt.toml + + +.PHONY: format-check +format-check: ## Runs Format using nightly toolchain but only in check mode + cargo +nightly fmt --all --check -- --config-path configs/rustfmt.toml + + +.PHONY: toml +toml: ## Runs Format for all TOML files + taplo fmt -c configs/.taplo.toml + + +.PHONY: toml-check +toml-check: ## Runs Format for all TOML files but only in check mode + taplo fmt -c configs/.taplo.toml --check --verbose + +.PHONY: typos-check +typos-check: ## Runs spellchecker + typos -c configs/_typos.toml + +.PHONY: workspace-check +workspace-check: ## Runs a check that all packages have `lints.workspace = true` + cargo workspace-lints + + +.PHONY: lint +lint: format fix clippy toml workspace-check ## Runs all linting tasks at once (Clippy, fixing, formatting, workspace) + +# --- docs ---------------------------------------------------------------------------------------- + +.PHONY: doc +doc: ## Generates & checks documentation + $(WARNINGS) cargo doc --all-features --keep-going --release --locked + +.PHONY: book +book: ## Builds the book & serves documentation site + mdbook serve --open docs + +# --- testing ------------------------------------------------------------------------------------- + +.PHONY: test +test: ## Runs all tests + cargo nextest run --all-features --workspace + +.PHONY: doc-test +doc-test: ## Runs doc tests + cargo test --doc + +# --- checking ------------------------------------------------------------------------------------ + +.PHONY: check +check: ## Check all targets and features for errors without code generation + cargo check --all-features --all-targets --locked --workspace + +# --- building ------------------------------------------------------------------------------------ + +.PHONY: build +build: ## Builds all crates and re-builds protobuf bindings for proto crates + cargo build --locked --workspace + +#### # TODO(template) below sections for binary #### + +# --- installing ---------------------------------------------------------------------------------- + +.PHONY: install-mybinary +install-mybinary: ## Installs mybinary + cargo install --path bin/mybinary --locked + +# --- docker -------------------------------------------------------------------------------------- + +.PHONY: docker-build-mybinary +docker-build-mybinary: ## Builds the binary using Docker + @CREATED=$$(date) && \ + VERSION=$$(cat bin/mybinary/Cargo.toml | grep -m 1 '^version' | cut -d '"' -f 2) && \ + COMMIT=$$(git rev-parse HEAD) && \ + docker build --build-arg CREATED="$$CREATED" \ + --build-arg VERSION="$$VERSION" \ + --build-arg COMMIT="$$COMMIT" \ + -f bin/mybinary/Dockerfile \ + -t miden-mybinary-image . + +.PHONY: docker-run-mybinary +docker-run-mybinary: ## Runs mybinary as a Docker container + docker volume create mybinary-db + docker run --name miden-mybinary \ + -p 57291:57291 \ + -v mybinary-db:/db \ + -d miden-mybinary-image \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d0d45d2 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Miden Rust project template (TODO(template) update for the project) + + +[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/0xMiden/project-template/blob/main/LICENSE) +[![test](https://github.com/0xMiden/project-template/actions/workflows/test.yml/badge.svg)](https://github.com/0xMiden/project-template/actions/workflows/test.yml) +[![RUST_VERSION](https://img.shields.io/badge/rustc-1.85+-lightgray.svg)](https://www.rust-lang.org/tools/install) +[![crates.io](https://img.shields.io/crates/v/miden-mybinary)](https://crates.io/crates/miden-mybinary) + +Welcome to the Miden Rust template. + +It contains a typical setup for a binary as well as library crates. Feel free to remove unnecessary parts. + +To use: +1. Rely on Github "Use this template" green button or + +```sh +cargo install cargo-generate +cargo generate --git https://github.com/0xMiden/project-template +``` +2. Please search over the codebase `TODO(template)` to make appropriate changes + +## Documentation + +TODO(template) - provide links to the documentation + +## Contributing + +At minimum, please see our [contributing](https://github.com/0xMiden/.github/blob/main/CONTRIBUTING.md) guidelines and our [makefile](Makefile) for example workflows +e.g. run the testsuite using + +```sh +make test +``` + +Note that we do _not_ accept low-effort contributions or AI generated code. For typos and documentation errors please +rather open an issue. + +## License + +This project is [MIT licensed](./LICENSE). diff --git a/bin/mybinary/.env b/bin/mybinary/.env new file mode 100644 index 0000000..f23ea66 --- /dev/null +++ b/bin/mybinary/.env @@ -0,0 +1,2 @@ +# TODO(template) - update for the binary +MIDEN_MYBINARY_ENVVAR_NAME= diff --git a/bin/mybinary/Cargo.toml b/bin/mybinary/Cargo.toml new file mode 100644 index 0000000..632bd21 --- /dev/null +++ b/bin/mybinary/Cargo.toml @@ -0,0 +1,24 @@ +# TODO(template) update for the binary +[package] +authors.workspace = true +description = "Miden mybinary" +edition.workspace = true +homepage.workspace = true +keywords = ["miden"] # TODO(template) add keywords +license.workspace = true +name = "miden-mybinary" # TODO(template) use `miden-` prefix in the name +readme.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[lints] +workspace = true + +[features] + +[dependencies] +anyhow = { workspace = true } +miden-mycrate = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } diff --git a/bin/mybinary/Dockerfile b/bin/mybinary/Dockerfile new file mode 100644 index 0000000..68726be --- /dev/null +++ b/bin/mybinary/Dockerfile @@ -0,0 +1,52 @@ +FROM rust:1.87-slim-bullseye AS builder + +# TODO(template) update for the binary +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y llvm clang bindgen pkg-config libssl-dev libsqlite3-dev ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app +COPY ./Cargo.toml . +COPY ./Cargo.lock . +COPY ./bin ./bin +COPY ./crates ./crates + +# TODO(template) update for the binary +RUN cargo install --path bin/mybinary --locked + +FROM debian:bullseye-slim + +# Update machine & install required packages +# The installation of sqlite3 is needed for correct function of the SQLite database +# TODO(template) update for the binary +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y --no-install-recommends \ + sqlite3 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /usr/local/cargo/bin/miden-mybinary /usr/local/bin/miden-mybinary + +# TODO(template) update for the binary +LABEL org.opencontainers.image.authors=devops@miden.team \ + org.opencontainers.image.url=https://0xMiden.github.io/ \ + org.opencontainers.image.documentation=https://github.com/0xMiden/miden-mybinary \ + org.opencontainers.image.source=https://github.com/0xMiden/miden-mybinary \ + org.opencontainers.image.vendor=Miden \ + org.opencontainers.image.licenses=MIT + +ARG CREATED +ARG VERSION +ARG COMMIT +LABEL org.opencontainers.image.created=$CREATED \ + org.opencontainers.image.version=$VERSION \ + org.opencontainers.image.revision=$COMMIT + +# TODO(template) update for the binary +# Expose port +EXPOSE 8080 + +# Start +# TODO(template) update for the binary +CMD miden-mybinary diff --git a/bin/mybinary/README.md b/bin/mybinary/README.md new file mode 100644 index 0000000..16a4fd5 --- /dev/null +++ b/bin/mybinary/README.md @@ -0,0 +1,6 @@ +# Miden mybinary (TODO(template) update for the binary) + +This crate contains a binary for running a Miden ..... + +## License +This project is [MIT licensed](../../LICENSE). diff --git a/bin/mybinary/src/main.rs b/bin/mybinary/src/main.rs new file mode 100644 index 0000000..bf411cb --- /dev/null +++ b/bin/mybinary/src/main.rs @@ -0,0 +1,9 @@ +use miden_mycrate::logging::{OpenTelemetry, setup_tracing}; + +// TODO(template) update for the binary +#[tokio::main] +async fn main() -> anyhow::Result<()> { + setup_tracing(OpenTelemetry::Enabled)?; + tracing::info!("hello Miden!"); + Ok(()) +} diff --git a/configs/.release-plz.toml b/configs/.release-plz.toml new file mode 100644 index 0000000..77a5682 --- /dev/null +++ b/configs/.release-plz.toml @@ -0,0 +1,10 @@ +[workspace] +changelog_update = false # For now we have our own changelog. +release_always = true # Without the tracking PR, it would never trigger unless `true`. + +git_release_enable = false +git_tag_enable = false + +[[package]] +# TODO(template) update for the project +name = "miden-mycrate" diff --git a/configs/.taplo.toml b/configs/.taplo.toml new file mode 100644 index 0000000..b735451 --- /dev/null +++ b/configs/.taplo.toml @@ -0,0 +1,6 @@ +[formatting] +align_entries = true +column_width = 120 +reorder_arrays = true +reorder_inline_tables = true +reorder_keys = true diff --git a/configs/_typos.toml b/configs/_typos.toml new file mode 100644 index 0000000..ab109a1 --- /dev/null +++ b/configs/_typos.toml @@ -0,0 +1 @@ +[default] diff --git a/configs/clippy.toml b/configs/clippy.toml new file mode 100644 index 0000000..3523592 --- /dev/null +++ b/configs/clippy.toml @@ -0,0 +1 @@ +doc-valid-idents = ["..", "SQLite"] diff --git a/configs/rustfmt.toml b/configs/rustfmt.toml new file mode 100644 index 0000000..248799d --- /dev/null +++ b/configs/rustfmt.toml @@ -0,0 +1,18 @@ +array_width = 80 +attr_fn_like_width = 80 +chain_width = 80 +comment_width = 100 +condense_wildcard_suffixes = true +edition = "2024" +fn_call_width = 80 +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +match_block_trailing_comma = true +newline_style = "Unix" +single_line_if_else_max_width = 60 +single_line_let_else_max_width = 60 +struct_lit_width = 40 +struct_variant_width = 40 +use_field_init_shorthand = true +use_try_shorthand = true +wrap_comments = true diff --git a/crates/mycrate/Cargo.toml b/crates/mycrate/Cargo.toml new file mode 100644 index 0000000..b2c72ad --- /dev/null +++ b/crates/mycrate/Cargo.toml @@ -0,0 +1,28 @@ +[package] +authors.workspace = true +description = "TODO(template) description" +edition.workspace = true +homepage.workspace = true +keywords = ["miden"] # TODO(template) add keywords +license.workspace = true +name = "miden-mycrate" # TODO(template) use `miden-` prefix in the name +readme = "README.md" +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[lints] +workspace = true + +# TODO(template) update for the project +[dependencies] +anyhow = { workspace = true } +opentelemetry = { version = "0.30" } +opentelemetry-otlp = { default-features = false, features = ["grpc-tonic", "tls-roots", "trace"], version = "0.30" } +opentelemetry_sdk = { features = ["rt-tokio", "testing"], version = "0.30" } +thiserror = { workspace = true } +tokio = { workspace = true } +tonic = { workspace = true } +tracing = { workspace = true } +tracing-opentelemetry = { version = "0.31" } +tracing-subscriber = { workspace = true } diff --git a/crates/mycrate/README.md b/crates/mycrate/README.md new file mode 100644 index 0000000..74cc7a5 --- /dev/null +++ b/crates/mycrate/README.md @@ -0,0 +1,6 @@ +# Miden TODO(template) update for the project + +This crate contains ..... + +## License +This project is [MIT licensed](../../LICENSE). diff --git a/crates/mycrate/src/lib.rs b/crates/mycrate/src/lib.rs new file mode 100644 index 0000000..9c356f8 --- /dev/null +++ b/crates/mycrate/src/lib.rs @@ -0,0 +1,79 @@ +pub mod logging; + +pub trait ErrorReport: std::error::Error { + /// Returns a string representation of the error and its source chain. + fn as_report(&self) -> String { + use std::fmt::Write; + let mut report = self.to_string(); + + // SAFETY: write! is suggested by clippy, and is trivially safe usage. + std::iter::successors(self.source(), |child| child.source()) + .for_each(|source| write!(report, "\ncaused by: {source}").unwrap()); + + report + } + + /// Creates a new root in the error chain and returns a string representation of the error and + /// its source chain. + fn as_report_context(&self, context: &'static str) -> String { + format!("{context}: \ncaused by: {}", self.as_report()) + } +} + +impl ErrorReport for T {} + +/// Extends nested results types, allowing them to be flattened. +/// +/// Adapted from: +pub trait FlattenResult +where + InnerError: Into, +{ + fn flatten_result(self) -> Result; +} + +impl FlattenResult + for Result, OuterError> +where + OuterError: From, +{ + fn flatten_result(self) -> Result { + match self { + Ok(Ok(value)) => Ok(value), + Ok(Err(inner)) => Err(inner.into()), + Err(outer) => Err(outer), + } + } +} + +#[cfg(test)] +mod tests { + use crate::ErrorReport; + + #[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)] + pub enum TestSourceError { + #[error("source error")] + Source, + } + + #[derive(thiserror::Error, Debug)] + pub enum TestError { + #[error("parent error")] + Parent(#[from] TestSourceError), + } + + #[test] + fn as_report() { + let error = TestError::Parent(TestSourceError::Source); + assert_eq!("parent error\ncaused by: source error", error.as_report()); + } + + #[test] + fn as_report_context() { + let error = TestError::Parent(TestSourceError::Source); + assert_eq!( + "final error: \ncaused by: parent error\ncaused by: source error", + error.as_report_context("final error") + ); + } +} diff --git a/crates/mycrate/src/logging.rs b/crates/mycrate/src/logging.rs new file mode 100644 index 0000000..bfb23cc --- /dev/null +++ b/crates/mycrate/src/logging.rs @@ -0,0 +1,146 @@ +use std::str::FromStr; + +use anyhow::Result; +use opentelemetry::trace::TracerProvider as _; +use opentelemetry_otlp::WithTonicConfig; +use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::SpanExporter}; +use tracing::subscriber::Subscriber; +use tracing_opentelemetry::OpenTelemetryLayer; +use tracing_subscriber::{ + Layer, Registry, + layer::{Filter, SubscriberExt}, +}; + +/// Configures [`setup_tracing`] to enable or disable the open-telemetry exporter. +#[derive(Clone, Copy)] +pub enum OpenTelemetry { + Enabled, + Disabled, +} + +impl OpenTelemetry { + fn is_enabled(self) -> bool { + matches!(self, OpenTelemetry::Enabled) + } +} + +/// Initializes tracing to stdout and optionally an open-telemetry exporter. +/// +/// Trace filtering defaults to `INFO` and can be configured using the conventional `RUST_LOG` +/// environment variable. +/// +/// The open-telemetry configuration is controlled via environment variables as defined in the +/// [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#opentelemetry-protocol-exporter) +pub fn setup_tracing(otel: OpenTelemetry) -> Result<()> { + if otel.is_enabled() { + opentelemetry::global::set_text_map_propagator(TraceContextPropagator::new()); + } + + // Note: open-telemetry requires a tokio-runtime, so this _must_ be lazily evaluated (aka not + // `then_some`) to avoid crashing sync callers (with OpenTelemetry::Disabled set). Examples of + // such callers are tests with logging enabled. + let otel_layer = { + if otel.is_enabled() { + let exporter = opentelemetry_otlp::SpanExporter::builder() + .with_tonic() + .with_tls_config(tonic::transport::ClientTlsConfig::new().with_native_roots()) + .build()?; + Some(open_telemetry_layer(exporter)) + } else { + None + } + }; + + let subscriber = Registry::default() + .with(stdout_layer().with_filter(env_or_default_filter())) + .with(otel_layer.with_filter(env_or_default_filter())); + tracing::subscriber::set_global_default(subscriber).map_err(Into::into) +} + +/// Initializes tracing to a test exporter. +/// +/// Allows trace content to be inspected via the returned receiver. +/// +/// All tests that use this function must be annotated with `#[serial(open_telemetry_tracing)]`. +/// This forces serialization of all such tests. Otherwise, the tested spans could +/// be interleaved during runtime. Also, the global exporter could be re-initialized in +/// the middle of a concurrently running test. +#[cfg(test)] +pub fn setup_test_tracing() -> Result<( + tokio::sync::mpsc::UnboundedReceiver, + tokio::sync::mpsc::UnboundedReceiver<()>, +)> { + let (exporter, rx_export, rx_shutdown) = + opentelemetry_sdk::testing::trace::new_tokio_test_exporter(); + + let otel_layer = open_telemetry_layer(exporter); + let subscriber = Registry::default() + .with(stdout_layer().with_filter(env_or_default_filter())) + .with(otel_layer.with_filter(env_or_default_filter())); + tracing::subscriber::set_global_default(subscriber)?; + Ok((rx_export, rx_shutdown)) +} + +fn open_telemetry_layer( + exporter: impl SpanExporter + 'static, +) -> Box + Send + Sync + 'static> +where + S: Subscriber + Sync + Send, + for<'a> S: tracing_subscriber::registry::LookupSpan<'a>, +{ + let tracer = opentelemetry_sdk::trace::SdkTracerProvider::builder() + .with_batch_exporter(exporter) + .build(); + + let tracer = tracer.tracer("tracing-otel-subscriber"); + OpenTelemetryLayer::new(tracer).boxed() +} + +fn stdout_layer() -> Box + Send + Sync + 'static> +where + S: Subscriber, + for<'a> S: tracing_subscriber::registry::LookupSpan<'a>, +{ + use tracing_subscriber::fmt::format::FmtSpan; + + tracing_subscriber::fmt::layer() + .pretty() + .compact() + .with_level(true) + .with_file(true) + .with_line_number(true) + .with_target(true) + .with_span_events(FmtSpan::CLOSE) + .boxed() +} + +/// Creates a filter from the `RUST_LOG` env var with a default of `INFO` if unset. +/// +/// # Panics +/// +/// Panics if `RUST_LOG` fails to parse. +fn env_or_default_filter() -> Box + Send + Sync + 'static> { + use tracing::level_filters::LevelFilter; + use tracing_subscriber::{ + EnvFilter, + filter::{FilterExt, Targets}, + }; + + // `tracing` does not allow differentiating between invalid and missing env var so we manually + // do this instead. The alternative is to silently ignore parsing errors which I think is worse. + match std::env::var(EnvFilter::DEFAULT_ENV) { + Ok(rust_log) => FilterExt::boxed( + EnvFilter::from_str(&rust_log) + .expect("RUST_LOG should contain a valid filter configuration"), + ), + Err(std::env::VarError::NotUnicode(_)) => panic!("RUST_LOG contained non-unicode"), + Err(std::env::VarError::NotPresent) => { + // Default level is INFO, and additionally enable logs from axum extractor rejections. + FilterExt::boxed( + Targets::new() + .with_default(LevelFilter::INFO) + .with_target("axum::rejection", LevelFilter::TRACE), + ) + }, + } +} diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..1eab006 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,16 @@ +[book] +authors = ["Miden contributors"] +description = "TODO(template) update for the project" +language = "en" +multilingual = false +title = "TODO(template) update for the project" + +[output.html] +git-repository-url = "TODO(template) update for the project" + +[preprocessor.katex] +after = ["links"] + +[preprocessor.alerts] + +[output.linkcheck] diff --git a/docs/src/EXPORTED.md b/docs/src/EXPORTED.md new file mode 100644 index 0000000..faa52ec --- /dev/null +++ b/docs/src/EXPORTED.md @@ -0,0 +1,6 @@ + + +# TODO(template) update for the project + +Many Miden repos export their respective docs to be merged into [Miden book](https://0xmiden.github.io/miden-docs/index.html). +See also https://github.com/0xMiden/miden-node/blob/next/docs/src/EXPORTED.md as an example. diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 0000000..9ec7e46 --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,6 @@ + +# TODO(template) update for the project + +# Summary + +- [Introduction](./index.md) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..3097068 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,3 @@ +# Introduction + +TODO(template) \ No newline at end of file diff --git a/packaging/mybinary/miden-mybinary.service b/packaging/mybinary/miden-mybinary.service new file mode 100644 index 0000000..a71c37d --- /dev/null +++ b/packaging/mybinary/miden-mybinary.service @@ -0,0 +1,17 @@ +# TODO(template) update for the binary +[Unit] +Description=Miden mybinary +Wants=network-online.target + +[Install] +WantedBy=multi-user.target + +[Service] +Type=exec +Environment="" +EnvironmentFile=/lib/systemd/system/miden-mybinary.env +ExecStart=/usr/bin/miden-binary +WorkingDirectory=/opt/miden-binary +User=miden-binary +RestartSec=5 +Restart=always diff --git a/packaging/mybinary/postinst b/packaging/mybinary/postinst new file mode 100644 index 0000000..8bad2fe --- /dev/null +++ b/packaging/mybinary/postinst @@ -0,0 +1,27 @@ +#!/bin/bash +# +# This is a postinstallation script so the service can be configured and started when requested. + +# user is expected by the systemd service file and `/opt/` is its working directory, +# TODO(template) update for the binary +sudo adduser --disabled-password --disabled-login --shell /usr/sbin/nologin --quiet --system --no-create-home --home /nonexistent miden-mybinary + +# Working folder. +if [ -d "/opt/miden-mybinary" ] +then + echo "Directory /opt/miden-mybinary exists." +else + mkdir -p /opt/miden-mybinary +fi +sudo chown -R miden-mybinary /opt/miden-mybinary + +# Configuration folder +if [ -d "/etc/opt/miden-mybinary" ] +then + echo "Directory /etc/opt/miden-mybinary exists." +else + mkdir -p /etc/opt/miden-mybinary +fi +sudo chown -R miden-mybinary /etc/opt/miden-mybinary + +sudo systemctl daemon-reload diff --git a/packaging/mybinary/postrm b/packaging/mybinary/postrm new file mode 100644 index 0000000..af4c92b --- /dev/null +++ b/packaging/mybinary/postrm @@ -0,0 +1,10 @@ +#!/bin/bash +# +############### +# Remove miden mybinary installs +# TODO(template) update for the binary +############## +sudo rm -rf /lib/systemd/system/miden-mybinary.service +sudo rm -rf /etc/opt/miden-mybinary +sudo deluser miden-mybinary +sudo systemctl daemon-reload diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -}