Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/docs-developers/docs/aztec-js/how_to_pay_fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ After this transaction is minted on L1 and a few blocks pass, you can claim the

Gas settings specify limits and fees for both DA and L2 dimensions:

- **gasLimits**: Maximum mana for main execution phase
- **teardownGasLimits**: Maximum mana for teardown phase (used by FPCs for refunds)
- **gasLimits**: Maximum mana the transaction may consume in total, across all phases including teardown
- **teardownGasLimits**: Portion of `gasLimits` reserved for the teardown phase (used by FPCs for refunds)
- **maxFeesPerGas**: Maximum price you're willing to pay per mana unit
- **maxPriorityFeesPerGas**: Priority fee for faster inclusion

Teardown gas is not added on top of `gasLimits`: it is a reservation carved out of the total, so the mana available to the rest of the transaction is `gasLimits - teardownGasLimits`. A transaction with a teardown call is billed the full `teardownGasLimits`, regardless of how much teardown actually consumes.

The fee limit is calculated as `gasLimits × maxFeesPerGas` for each dimension.

### Set custom gas limits
Expand Down
23 changes: 15 additions & 8 deletions docs/src/components/Snippets/general_snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export const General = {
InstallationInstructions: () => (
<p>
To use Aztec's suite of tools, run:{" "}
<code>VERSION=&lt;version&gt; bash -i &lt;(curl -sL https://install.aztec.network/&lt;version&gt;)</code>
<code>
VERSION=&lt;version&gt; bash -i &lt;(curl -sL
https://install.aztec.network/&lt;version&gt;)
</code>
</p>
),

Expand Down Expand Up @@ -44,8 +47,8 @@ export const General = {

AztecLocalNetwork: () => (
<p>
<b>Aztec's Local network</b> - runs a set of Aztec tools for convenient local
development, it includes: an Ethereum node, an Aztec node, and PXE.
<b>Aztec's Local network</b> - runs a set of Aztec tools for convenient
local development, it includes: an Ethereum node, an Aztec node, and PXE.
</p>
),

Expand All @@ -69,8 +72,8 @@ export const General = {

AztecJSPrerequisites: ({ href = "how_to_connect_to_local_network" }) => (
<>
<a href={href}>Connected to a network</a>{" "}
with an <code>EmbeddedWallet</code> instance and funded accounts
<a href={href}>Connected to a network</a> with an{" "}
<code>EmbeddedWallet</code> instance and funded accounts
</>
),
};
Expand Down Expand Up @@ -140,10 +143,14 @@ export const Gas_Settings_Components = () => (
The <code>Gas</code> and <code>GasFees</code> types each specify Data
availability and L2 cost components, so the settings are:
<ul>
<li>gasLimits: DA and L2 gas limits</li>
<li>
teardownGasLimits: DA and L2 gas limits for a txs optional teardown
operation
gasLimits: total DA and L2 gas limits for the transaction, covering all
phases including teardown
</li>
<li>
teardownGasLimits: portion of gasLimits reserved for an optional
teardown call. A tx with a teardown call is billed these limits in full,
regardless of actual teardown consumption
</li>
<li>maxFeesPerGas: maximum DA and L2 fees-per-gas</li>
<li>maxPriorityFeesPerGas: maximum priority DA and L2 fees-per-gas</li>
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/stdlib/src/gas/gas_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ export const GAS_ESTIMATION_DA_GAS_LIMIT = GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT
/** Gas usage and fees limits set by the transaction sender for different dimensions and phases. */
export class GasSettings {
constructor(
/** Total gas the tx may consume across all phases, teardown included. */
public readonly gasLimits: Gas,
/** Portion of gasLimits reserved for the teardown phase, billed in full when the tx has a teardown call. */
public readonly teardownGasLimits: Gas,
/** Maximum fees per gas unit the sender is willing to pay. */
public readonly maxFeesPerGas: GasFees,
/** Maximum priority fees per gas unit the sender is willing to pay on top of the base fee. */
public readonly maxPriorityFeesPerGas: GasFees,
) {}
// docs:end:gas_settings_vars
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/wallet-sdk/src/base-wallet/get_gas_limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export function getGasLimits(
pad = 0.1,
): {
/**
* 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.

*/
gasLimits: Gas;
/**
* Gas limit for the teardown phase
* Portion of the total gas limit reserved for the teardown phase
*/
teardownGasLimits: Gas;
} {
Expand Down
Loading