> For the complete documentation index, see [llms.txt](https://tollcraft.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tollcraft.gitbook.io/docs/readme.md).

# Introduction

> **The static analysis shield for Soroban smart contracts** — catch structurally expensive patterns before they are compiled and deployed to the network.

Part of the **Tollcraft** initiative.

## The Cost of Soroban Operations

Soroban charges for every resource your contract consumes:

| Resource               | Cost profile                                              |
| ---------------------- | --------------------------------------------------------- |
| **CPU instructions**   | Charged per instruction executed                          |
| **Memory allocations** | Charged per allocation                                    |
| **Storage operations** | Reads and writes — often the **most expensive** component |

Storage operations (reads and writes) are often the most expensive component of any smart contract transaction. For instance, executing repeated storage operations inside a loop rather than aggregating state changes in memory before writing can significantly increase the total budget utilized.

{% hint style="warning" %}
**Every wasted instruction is a fee your users pay.** Cost bugs don't fail tests — they silently inflate transaction fees in production.
{% endhint %}

## How It Works

Our linter hooks directly into the Rust compiler's High-Level Intermediate Representation (HIR) via [Dylint](https://github.com/trailofbits/dylint) to detect input-independent, structurally expensive patterns — alerting you before they are compiled and deployed to the network.

## Jump In

{% hint style="info" %}
New here? Start with the [**Integration Guide**](/docs/guides/integration.md) to wire the linter into your workspace and CI in minutes. Before proposing a new lint, read [**Scope: Clippy vs. soroban-cost-linter**](/docs/guides/scope_boundary.md).
{% endhint %}

* 🔍 [**Lint Reference**](/docs/lints/lints.md) — every lint, what it catches, and how to fix it
  * [`soroban_storage_in_loop`](/docs/lints/lints/soroban_storage_in_loop.md)
  * [`redundant_env_clone`](/docs/lints/lints/redundant_env_clone.md)
  * [`unnecessary_host_function_call`](/docs/lints/lints/unnecessary_host_function_call.md)
* 🔌 [**Integration Guide**](/docs/guides/integration.md) — `budget.toml` configuration and GitHub Actions setup
* 📏 [**Scope: Clippy vs. soroban-cost-linter**](/docs/guides/scope_boundary.md) — which patterns belong here and which belong to Clippy
* 🧭 [**Troubleshooting**](/docs/guides/troubleshooting.md) — the linter runs but nothing is reported, library-not-found, missing components, and other silent failures


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tollcraft.gitbook.io/docs/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
