You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/stylus/advanced/hostio-exports.mdx
+40-20Lines changed: 40 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,11 @@ Hostio functions are the foundational layer that powers all Stylus smart contrac
19
19
- Understanding gas costs and execution flow
20
20
- Debugging and troubleshooting contract behavior
21
21
22
-
:::info
22
+
<VanillaAdmonitiontype="info">
23
+
23
24
Most developers should use the high-level SDK wrappers instead of calling hostio functions directly. The SDK provides safe, ergonomic interfaces that handle memory management and error checking automatically.
24
-
:::
25
+
26
+
</VanillaAdmonition>
25
27
26
28
## How hostio works
27
29
@@ -103,9 +105,11 @@ Gets the code hash of an account. Equivalent to EVM's `EXTCODEHASH` opcode.
Values are cached and must be persisted using `storage_flush_cache` before they're permanently written to storage.
137
-
:::
142
+
143
+
</VanillaAdmonition>
138
144
139
145
#### `storage_flush_cache`
140
146
@@ -200,9 +206,11 @@ Gets a bounded estimate of the L1 block number when the transaction was sequence
200
206
pubfnblock_number() ->u64;
201
207
```
202
208
203
-
:::info
209
+
<VanillaAdmonitiontype="info">
210
+
204
211
See [Arbitrum block numbers and time](/arbitrum-essentials/arbitrum-vs-ethereum/block-numbers-and-time) for more information on how block numbers work on Arbitrum chains.
For L1-to-L2 retryable ticket transactions, addresses are aliased. See [address aliasing documentation](/how-arbitrum-works/deep-dives/l1-to-l2-messaging#address-aliasing).
Delegate calls execute code in the context of the current contract. Be extremely careful when delegate calling to untrusted contracts, as they have full access to your storage.
The `--use-native-tracer` flag uses `stylusTracer` instead of `jsTracer`, which is required for tracing Stylus transactions on most RPC providers. See [RPC endpoint compatibility](#rpc-endpoint-compatibility) for details.
201
-
:::
202
+
203
+
</VanillaAdmonition>
202
204
203
205
The debugger loads and sets a breakpoint at the `user_entrypoint` function:
Copy file name to clipboardExpand all lines: docs/stylus/reference/stylus-toml-reference.mdx
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,9 +94,11 @@ crate-type = ["lib", "cdylib"]
94
94
-`lib` enables standard Rust imports and testing.
95
95
-`cdylib` produces the WebAssembly binary that gets deployed onchain.
96
96
97
-
:::caution
97
+
<VanillaAdmonitiontype="warning">
98
+
98
99
Removing `cdylib` from `crate-type` prevents the contract from compiling to WASM. Removing `lib` prevents running tests and exporting ABI.
99
-
:::
100
+
101
+
</VanillaAdmonition>
100
102
101
103
### `[dependencies]`
102
104
@@ -169,9 +171,11 @@ opt-level = 3
169
171
|`panic`|`abort`| Use immediate abort on panic instead of unwinding (smaller binary). |
170
172
|`opt-level`|`3`| Optimize for speed. Use `"s"` or `"z"` to optimize for binary size instead. See [Optimizing binaries](/stylus/how-tos/optimizing-binaries) for guidance. |
171
173
172
-
:::tip
174
+
<VanillaAdmonitiontype="tip">
175
+
173
176
If your contract exceeds the 24KB compressed size limit, change `opt-level` to `"z"` for maximum size reduction. This typically produces smaller binaries at the cost of some runtime performance.
|`channel`| Rust compiler version. Used by block explorers for deterministic source verification. |
189
193
|`targets`| Must include `wasm32-unknown-unknown` for Stylus contracts. Additional targets can be listed for local testing. |
190
194
191
-
:::caution
195
+
<VanillaAdmonitiontype="warning">
196
+
192
197
Changing the Rust version may affect source code verification on block explorers like Arbiscan. Pin to a specific stable version rather than using `stable` or `nightly`.
0 commit comments