Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename stylus-gas > gas-metering #1900

Merged
merged 2 commits into from
Dec 11, 2024
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
2 changes: 1 addition & 1 deletion arbitrum-docs/stylus/concepts/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Starting from a high-level language (such as Rust, C, or C++), the first compila

Activating a Stylus program requires a new precompile, ArbWasm. This precompile produces efficient binary code tailored to a node's native assembly. During this step, a series of middlewares ensure that user programs execute safely and are deterministically fraud-proven. Instrumentation includes gas metering, depth-checking, memory charging, and more to guarantee all WASM programs are safe for the chain to execute. Stylus contracts can be called only after activation.

Gas metering is essential for certifying that computational resources are paid for. In Stylus, the unit for measuring cost is called **ink**, which is similar to Ethereum's gas but thousands of times smaller. There are two reasons why a new measurement is used: First, WASM execution is so much faster than the EVM that executing thousands of WASM opcodes could be done in the same amount of time it takes the EVM to execute one. Second, the conversion rate of ink to gas can change based on future hardware or VM improvements. For a conceptual introduction to Stylus gas and ink, see [gas and ink (Stylus)](https://docs.arbitrum.io/stylus/concepts/stylus-gas).
Gas metering is essential for certifying that computational resources are paid for. In Stylus, the unit for measuring cost is called **ink**, which is similar to Ethereum's gas but thousands of times smaller. There are two reasons why a new measurement is used: First, WASM execution is so much faster than the EVM that executing thousands of WASM opcodes could be done in the same amount of time it takes the EVM to execute one. Second, the conversion rate of ink to gas can change based on future hardware or VM improvements. For a conceptual introduction to Stylus gas and ink, see [gas and ink (Stylus)](https://docs.arbitrum.io/stylus/concepts/gas-metering).

## Execution

Expand Down
2 changes: 1 addition & 1 deletion arbitrum-docs/stylus/how-tos/debugging-tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Run the following command to obtain a trace output:
cargo stylus trace --tx=$TX_HASH --endpoint=$RPC_URL --use-native-tracer
```

This will produce a trace of the functions called and [ink](https://docs.arbitrum.io/stylus/concepts/stylus-gas#ink-and-gas) left along each method:
This will produce a trace of the functions called and [ink](https://docs.arbitrum.io/stylus/concepts/gas-metering#ink-and-gas) left along each method:

```sh
[{"args":[0,0,0,4],"endInk":846200000,"name":"user_entrypoint","outs":[],"startInk":846200000},{"args":[],"endInk":846167558,"name":"msg_reentrant","outs":[0,0,0,0],"startInk":846175958},{"args":[],"endInk":846047922,"name":"read_args","outs":[208,157,224,138],"startInk":846061362},{"args":[],"endInk":845914924,"name":"msg_value","outs":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"startInk":845928364},{"args":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"endInk":227196069,"name":"storage_load_bytes32","outs":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"startInk":844944549},{"args":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],"endInk":226716083,"name":"storage_cache_bytes32","outs":[],"startInk":226734563},{"args":[0],"endInk":226418732,"name":"storage_flush_cache","outs":[],"startInk":226486805},{"args":[],"endInk":226362319,"name":"write_result","outs":[],"startInk":226403481},{"args":[],"endInk":846200000,"name":"user_returned","outs":[0,0,0,0],"startInk":846200000}]
Expand Down
2 changes: 1 addition & 1 deletion arbitrum-docs/stylus/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Let's learn how to write contracts with Stylus!
<Card
title="Gas, ink and caching"
description="Learn about gas, ink, and caching strategies."
href="https://docs.arbitrum.io/stylus/concepts/stylus-gas"
href="https://docs.arbitrum.io/stylus/concepts/gas-metering"
/>
<Card
title="CLI tools (cargo-stylus)"
Expand Down
4 changes: 2 additions & 2 deletions arbitrum-docs/stylus/reference/opcode-hostio-pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target_audience: 'Developers deploying smart contracts using Stylus.'
sidebar_position: 3
---

This reference provides the latest gas and ink costs for specific WASM opcodes and host I/Os when using Stylus. For a conceptual introduction to Stylus gas and ink, see [Gas and ink (Stylus)](/stylus/concepts/stylus-gas).
This reference provides the latest gas and ink costs for specific WASM opcodes and host I/Os when using Stylus. For a conceptual introduction to Stylus gas and ink, see [Gas and ink (Stylus)](/stylus/concepts/gas-metering).

## Opcode costs

Expand Down Expand Up @@ -161,4 +161,4 @@ Note that the values in this table were determined via a conservative statistica

### See also

- [Gas and ink (Stylus)](/stylus/concepts/stylus-gas): A conceptual introduction to the "gas" and "ink" primitives
- [Gas and ink (Stylus)](/stylus/concepts/gas-metering): A conceptual introduction to the "gas" and "ink" primitives
2 changes: 1 addition & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ const sidebars = {
},
{
type: 'doc',
id: 'stylus/concepts/stylus-gas',
id: 'stylus/concepts/gas-metering',
label: 'Gas metering',
},
],
Expand Down
Loading