{"id":18315774,"url":"https://github.com/LimeChain/zest","last_synced_at":"2025-04-05T20:32:42.421Z","repository":{"id":258537844,"uuid":"758410435","full_name":"LimeChain/zest","owner":"LimeChain","description":"Limechain Solana Code Coverage CLI","archived":false,"fork":false,"pushed_at":"2025-03-20T08:50:14.000Z","size":161,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T09:39:23.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LimeChain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-16T09:05:13.000Z","updated_at":"2025-03-20T08:50:17.000Z","dependencies_parsed_at":"2024-11-22T22:19:09.301Z","dependency_job_id":"ac522747-e523-4488-824b-cf8011add088","html_url":"https://github.com/LimeChain/zest","commit_stats":null,"previous_names":["limechain/zest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fzest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fzest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fzest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fzest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LimeChain","download_url":"https://codeload.github.com/LimeChain/zest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399818,"owners_count":20932875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T17:01:06.498Z","updated_at":"2025-04-05T20:32:42.413Z","avatar_url":"https://github.com/LimeChain.png","language":"Rust","funding_links":[],"categories":["Developer Resources","Rust"],"sub_categories":["Testing Programs"],"readme":"# Zest\n\n![Logo](./assets/logo.svg)\n\nZest is a code coverage CLI tool for Solana programs. Zest is built by LimeChain, a blockchain development and consulting firm founded in 2017. The development of the tool is supported by a grant from the Solana Foundation. \n\n## Demo screenshot\n\n![image](https://github.com/user-attachments/assets/e2cc4dd9-e288-43f3-8378-a935496c2821)\n\n## Install\n\n```bash\ncargo install --git https://github.com/LimeChain/zest zest --force\n```\n\n## Usage\n\n```bash\n# Move into the target project\ncd ./examples/setter/anchor\n# This will run coverage for the example using the `instrument-coverage` strategy without `branch` info\nzest coverage\n\n# Path to the target project can also be specified using the `--path` option\nzest coverage --path ./examples/setter/anchor\n\n# Configuration options can also be read from a (TOML) config file (`zest-coverage.toml` by default)\ncat \u003c\u003cTOML \u003e my_zest_config.toml\npath = \"./examples/setter/anchor\"\nbranch = true\n# contract_style = \"anchor\"\n# tests = [\"integration\"]\n# output_types = [\"lcov\", \"html\"]\nTOML\n\n# Which would run with\n#  `coverage_strategy` being `instrument-coverage`       (Default)\n#               `path` being `./examples/setter/anchor/` (from config file)\n#             `branch` being `false`                     (CLI override)\nzest coverage --config ./my_zest_config.toml --branch false\n```\n\n\u003e [!NOTE]\n\u003e Check `zest --help` and `zest coverage --help` for more info\n\n\u003e [!NOTE]\n\u003e More info on the different strategies can be found [here](https://doc.rust-lang.org/beta/rustc/instrument-coverage.html)\n\n## Program compatibility\n\nCurrently, `zest` only supports testing programs, written in Rust, with tests written in Rust (usually using [solana-program-test](https://crates.io/crates/solana-program-test), as opposed to the *classic* `Typescript` tests), which do not depend on the `cargo-{build,test}-sbf` toolchain. A.K.A if `cargo test` works for you (not `cargo test-sbf`), then `zest` will too\n\nHere's a small list of publicly available Solana programs that we've tested if they work with `zest` or not:\n\nWorks on:\n\n- [raydium-clmm](https://github.com/raydium-io/raydium-clmm)\n- [serum-dex](https://github.com/jup-ag/serum-dex)\n- [token-vesting](https://github.com/staratlasmeta/token-vesting)\n\n### Compatibility requirements\n\nHow to make sure `zest` works for your program:\n\n1. Make sure you're using a Rust framework ([solana-program-test](https://crates.io/crates/solana-program-test) or similar, like [liteSVM](https://github.com/LiteSVM/litesvm)) for your testing purposes\n2. Make sure your tests are runnable by just `cargo test`\n\n    This is done by supplying your program's `processor` (the `process_instruction` function) directly when adding it to the test validator\n\n    ```rust\n    let mut validator = ProgramTest::default();\n    validator.add_program(\n        \"counter_solana_native\",\n        counter_solana_native::ID,\n        processor!(counter_solana_native::process_instruction),\n    );\n    ```\n\n    That requirement is incompatible with `shank` framework, since it puts a type constraint on the `processor` function.\n\n\u003e [!NOTE]\n\u003e That happens because of the `context` function from [`ShankContext`](https://docs.rs/shank/0.4.2/shank/derive.ShankContext.html), seen in their [example](https://docs.rs/shank/0.4.2/shank/derive.ShankContext.html#example) (the `'a` lifetime), which breaks the compatibility (and thus makes it testable only in *`sbf` mode*).\n\n## Branch coverage\n\n\u003e [!NOTE]\n\u003e Branch coverage can be enabled with the `--branch` flag but it requires a recent enough version of the nightly compiler to work.\n\u003e It is also only supported when using the `instrument-coverage` coverage strategy (default).\n\n\u003cdetails\u003e\n  \u003csummary\u003eThere isn't yet a version of the compiler that both supports `branch` coverage and `solana-program` compilation\u003c/summary\u003e\n\n  - To support the `rustc` [`coverage-options` setting](https://doc.rust-lang.org/rustc/instrument-coverage.html#-z-coverage-optionsoptions) (telling `rustc` _how to gather coverage information_), we need a recent version of the compiler ([this](https://github.com/rust-lang/rust/pull/122226) (seen in `1.78.0`) for simple branch coverage and [this](https://github.com/rust-lang/rust/pull/123409) (seen in `1.79.0`) for [advanced `mcdc` branch coverage](https://en.wikipedia.org/wiki/Modified_condition/decision_coverage))\n  - Our solana programs transitively depend on `ahash`: `solana-program v1.18.1` (latest) -\u003e `borsh v0.9.3` -\u003e `hashbrown v0.11.2` -\u003e `ahash v0.7.7`\n      - `solana-program` also [sets](https://github.com/solana-labs/solana/blob/27eff8408b7223bb3c4ab70523f8a8dca3ca6645/sdk/program/Cargo.toml#L12) its `rust-version` to be `1.75.0` for the whole `platform-tools` suite, `solana-program-library` [does too](https://github.com/solana-labs/solana-program-library/blob/8f832e628bac06bf8fa34497ae0b3e0e8c3d0653/rust-toolchain.toml#L2)\n  - Unfortunately, since `Rust` removed support for the `stdsimd` feature [here](https://github.com/rust-lang/rust/pull/117372) (seen in `1.78.0`), `ahash v0.7.7` [breaks](https://github.com/tkaitchuck/aHash/issues/200)\n  - This is [fixed](https://github.com/tkaitchuck/aHash/pull/183) in `ahash v0.8.0`, but we _cannot_ directly update the version used by `solana-program`.\n      - We can try to use `Cargo patches` to force the version of `ahash` but they do not work for transitive dependencies (only for top-level ones, i.e. the ones in our `Cargo.toml`s)\n  - The last version of the `Rust` compiler from before the removal of `stdsimd` is `nightly-2024-02-04`, but it does not yet include support for `-Z coverage-options` (introduced roughly a month later)\n\n  Possible long-term solutions:\n  - The `solana` ecosystem moves to a newer version of the `Rust` compiler\n    Have no details about such intentions, haven't researched, will probably not be soon\n  - `Cargo patches` start working for transitive dependencies\n    Unlikely, since it would be a nontrivial task to select the exact dependencies you want to patch\n\n  **TLDR**: we either chose to support `branch` coverage or the ability to compile solana programs (IMO the second is a far more important requirement)\n\u003c/details\u003e\n\n## Contact\n\nFor feedback, feature requests or general inquiries, please reach out to zest@limechain.tech\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLimeChain%2Fzest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLimeChain%2Fzest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLimeChain%2Fzest/lists"}