Skip to content

docs: clarify that gasLimits includes teardownGasLimits - #25220

Closed
vezenovm wants to merge 2 commits into
merge-train/fairiesfrom
mv/f378-gas-limits-docs
Closed

docs: clarify that gasLimits includes teardownGasLimits#25220
vezenovm wants to merge 2 commits into
merge-train/fairiesfrom
mv/f378-gas-limits-docs

Conversation

@vezenovm

Copy link
Copy Markdown
Contributor

Resolves F-378.

teardownGasLimits is a reservation carved out of gasLimits, not an addition on top: the total a tx may consume is gasLimits, the fee limit is gasLimits × maxFeesPerGas, and a tx with a teardown call is billed the full teardownGasLimits regardless of actual teardown consumption (see gas_meter.nr and the tail output validators). Three places documented the opposite model or stayed silent:

  • how_to_pay_fees.md described gasLimits as "main execution phase" only.
  • The Gas_Settings_Components snippet (rendered on the fees page) never said teardown is inside the total.
  • getGasLimits JSDoc said the returned gasLimits excludes teardown gas, while the value is computed from totalGas which includes it.

This fixes all three, adds per-field docs to the GasSettings constructor (rendered on the fees page via the gas_settings_vars snippet), and documents the full-reservation billing behavior. Docs only, no behavior change. The unrelated hunks in general_snippets.js are prettier reformatting.

@vezenovm
vezenovm marked this pull request as ready for review August 13, 2026 19:49
): {
/**
* Gas limit for the tx, excluding teardown gas
* Total gas limit for the tx, including teardown gas

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs-developers/docs/aztec-js/aztec_js_reference.md:1909 still has the old "excluding teardown gas" sentence, so the generated reference now contradicts this comment on next. It's auto-generated, so it'd need a run of docs/scripts/aztecjs_reference_generation/update_docs.sh rather than a hand edit. Worth regenerating here? That block also still documents the old two-arg getGasLimits(simulationResult, pad), so it looks stale beyond just this line.

@vezenovm
vezenovm force-pushed the mv/f378-gas-limits-docs branch from 2285385 to abde750 Compare August 17, 2026 11:47
vezenovm added a commit that referenced this pull request Aug 18, 2026
The committed `aztec_js_reference.md` was last generated on 2025-12-10.
Against today's aztec.js source it documents 125 symbols where the
package exports 188: 19 documented symbols no longer exist
(`AccountInterface`, `AccountWithSecretKey`, `DeploySentTx`,
`broadcastPrivateFunction`, `getGasLimits`, ...) and 82 current exports
are missing.

The v5.1.0 snapshot that production serves carries the same December
content, so this is what the live API reference shows today. The release
refreshed the CLI references, the aztec-nr API and the TypeDoc
TypeScript API in the same commit, but
`aztecjs_reference_generation/update_docs.sh` is not part of the release
checklist.

This also resolves the contradiction @nchamo spotted in #25220, where
the stale block still described the old two-argument form and said gas
limits exclude teardown gas.

### Why the generator changed too

A straight regeneration does not build, so two generator bugs are fixed
first:

- Multi-line types were emitted inside inline code spans. A type body
containing a blank line closes the span early, and its braces and angle
brackets then reach the MDX parser, failing the build with `Unexpected
end of file in expression`. Multi-line types now use a fenced code
block, matching what `format_return_type` already did. Verified this
reproduces on `merge-train/fairies` itself with none of these commits
applied.
- The table of contents built anchors with its own slug logic that
stripped underscores Docusaurus keeps, leaving `CAPABILITY_VERSION` and
the `Contract / Protocol_Contracts` section unreachable and pointing
`NO_WAIT`/`NO_FROM` at the `NoWait`/`NoFrom` headings. Anchors now
derive from the rendered heading text the way github-slugger does.

The aztec.js JSDoc edits are comment-only, and are needed because the
regenerated page otherwise fails `yarn spellcheck` on a `metadata` typo
and on `on-chain`, which is a `flagWords` entry in the root
`cspell.json`.
@AztecBot

Copy link
Copy Markdown
Collaborator

This issue was automatically closed because it was referenced in PR #25248 which has been merged to the default branch.

View workflow run

@AztecBot AztecBot closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants