diff --git a/docs/partials/_troubleshooting-arbitrum-chain-partial.mdx b/docs/partials/_troubleshooting-arbitrum-chain-partial.mdx index eacd1a6ee4..b67ef7407b 100644 --- a/docs/partials/_troubleshooting-arbitrum-chain-partial.mdx +++ b/docs/partials/_troubleshooting-arbitrum-chain-partial.mdx @@ -3,12 +3,12 @@ partial_type: troubleshooting title: 'Arbitrum Chain Troubleshooting Guide' description: 'Common issues and solutions for Arbitrum chain operations' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### Can I use Orbit to deploy a mainnet chain? -Yes! Arbitrum Orbit's core technology has undergone a comprehensive audit and is now capable of supporting deployments to mainnet. You can read more about it [here](https://docs.arbitrum.io/launch-orbit-chain/concepts/public-preview-expectations#arbitrum-orbit-is-mainnet-ready-but-deploy-to-testnet-first). +Yes! Arbitrum Orbit's core technology has undergone a comprehensive audit and is now capable of supporting deployments to mainnet. You can read more about it [in our public preview annoucement](https://docs.arbitrum.io/launch-orbit-chain/concepts/public-preview-expectations#arbitrum-orbit-is-mainnet-ready-but-deploy-to-testnet-first). ### Do I need permission/license to launch an Orbit chain? @@ -41,7 +41,7 @@ By default, Arbitrum Orbit chains pay gas in `ETH`. However, Arbitrum Orbit chai ### Can I use Ethereum toolkits to develop on my Orbit chain? -Arbitrum Orbit chains are fully EVM-compatible. Most tools that support Ethereum should be able to support an Arbitrum Orbit chain. There are, however, specific differences that developers need to consider when building on an Orbit chain. You can find them [here](https://docs.arbitrum.io/for-devs/concepts/differences-between-arbitrum-ethereum/overview). +Arbitrum Orbit chains are fully EVM-compatible. Most tools that support Ethereum should be able to support an Arbitrum Orbit chain. There are, however, specific differences that developers need to consider when building on an Orbit chain. You can find them [in our Arbitrum vs. Ethereum overview](https://docs.arbitrum.io/for-devs/concepts/differences-between-arbitrum-ethereum/overview). ### Do Orbit chains have any built-in AA solution? diff --git a/docs/partials/_troubleshooting-bridging-partial.mdx b/docs/partials/_troubleshooting-bridging-partial.mdx index 4ec9bc8627..43cc06fbfc 100644 --- a/docs/partials/_troubleshooting-bridging-partial.mdx +++ b/docs/partials/_troubleshooting-bridging-partial.mdx @@ -3,7 +3,7 @@ partial_type: troubleshooting title: 'Bridging Troubleshooting Guide' description: 'Common issues and solutions for bridging assets to/from Arbitrum' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### How do I move assets between One and Nova? diff --git a/docs/partials/_troubleshooting-building-partial.mdx b/docs/partials/_troubleshooting-building-partial.mdx index 0f09764861..f1496f7d10 100644 --- a/docs/partials/_troubleshooting-building-partial.mdx +++ b/docs/partials/_troubleshooting-building-partial.mdx @@ -3,7 +3,7 @@ partial_type: troubleshooting title: 'Building Troubleshooting Guide' description: 'Common issues and solutions for building on Arbitrum' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### How does gas work on Arbitrum? diff --git a/docs/partials/_troubleshooting-nodes-partial.mdx b/docs/partials/_troubleshooting-nodes-partial.mdx index 75178e9c12..767479be47 100644 --- a/docs/partials/_troubleshooting-nodes-partial.mdx +++ b/docs/partials/_troubleshooting-nodes-partial.mdx @@ -3,7 +3,7 @@ partial_type: troubleshooting title: 'Node Running Troubleshooting Guide' description: 'Common issues and solutions for running Arbitrum nodes' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### How do I run a node? @@ -36,7 +36,7 @@ Running an Arbitrum relay locally as a [Feed Relay](https://docs.arbitrum.io/nod ### How do I run a node locally for development? -See instructions on [how to set up a local dev node](https://developer.arbitrum.io/node-running/how-tos/local-dev-node). +See instructions on [how to set up a local dev node](https://developer.arbitrum.io/node-running/how-tos/local-dev-node). We recommend running Nitro nodes via Docker; to compile directly / run without Docker, you can follow the steps in [How to build Nitro locally](https://docs.arbitrum.io/node-running/how-tos/build-nitro-locally). @@ -44,7 +44,7 @@ We recommend running Nitro nodes via Docker; to compile directly / run without D The pre-Nitro stack is also called the "classic" stack. Full Nitro nodes start with a database that contains the information from the "classic" era. -However, a Nitro node can't query archive information contained in "classic" blocks right away. To do that, you also need to run a classic node. You can find detailed instructions ([in this detailed How To](https://developer.arbitrum.io/node-running/how-tos/running-a-classic-node)) and set the parameter `—node.rpc.classic-redirect=your-classic-node-RPC`. +However, a Nitro node can't query archive information contained in "classic" blocks right away. To do that, you also need to run a classic node. You can find detailed instructions [in this detailed How To](https://developer.arbitrum.io/node-running/how-tos/running-a-classic-node) and set the parameter `—node.rpc.classic-redirect=your-classic-node-RPC`. Please note that this information only applies to Arbitrum One nodes. Arbitrum Nova and Sepolia nodes started with a Nitro stack, so they don't have "classic" data. @@ -58,7 +58,7 @@ You can make an `eth_syncing` RPC call to your node. Once a Nitro node is fully When a Nitro node is still syncing, `eth_syncing` returns a map of values to help understand why the node is not syncing. Nitro execution and bottlenecks differ from those of a normal Geth node, so the `eth_syncing` output is unique to Nitro. -You can find information to understand the output of `eth_syncing` in the [list of RPC methods](https://docs.arbitrum.io/for-devs/concepts/differences-between-arbitrum-ethereum/rpc-methods#eth_syncing) page. +You can find information to understand the output of `eth_syncing` in the [RPC methods](https://docs.arbitrum.io/for-devs/concepts/differences-between-arbitrum-ethereum/rpc-methods#eth_syncing) page. ### Is there an alternative to Docker when running a node? diff --git a/docs/partials/_troubleshooting-stylus-partial.mdx b/docs/partials/_troubleshooting-stylus-partial.mdx index f2ccfcca4e..28cdc3f141 100644 --- a/docs/partials/_troubleshooting-stylus-partial.mdx +++ b/docs/partials/_troubleshooting-stylus-partial.mdx @@ -3,7 +3,7 @@ partial_type: troubleshooting title: 'Stylus Troubleshooting Guide' description: 'Common issues and solutions for Stylus smart contract development' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### How does Stylus manage security issues in smart contracts when interacting with so many different languages? @@ -12,7 +12,13 @@ All languages are compiled to WASM for them to be able to work with Stylus. So i ### Is there any analogue of the fallback function from Solidity in the Rust Stylus SDK? -Currently, there isn't any analogue. However, you can use a minimal entrypoint and perform raw delegate calls, forwarding your calldata. You can find more information in [the Bytes-in, Bytes-out programming](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#bytes-in-bytes-out-programming) and [call, static_call, and delegate_call](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#call-static_call-and-delegate_call) sections. +Yes, starting with SDK version 0.7.0, the Router trait supports both `fallback` and `receive` methods, similar to their Solidity counterparts. The `fallback` method is called when a transaction has calldata +that doesn't match any defined function, while the `receive` method is called when a transaction has empty calldata. You can find more information in [Fallback and receive +functions](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#fallback-and-receive-functions). + +For older SDK versions (pre-0.7.0), you can use a minimal entrypoint and perform raw delegate calls, forwarding your calldata. You can find more information in [Bytes-in, bytes-out +programming](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#bytes-in-bytes-out-programming) and [call, static_call and +delegate_call](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#call-static_call-and-delegate_call). ### Is it possible to verify Stylus contracts on the block explorer? diff --git a/docs/partials/_troubleshooting-users-partial.mdx b/docs/partials/_troubleshooting-users-partial.mdx index 35e669762d..6b23b50681 100644 --- a/docs/partials/_troubleshooting-users-partial.mdx +++ b/docs/partials/_troubleshooting-users-partial.mdx @@ -3,7 +3,7 @@ partial_type: troubleshooting title: 'User Troubleshooting Guide' description: 'Common issues and solutions for Arbitrum users' author: anegg0 -last_reviewed: 2025-01-15 +last_reviewed: 2025-11-06 --- ### Why do I need ETH to use the Arbitrum network? diff --git a/docs/stylus/reference/rust-sdk-guide.md b/docs/stylus/reference/rust-sdk-guide.md index 773ab39bcf..18b05e009c 100644 --- a/docs/stylus/reference/rust-sdk-guide.md +++ b/docs/stylus/reference/rust-sdk-guide.md @@ -331,6 +331,37 @@ sol_storage! { } ``` +### Fallback and receive functions + +Starting with SDK version 0.7.0, the [`Router`](https://docs.rs/stylus-sdk/latest/stylus_sdk/abi/trait.Router.html) trait supports the `fallback` and `receive` methods, which work similar to their Solidity counterparts: + +- [`fallback`](https://docs.rs/stylus-sdk/latest/stylus_sdk/abi/trait.Router.html#tymethod.fallback): This method is called when a transaction is sent to the contract with calldata that doesn't match any function signature. It serves as a catch-all function for contract interactions that don't match any defined interface. + +- [`receive`](https://docs.rs/stylus-sdk/latest/stylus_sdk/abi/trait.Router.html#tymethod.receive): This method is called when a transaction is sent to the contract with no calldata (empty calldata). It allows the contract to receive ETH. + +Here's an example implementation: + +```rust +#[public] +impl Contract { + // Automatically called when transaction has calldata that doesn't match any function + #[fallback] + pub fn fallback(&mut self, calldata: Vec) -> Result, Vec> { + // Handle arbitrary calldata + Ok(Vec::new()) // Return empty response or custom response data + } + + // Automatically called when transaction has empty calldata + #[receive] + pub fn receive(&mut self) -> Result<(), Vec> { + // Handle ETH receiving logic + Ok(()) + } +} +``` + +Both methods can be annotated with `#[payable]` to accept ETH along with the transaction. Without this annotation, transactions that send ETH will be rejected. + ## Calls Just as with storage and functions, Stylus SDK calls are Solidity ABI equivalent. This means you never have to know the implementation details of other contracts to invoke them. You simply import the Solidity interface of the target contract, which can be auto-generated via the `cargo stylus` [CLI tool](https://github.com/OffchainLabs/cargo-stylus#exporting-solidity-abis). diff --git a/static/building-stylus-faqs.json b/static/building-stylus-faqs.json index d8017e2206..e348130405 100644 --- a/static/building-stylus-faqs.json +++ b/static/building-stylus-faqs.json @@ -6,7 +6,7 @@ }, { "question": "Is there any analogue of the fallback function from Solidity in the Rust Stylus SDK?", - "answer": "Currently, there isn't any analogue. However, you can use a minimal entrypoint and perform raw delegate calls, forwarding your calldata. You can find more information in [the Bytes-in, Bytes-out programming](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#bytes-in-bytes-out-programming) and [call, static_call, and delegate_call](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#call-static_call-and-delegate_call) sections.\n\n\n\n", + "answer": "Yes, starting with SDK version 0.7.0, the Router trait supports both `fallback` and `receive` methods, similar to their Solidity counterparts. The `fallback` method is called when a transaction has calldata\nthat doesn't match any defined function, while the `receive` method is called when a transaction has empty calldata. You can find more information in [Fallback and receive\nfunctions](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#fallback-and-receive-functions).\n\nFor older SDK versions (pre-0.7.0), you can use a minimal entrypoint and perform raw delegate calls, forwarding your calldata. You can find more information in [Bytes-in, bytes-out\nprogramming](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#bytes-in-bytes-out-programming) and [call, static_call and\ndelegate_call](https://docs.arbitrum.io/stylus/reference/rust-sdk-guide#call-static_call-and-delegate_call).\n\n\n\n\n\n\n\n", "key": "is-there-any-analogue-of-the-fallback-function-from-solidity-in-the-rust-stylus-sdk" }, {