-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: common contract errors (#2471)
Fixes #2468
- Loading branch information
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,53 @@ | ||
# Errors | ||
|
||
List common errors. | ||
# Common Errors | ||
|
||
There are two kinds of errors: errors in an Aztec.nr contract, and errors spat out by an Aztec Sandbox node! | ||
This section will provide an overview of the errors you might encounter, and how to fix them. | ||
|
||
### Assertion Error | ||
|
||
This error is thrown when a condition is not met. | ||
|
||
This is what the error typically looks like: | ||
``` | ||
Simulation error: Assertion failed: Balance too low 'sum == amount' | ||
``` | ||
|
||
To address the error. find the line in the contract that is throwing the error and investigate why the condition is not met. | ||
|
||
### Unknown Contract Error | ||
This error occurs when you are trying to interact with a smart contract via an Aztec RPC Server that does not have the necessary information to execute a transaction. | ||
|
||
This is what the error typically looks like: | ||
``` | ||
Unknown contract 0x1d206be10b873b78b875259e1a8c39e2212e2f181d2fd0b0407446487deba522: add it to Aztec RPC server by calling server.addContracts(...) | ||
``` | ||
|
||
To execute a transaction, the Aztec RPC Server needs to know the complete address of a contract, portal address (if portal is used) and contract artifacts. | ||
|
||
To address the error, add the contract to the Aztec RPC Server by calling `server.addContracts(...)`. | ||
|
||
### Unknown Complete Address Error | ||
This error occurs when your contract is trying to get a public key via the `get_public_key` oracle call, but the Aztec RPC Server does not have the Complete Address (Complete Address contains the public key). | ||
|
||
This is what the error typically looks like: | ||
``` | ||
Simulation error: Unknown complete address for address 0x0d179a5f9bd4505f7dfb8ca37d64e0bd0cd31b5cb018e252fd647bdf88959b95. Add the information to Aztec RPC server by calling server.registerRecipient(...) or server.registerAccount(...) | ||
``` | ||
|
||
Your contract typically needs a public key when it wants to send a note to a recipient because the public key is used to encrypt notes. | ||
|
||
:::info | ||
Manually adding the recipient to the Aztec RPC Server should not be required in case the recipient contract has already been deployed and the Aztec RPC Server is fully synced. | ||
This is because this information is submitted on-chain when the recipient contract is deployed. | ||
::: | ||
|
||
### Unknown account | ||
This error occurs when your contract is trying to get a secret via the `get_secret` oracle call, but the Aztec RPC Server does not have the secret for the public key. | ||
|
||
Maybe even auto-generate error docs, based on error codes in our codebase. | ||
This is what the error typically looks like: | ||
``` | ||
Could not process note because of "Error: Unknown account.". Skipping note... | ||
``` | ||
|
||
Make sure descriptions of errors relate to the end user experience. An error like 'SegFault' is useless to a contract developer! | ||
This error might occurr when you register an account only as a recipient and not as an account. | ||
To address the error, register the account by calling `server.registerAccount(...)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters