Skip to content

Commit 0ce6f2d

Browse files
authored
Merge branch 'master' into stylus-docs-cli-tools
2 parents 69835d0 + 9c9a4f2 commit 0ce6f2d

3 files changed

Lines changed: 91 additions & 71 deletions

File tree

docs/stylus/advanced/recommended-libraries.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_label: Recommended libraries
88

99
Rust provides a package registry at [crates.io](https://crates.io/), which lets developers conveniently access a plethora of open source libraries to utilize as dependencies in their code. Stylus Rust contracts can take advantage of these crates to simplify their development workflow.
1010

11-
While **crates.io** is a fantastic resource, many of these libraries were not designed with the constraints of a blockchain environment in mind. Some produce large binaries that exceed the 24KB compressed size limit of WASM smart contracts on Arbitrum. Many also take advantage of unsupported features such as:
11+
While **crates.io** is a fantastic resource, many of these libraries were not designed with the constraints of a blockchain environment in mind. Some produce large binaries that exceed the decompressed WASM size limit (`MaxWasmSize`) for Stylus programs on Arbitrum — a chain-configurable ArbOS parameter that defaults to 128 KB, raised to 256 KB at ArbOS 60 and later. Many also take advantage of unsupported features such as:
1212

1313
- Random numbers
1414
- Multi threading
@@ -32,6 +32,8 @@ A Rust library is compatible with Stylus if it meets all of the following:
3232

3333
To save developers time on smart contract development for common dependencies, we've curated a list of crates and utilities that we found helpful. Keep in mind that we have not audited this code, and you should always be mindful about pulling dependencies into your codebase, whether they've been audited or not. We provide this list for you to use at your discretion and risk.
3434

35+
- [`alloy-primitives`](https://crates.io/crates/alloy-primitives): Core Ethereum primitive types (`U256`, `Address`, `B256`, and more). Re-exported by the Stylus SDK, which currently pins the 1.x line (`1.5.7`), and the foundation for nearly every Stylus contract
36+
- [`alloy-sol-types`](https://crates.io/crates/alloy-sol-types): Solidity type and ABI encoding/decoding via the `sol!` macro. Used by the Stylus SDK (same 1.x line) for typed calls, events, and errors
3537
- [`rust_decimal`](https://crates.io/crates/rust_decimal): Decimal number implementation written in pure Rust. Suitable for financial and fixed-precision calculations
3638
- [`special`](https://crates.io/crates/special): The package provides special functions, which are mathematical functions with special names due to their common usage, such as `sin`, `ln`, `tan`, etc.
3739
- [`hashbrown`](https://crates.io/crates/hashbrown): Rust port of Google's SwissTable hash map

docs/stylus/reference/opcode-hostio-pricing.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ sidebar_position: 3
99

1010
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).
1111

12+
<VanillaAdmonition type="info">The per-opcode and per-host-I/O ink costs in the tables below are subject to change as Stylus matures. They are defined in the upstream Stylus/Arbitrator source rather than in the precompiles, so confirm the current values against that source before relying on exact figures. The ink-to-gas relationship is fixed: 10,000 ink = 1 gas.</VanillaAdmonition>
13+
1214
## Opcode costs
1315

1416
The Stylus VM charges for WASM opcodes according to the following table, which was determined via a conservative statistical analysis and is expected to change as Stylus matures. Prices may fluctuate across upgrades as our analysis evolves and optimizations are made.
@@ -99,7 +101,7 @@ The Stylus VM charges for WASM opcodes according to the following table, which w
99101
| 0x77 | I32Rotl | 70 | 0.007 | |
100102
| 0x78 | I32Rotr | 70 | 0.007 | |
101103
| 0x79 | I64Clz | 210 | 0.021 | |
102-
| 0x7a | I64Ctz | 210 | 0.012 | |
104+
| 0x7a | I64Ctz | 210 | 0.021 | |
103105
| 0x7b | I64Popcnt | 6000 | 0.6 | |
104106
| 0x7c | I64Add | 100 | 0.01 | |
105107
| 0x7d | I64Sub | 100 | 0.01 | |
@@ -142,7 +144,7 @@ Note that the values in this table were determined via a conservative statistica
142144
| block_coinbase | 13440 | 1.344 | |
143145
| block_gas_limit | 8400 | 0.84 | |
144146
| block_number | 8400 | 0.84 | |
145-
| block_timestmap | 8400 | 0.84 | |
147+
| block_timestamp | 8400 | 0.84 | |
146148
| chain_id | 8400 | 0.84 | |
147149
| contract_address | 13440 | 1.344 | |
148150
| evm_gas_left | 8400 | 0.84 | |

0 commit comments

Comments
 (0)