From 2f49edb63079da4228136477c55abb6829b8d666 Mon Sep 17 00:00:00 2001 From: James Zaki Date: Tue, 17 Dec 2024 22:21:23 +0000 Subject: [PATCH 1/4] docs: Remove links to protocol specs --- docs/components/snippet.js | 8 + docs/docs/aztec/concepts/accounts/index.md | 2 - docs/docs/aztec/concepts/accounts/keys.md | 10 +- docs/docs/aztec/concepts/circuits/index.md | 12 +- .../circuits/kernels/private_kernel.md | 2 - .../circuits/kernels/public_kernel.md | 2 - .../circuits/rollup_circuits/index.md | 2 - .../communication/cross_chain_calls.md | 4 - .../aztec/concepts/storage/partial_notes.md | 2 +- .../concepts/storage/state_model/public_vm.md | 4 +- .../aztec/concepts/storage/trees/index.md | 4 +- docs/docs/aztec/concepts/transactions.md | 4 +- docs/docs/aztec/concepts/wallets/index.md | 4 +- docs/docs/aztec/concepts_overview.md | 6 +- .../smart_contracts/contract_creation.md | 4 +- .../smart_contracts/functions/context.md | 2 +- .../writing_contracts/initializers.md | 2 - .../portals/communicate_with_portal.md | 2 - .../public-vm/gen/_instruction-set.mdx | 2098 +++++++---------- .../cli_wallet_reference.md | 4 +- .../smart_contract_reference/macros.md | 2 +- .../token_bridge/4_typescript_glue_code.md | 1 - .../contract_tutorials/token_bridge/index.md | 2 +- .../write_accounts_contract.md | 1 - 24 files changed, 864 insertions(+), 1320 deletions(-) create mode 100644 docs/components/snippet.js diff --git a/docs/components/snippet.js b/docs/components/snippet.js new file mode 100644 index 00000000000..7496220cac5 --- /dev/null +++ b/docs/components/snippet.js @@ -0,0 +1,8 @@ +import React from 'react'; + +const Spec_Placeholder = () => ( +

The design and implementation have largely changed since the original specification, and these docs will soon be updated to reflect the latest implementation. +

+); + +export default Spec_Placeholder; \ No newline at end of file diff --git a/docs/docs/aztec/concepts/accounts/index.md b/docs/docs/aztec/concepts/accounts/index.md index 07c6e0aa4d6..4f29f273ecb 100644 --- a/docs/docs/aztec/concepts/accounts/index.md +++ b/docs/docs/aztec/concepts/accounts/index.md @@ -156,5 +156,3 @@ NOTE: While we entertained the idea of abstracting note encryption, where accoun In order to be considered valid, an account must prove that it has locked enough funds to pay for itself. However, this does not mandate where those funds come from. This fee abstraction allows for easy implementation of paymasters or payment-in-kind via on-the-fly swaps. However, there is one major consideration around public execution reverts. In the current design, if one of the public function executions enqueued in a transaction fails, then the entire transaction is reverted. But reverting the whole transaction would also revert the fee payment, and leave the sequencer with their hands empty after running the public execution. This means we will need to enshrine an initial verification and fee payment phase that is _not_ reverted if public execution fails. - -You can read the latest information about fees in the [protocol specs](../../../protocol-specs/gas-and-fees/index.md). diff --git a/docs/docs/aztec/concepts/accounts/keys.md b/docs/docs/aztec/concepts/accounts/keys.md index 87572444485..7df96c9c13f 100644 --- a/docs/docs/aztec/concepts/accounts/keys.md +++ b/docs/docs/aztec/concepts/accounts/keys.md @@ -4,7 +4,6 @@ tags: [accounts, keys] --- The goal of this section is to give app developer a good idea what keys there are used in the system. -For a detailed description head over to the [protocol specification](../../../protocol-specs/addresses-and-keys/index.md). In short, there is a **nullifier key** (to spend your notes), an **incoming viewing key** (to view any notes or logs that were sent to you), an **outgoing viewing key** (to view any logs or notes you sent to another entity), a **tagging key** (to quickly find notes relevant to you) and oftentimes a signing key. A signing key is not strictly required by the protocol, but are often used with specific account contracts for authorization purposes. @@ -13,10 +12,10 @@ Each account in Aztec is backed by 4 key pairs: - A **nullifier key pair** used for note nullifier computation, comprising the master nullifier secret key (`nsk_m`) and master nullifier public key (`Npk_m`). - An **incoming viewing key pair** used to encrypt a note for the recipient, consisting of the master incoming viewing secret key (`ivsk_m`) and master incoming viewing public key (`Ivpk_m`). - An **outgoing viewing key pair** used to encrypt a note for the sender, includes the master outgoing viewing secret key (`ovsk_m`) and master outgoing viewing public key (`Ovpk_m`). -- A **tagging key pair** used to compute tags in a [tagging note discovery scheme](../../../protocol-specs/private-message-delivery/private-msg-delivery.md#note-tagging), comprising the master tagging secret key (`tsk_m`) and master tagging public key (`Tpk_m`). +- A **tagging key pair** used to compute tags in a tagging note discovery scheme, comprising the master tagging secret key (`tsk_m`) and master tagging public key (`Tpk_m`). :::info -All key pairs above are derived from a secret using a ZCash inspired scheme defined in [protocol specification](../../../protocol-specs/addresses-and-keys/keys.md#cheat-sheet). +Key pairs are derived from a secret using a ZCash inspired scheme. ::: :::note @@ -52,7 +51,6 @@ If that happens, only the nullifier secret for that application is compromised ( Above we mentioned that the notes typically contain `Npk_m`. It might seem like a mistake given that the notes are nullified with `nsk_app`. This is intentional and instead of directly trying to derive `Npk_m` from `nsk_app` we instead verify that both of the keys were derived from the same `nsk_m` in our protocol circuits. -If you are curious how the derivation scheme works head over to [protocol specification](../../../protocol-specs/addresses-and-keys/example-usage/nullifier#diagram). ## Protocol key types @@ -71,7 +69,7 @@ An application in Aztec.nr can request a secret from the current user for comput Typically, `Npk_m` is stored in a note and later on, the note is nullified using the secret app-siloed version (denoted `nsk_app`). `nsk_app` is derived by hashing `nsk_m` with the app contract address and it is necessary to present it to compute the nullifier. -Validity of `nsk_app` is verified by our [protocol kernel circuits](../../../protocol-specs/circuits/private-kernel-tail#verifying-and-splitting-ordered-data). +Validity of `nsk_app` is verified by our protocol kernel circuits. ## Incoming viewing keys @@ -86,7 +84,7 @@ If these keys were not used and a new device would be synched there would be no ## Tagging keys -Used to compute tags in a [tagging note discovery scheme](../../../protocol-specs/private-message-delivery/private-msg-delivery#note-tagging). +Used to compute tags in a tagging note discovery scheme. :::note Tagging note discovery scheme won't be present in our testnet so we are intentionally not providing you with much info yet. diff --git a/docs/docs/aztec/concepts/circuits/index.md b/docs/docs/aztec/concepts/circuits/index.md index 9e6272b37e4..606d7ca54a4 100644 --- a/docs/docs/aztec/concepts/circuits/index.md +++ b/docs/docs/aztec/concepts/circuits/index.md @@ -61,14 +61,6 @@ What kind of extra rules / checks does a rollup need, to enforce notions of priv So what kinds of core protocol circuits does Aztec have? -### Kernel Circuits +### Kernel, Rollup, and Squisher Circuits -Read more about the Kernel circuits in the protocol specs [here](../../../protocol-specs/circuits/high-level-topology.md). - -### Rollup Circuits - -- [Rollup Circuits](../../../protocol-specs/rollup-circuits/index.md) - -#### Squisher Circuits - -We haven't fully spec'ed these out, as Honk and Goblin Plonk schemes are still being improved! But we'll need some extra circuit(s) to squish a Honk proof (as produced by the Root Rollup Circuit) into a Standard Plonk or Fflonk proof, for cheap verification on Ethereum. +The specs of these have recently been updated. Eg for squisher circuits since Honk and Goblin Plonk schemes are still being improved! But we'll need some extra circuit(s) to squish a Honk proof (as produced by the Root Rollup Circuit) into a Standard Plonk or Fflonk proof, for cheap verification on Ethereum. diff --git a/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md b/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md index 9bdba98cb8a..10f8880efbf 100644 --- a/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md +++ b/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md @@ -5,8 +5,6 @@ tags: [protocol, circuits] This circuit is executed by the user, on their own device. This is to ensure private inputs to the circuit remain private! -Read the latest information about the Aztec Private Kernel Circuit in the [protocol specs section](../../../../protocol-specs/circuits/private-kernel-tail.md). - :::note **This is the only core protocol circuit which actually needs to be "zk" (zero-knowledge)!!!** That's because this is the only core protocol circuit which handles private data, and hence the only circuit for which proofs must not leak any information about witnesses! (The private data being handled includes: details of the Aztec.nr Contract function which has been executed; the address of the user who executed the function; the intelligible inputs and outputs of that function). diff --git a/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md b/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md index e7f139f8662..c5466010908 100644 --- a/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md +++ b/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md @@ -4,5 +4,3 @@ tags: [protocol, circuits] --- This circuit is executed by a Sequencer, since only a Sequencer knows the current state of the [public data tree](../../storage/trees/index.md) at any time. A Sequencer might choose to delegate proof generation to the Prover pool. - -Read more about the public kernel circuits in the protocol specs [here](../../../../protocol-specs/circuits/public-kernel-initial.md). diff --git a/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md b/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md index 7935d44c591..db7a11e0b9b 100644 --- a/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md +++ b/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md @@ -15,5 +15,3 @@ The way we 'squish' all this data is in a 'binary tree of proofs' topology. > Note: 'binary tree of proofs' is actually an oversimplification. The Rollup Circuits are designed so that a Sequencer can actually deviate from a neat, symmetrical tree, for the purposes of efficiency, and instead sometimes create wonky trees. Some of the Rollup Circuits also do some protocol checks and computations, for efficiency reasons. We might rearrange which circuit does what computation, as we discover opportunities for efficiency. - -Read more about the rollup circuits in the protocol spec [here](../../../../protocol-specs/rollup-circuits/index.md). diff --git a/docs/docs/aztec/concepts/communication/cross_chain_calls.md b/docs/docs/aztec/concepts/communication/cross_chain_calls.md index b606a5e9311..439f267ce55 100644 --- a/docs/docs/aztec/concepts/communication/cross_chain_calls.md +++ b/docs/docs/aztec/concepts/communication/cross_chain_calls.md @@ -150,7 +150,3 @@ To make it possible to hide when a specific message is consumed, the `L1ToL2Msg` The following diagram shows the overall architecture, combining the earlier sections. - -## Learn more - -Check out the [protocol specs](../../../protocol-specs/l1-smart-contracts#portals) for more information about cross-chain communication and contracts on L1. diff --git a/docs/docs/aztec/concepts/storage/partial_notes.md b/docs/docs/aztec/concepts/storage/partial_notes.md index fb597632d0b..d8bffd340ed 100644 --- a/docs/docs/aztec/concepts/storage/partial_notes.md +++ b/docs/docs/aztec/concepts/storage/partial_notes.md @@ -10,7 +10,7 @@ Partial notes are a concept that allows users to commit to an encrypted value, a Why is this useful? -Consider the case where a user wants to pay for a transaction fee, using a [fee-payment contract](../../../protocol-specs/gas-and-fees/index.md) and they want to do this privately. They can't be certain what the transaction fee will be because the state of the network will have progressed by the time the transaction is processed by the sequencer, and transaction fees are dynamic. So the user can commit to a value for the transaction fee, publicly post this commitment, the fee payer (aka paymaster) can update the public commitment, deducting the final cost of the transaction from the commitment and returning the unused value to the user. +Consider the case where a user wants to pay for a transaction fee, using a fee-payment contract and they want to do this privately. They can't be certain what the transaction fee will be because the state of the network will have progressed by the time the transaction is processed by the sequencer, and transaction fees are dynamic. So the user can commit to a value for the transaction fee, publicly post this commitment, the fee payer (aka paymaster) can update the public commitment, deducting the final cost of the transaction from the commitment and returning the unused value to the user. So, in general, the user is: diff --git a/docs/docs/aztec/concepts/storage/state_model/public_vm.md b/docs/docs/aztec/concepts/storage/state_model/public_vm.md index 528ee5f8d46..dd2f5b2d0b1 100644 --- a/docs/docs/aztec/concepts/storage/state_model/public_vm.md +++ b/docs/docs/aztec/concepts/storage/state_model/public_vm.md @@ -2,4 +2,6 @@ title: Public VM --- -Refer to the [protocol specs section](../../../../protocol-specs/public-vm/index.md) for the latest information about the Aztec Public VM. +import Spec_Placeholder from '/components/snippet'; + + diff --git a/docs/docs/aztec/concepts/storage/trees/index.md b/docs/docs/aztec/concepts/storage/trees/index.md index 0a0f0aa8ace..387a27dd87e 100644 --- a/docs/docs/aztec/concepts/storage/trees/index.md +++ b/docs/docs/aztec/concepts/storage/trees/index.md @@ -2,4 +2,6 @@ title: Trees --- -Refer to [this section](../../../../protocol-specs/state/index.md) of the protocol specification for the latest information on the trees used in Aztec. +import Spec_Placeholder from '/components/snippet'; + + diff --git a/docs/docs/aztec/concepts/transactions.md b/docs/docs/aztec/concepts/transactions.md index 6f75a98d412..04280342b20 100644 --- a/docs/docs/aztec/concepts/transactions.md +++ b/docs/docs/aztec/concepts/transactions.md @@ -31,9 +31,9 @@ _The transaction has not been broadcasted to the sequencer network yet. For now, _The transaction has still not been broadcasted to the sequencer network yet and continues to live solely within the context of the PXE._ -3. **The PXE proves correct execution** – At this point, the PXE proves correct execution (via zero-knowledge proofs) of the authorization and of the private transfer method. Once the proofs have been generated, the PXE sends the proofs and required inputs (inputs are new note commitments, stored in the [note hash tree](../../protocol-specs/state/note-hash-tree.md) and nullifiers stored in the [nullifiers tree](../../protocol-specs/state/nullifier-tree.md)) to the sequencer. Nullifiers are data that invalidate old commitments, ensuring that commitments can only be used once. +3. **The PXE proves correct execution** – At this point, the PXE proves correct execution (via zero-knowledge proofs) of the authorization and of the private transfer method. Once the proofs have been generated, the PXE sends the proofs and required inputs (inputs are new note commitments, stored in the note hash tree and nullifiers stored in the nullifiers tree) to the sequencer. Nullifiers are data that invalidate old commitments, ensuring that commitments can only be used once. -_The sequencer has received the transaction proof and can begin to process the transaction - verifying proofs and applying updates to the relevant [data trees](../../protocol-specs/state/index.md) - alongside other public and private transactions._ +_The sequencer has received the transaction proof and can begin to process the transaction - verifying proofs and applying updates to the relevant data trees - alongside other public and private transactions._ 4. **The sequencer has the necessary information to act** – the randomly-selected sequencer (based on the Fernet sequencer selection protocol) validates the transaction proofs along with required inputs (e.g. the note commitments and nullifiers) for this private transfer. The sequencer also executes public functions and requests proofs of public execution from a prover network. The sequencer updates the corresponding data trees and does the same for other private transactions. When the sequencer receives proofs from the prover network, the proofs will be bundled into a final rollup proof. diff --git a/docs/docs/aztec/concepts/wallets/index.md b/docs/docs/aztec/concepts/wallets/index.md index 1c64d7a2843..02b0f04fee9 100644 --- a/docs/docs/aztec/concepts/wallets/index.md +++ b/docs/docs/aztec/concepts/wallets/index.md @@ -28,9 +28,9 @@ Note that users must be able to receive funds in Aztec before deploying their ac Every transaction in Aztec is broadcast to the network as a zero-knowledge proof of correct execution, in order to preserve privacy. This means that transaction proofs are generated on the wallet and not on a remote node. This is one of the biggest differences with regard to EVM chain wallets. -A wallet is responsible for **creating** an _execution request_ out of one or more _function calls_ requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet [turns that into an execution request](../../../protocol-specs/transactions/local-execution.md#execution-request) with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. +A wallet is responsible for **creating** an _execution request_ out of one or more _function calls_ requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet turns that into an execution request with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. -Once the _execution request_ is created, the wallet is responsible for **simulating** and **proving** the execution of its private functions. The simulation yields an execution trace, which can be used to provide the user with a list of side effects of the private execution of the transaction. During this simulation, the wallet is responsible of providing data to the virtual machine, such as private notes, encryption keys, or nullifier secrets. This execution trace is fed into the prover, which returns a zero-knowledge proof that guarantees correct execution and hides all private information. The output of this process is a [_transaction object_](../../../protocol-specs/transactions/tx-object.md). +Once the _execution request_ is created, the wallet is responsible for **simulating** and **proving** the execution of its private functions. The simulation yields an execution trace, which can be used to provide the user with a list of side effects of the private execution of the transaction. During this simulation, the wallet is responsible of providing data to the virtual machine, such as private notes, encryption keys, or nullifier secrets. This execution trace is fed into the prover, which returns a zero-knowledge proof that guarantees correct execution and hides all private information. The output of this process is a _transaction object_. :::info Since private functions rely on a UTXO model, the private execution trace of a transaction is determined exclusively by the notes used as inputs. Since these notes are immutable, the trace of a transaction is always the same, so any effects observed during simulation will be exactly the same when the transaction is mined. However, the transaction may be dropped if it attempts to consume a private note that another transaction nullified before it gets mined. Note that this applies only to private function execution. Public functions rely on an account model, similar to Ethereum, so their execution trace depends on the chain's public state at the point they are included in a block, which may have changed since the transaction was simulated locally. diff --git a/docs/docs/aztec/concepts_overview.md b/docs/docs/aztec/concepts_overview.md index 878cd2c3796..701e2e69b44 100644 --- a/docs/docs/aztec/concepts_overview.md +++ b/docs/docs/aztec/concepts_overview.md @@ -10,7 +10,7 @@ This page outlines Aztec's fundamental technical concepts. It is recommended to ## What is Aztec? -Aztec is a privacy-first Layer 2 on Ethereum. It supports smart contracts with both private & public state and private & public execution. +Aztec is a privacy-first Layer 2 on Ethereum. It supports smart contracts with both private & public state and private & public execution. ## High level view @@ -33,7 +33,7 @@ Private functions are executed first on the user's device in the Private Executi ### Aztec VM -Public functions are executed by the Aztec Virtual Machine (AVM), which is conceptually similar to the Ethereum Virtual Machine (EVM). To learn more about how it works and its instruction set, go to the [protocol specs](../protocol-specs/public-vm/intro.md). +Public functions are executed by the Aztec Virtual Machine (AVM), which is conceptually similar to the Ethereum Virtual Machine (EVM). The PXE is unaware of the Public VM. And the Public VM is unaware of the PXE. They are completely separate execution environments. This means: @@ -54,7 +54,7 @@ Aztec [smart contract](./smart_contracts_overview.md) developers should keep in ### Account abstraction -Every account in Aztec is a smart contract (account abstraction). This allows implementing different schemes for authorizing transactions, nonce management, and fee payments. +Every account in Aztec is a smart contract (account abstraction). This allows implementing different schemes for authorizing transactions, nonce management, and fee payments. Developers can write their own account contract to define the rules by which user transactions are authorized and paid for, as well as how user keys are managed. diff --git a/docs/docs/aztec/smart_contracts/contract_creation.md b/docs/docs/aztec/smart_contracts/contract_creation.md index 02858dca070..6872b582fb8 100644 --- a/docs/docs/aztec/smart_contracts/contract_creation.md +++ b/docs/docs/aztec/smart_contracts/contract_creation.md @@ -3,7 +3,9 @@ title: Contract Deployment tags: [contracts, protocol] --- -The latest information about contract deployment has moved to the protocol specification. You can find it [here](../../protocol-specs/contract-deployment/index.md). +import Spec_Placeholder from '/components/snippet'; + + ## Further reading diff --git a/docs/docs/aztec/smart_contracts/functions/context.md b/docs/docs/aztec/smart_contracts/functions/context.md index f8b0eae3c16..346e822a25a 100644 --- a/docs/docs/aztec/smart_contracts/functions/context.md +++ b/docs/docs/aztec/smart_contracts/functions/context.md @@ -127,7 +127,7 @@ The public call stack contains all of the external function calls that are creat ### New L2 to L1 msgs -New L2 to L1 messages contains messages that are delivered to the [l1 outbox](../../../protocol-specs/l1-smart-contracts/index.md) on the execution of each rollup. +New L2 to L1 messages contains messages that are delivered to the l1 outbox on the execution of each rollup. ## Public Context diff --git a/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md index 19b525524f7..2f28727e3c0 100644 --- a/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md @@ -45,6 +45,4 @@ You can set multiple functions as an initializer function simply by annotating e Calling any one of the functions annotated with `#[initializer]` will mark the contract as initialized. -See [this page of the protocol specs](../../../../protocol-specs/contract-deployment/instances.md#initialization) for more info about what marking a function as initialized means. - To see an initializer in action, follow the [Counter codealong tutorial](../../../../tutorials/codealong/contract_tutorials/counter_contract.md). diff --git a/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md index 439bf5f9377..93e00031913 100644 --- a/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md @@ -3,8 +3,6 @@ title: Communicating with L1 tags: [contracts, portals] --- -Is this your first time hearing the word `Portal`? You might want to check out the [protocol specs](../../../../../protocol-specs/l1-smart-contracts/index.md). - Follow the [token bridge tutorial](../../../../../tutorials/codealong/contract_tutorials/token_bridge/index.md) for hands-on experience writing and deploying a Portal contract. ## Passing data to the rollup diff --git a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx index d5409d96aef..b7de3caf134 100644 --- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx @@ -1,636 +1,367 @@ -[comment]: # "THIS IS A GENERATED FILE! DO NOT EDIT!" -[comment]: # "Generated via `yarn preprocess`" -[comment]: # "Generated by genMarkdown.js, InstructionSet.js, InstructionSize.js" +[comment]: # (THIS IS A GENERATED FILE! DO NOT EDIT!) +[comment]: # (Generated via `yarn preprocess`) + +[comment]: # (Generated by genMarkdown.js, InstructionSet.js, InstructionSize.js) + +import Markdown from 'react-markdown' +import CodeBlock from '@theme/CodeBlock' -import Markdown from "react-markdown"; -import CodeBlock from "@theme/CodeBlock"; ## Instructions Table Click on an instruction name to jump to its section. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + +
OpcodeNameSummaryExpression
0x00 - - \[\`ADD\`\](#isa-section-add) - - Addition (a + b) - - {`M[dstOffset] = M[aOffset] + M[bOffset] mod 2^k`} -
0x01 - - \[\`SUB\`\](#isa-section-sub) - - Subtraction (a - b) - - {`M[dstOffset] = M[aOffset] - M[bOffset] mod 2^k`} -
0x02 - - \[\`MUL\`\](#isa-section-mul) - - Multiplication (a * b) - - {`M[dstOffset] = M[aOffset] * M[bOffset] mod 2^k`} -
0x03 - - \[\`DIV\`\](#isa-section-div) - - Unsigned integer division (a / b) - - {`M[dstOffset] = M[aOffset] / M[bOffset]`} -
0x04 - - \[\`FDIV\`\](#isa-section-fdiv) - - Field division (a / b) - - {`M[dstOffset] = M[aOffset] / M[bOffset]`} -
0x05 - - \[\`EQ\`\](#isa-section-eq) - - Equality check (a == b) - - {`M[dstOffset] = M[aOffset] == M[bOffset] ? 1 : 0`} -
0x06 - - \[\`LT\`\](#isa-section-lt) - - Less-than check (a < b) - - {`M[dstOffset] = M[aOffset] < M[bOffset] ? 1 : 0`} -
0x07 - - \[\`LTE\`\](#isa-section-lte) - - Less-than-or-equals check (a <= b) - - {`M[dstOffset] = M[aOffset] <= M[bOffset] ? 1 : 0`} -
0x08 - - \[\`AND\`\](#isa-section-and) - - Bitwise AND (a & b) - - {`M[dstOffset] = M[aOffset] AND M[bOffset]`} -
0x09 - - \[\`OR\`\](#isa-section-or) - - Bitwise OR (a | b) - - {`M[dstOffset] = M[aOffset] OR M[bOffset]`} -
0x0a - - \[\`XOR\`\](#isa-section-xor) - - Bitwise XOR (a ^ b) - - {`M[dstOffset] = M[aOffset] XOR M[bOffset]`} -
0x0b - - \[\`NOT\`\](#isa-section-not) - - Bitwise NOT (inversion) - - {`M[dstOffset] = NOT M[aOffset]`} -
0x0c - - \[\`SHL\`\](#isa-section-shl) - - Bitwise leftward shift (a << b) - - {`M[dstOffset] = M[aOffset] << M[bOffset]`} -
0x0d - - \[\`SHR\`\](#isa-section-shr) - - Bitwise rightward shift (a >> b) - - {`M[dstOffset] = M[aOffset] >> M[bOffset]`} -
0x0e - - \[\`CAST\`\](#isa-section-cast) - - Type cast - - {`M[dstOffset] = cast(M[aOffset])`} -
0x0f - - \[\`ADDRESS\`\](#isa-section-address) - - - Get the address of the currently executing l2 contract - - - {`M[dstOffset] = context.environment.address`} -
0x10 - - \[\`SENDER\`\](#isa-section-sender) - - - Get the address of the sender (caller of the current context) - - - {`M[dstOffset] = context.environment.sender`} -
0x12 - - \[\`TRANSACTIONFEE\`\](#isa-section-transactionfee) - - - Get the computed transaction fee during teardown phase, zero otherwise - - - {`M[dstOffset] = context.environment.transactionFee`} -
0x13 - - \[\`CHAINID\`\](#isa-section-chainid) - - Get this rollup's L1 chain ID - - {`M[dstOffset] = context.environment.globals.chainId`} -
0x14 - - \[\`VERSION\`\](#isa-section-version) - - Get this rollup's L2 version ID - - {`M[dstOffset] = context.environment.globals.version`} -
0x15 - - \[\`BLOCKNUMBER\`\](#isa-section-blocknumber) - - Get this L2 block's number - - {`M[dstOffset] = context.environment.globals.blocknumber`} -
0x16 - - \[\`TIMESTAMP\`\](#isa-section-timestamp) - - Get this L2 block's timestamp - - {`M[dstOffset] = context.environment.globals.timestamp`} -
0x17 - - \[\`FEEPERL2GAS\`\](#isa-section-feeperl2gas) - - - Get the fee to be paid per "L2 gas" - constant for entire transaction - - - {`M[dstOffset] = context.environment.globals.feePerL2Gas`} -
0x18 - - \[\`FEEPERDAGAS\`\](#isa-section-feeperdagas) - - - Get the fee to be paid per "DA gas" - constant for entire transaction - - - {`M[dstOffset] = context.environment.globals.feePerDaGas`} -
0x19 - - \[\`CALLDATACOPY\`\](#isa-section-calldatacopy) - - Copy calldata into memory - - {`M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]`} -
0x1a - - \[\`L2GASLEFT\`\](#isa-section-l2gasleft) - - - Remaining "L2 gas" for this call (after this instruction) - - - {`M[dstOffset] = context.MachineState.l2GasLeft`} -
0x1b - - \[\`DAGASLEFT\`\](#isa-section-dagasleft) - - - Remaining "DA gas" for this call (after this instruction) - - - {`M[dstOffset] = context.machineState.daGasLeft`} -
0x1c - - \[\`JUMP\`\](#isa-section-jump) - - Jump to a location in the bytecode - - {`context.machineState.pc = loc`} -
0x1d - - \[\`JUMPI\`\](#isa-section-jumpi) - - Conditionally jump to a location in the bytecode - - {`context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc`} -
0x1e - - \[\`INTERNALCALL\`\](#isa-section-internalcall) - - - Make an internal call. Push the current PC to the internal call stack - and jump to the target location. - - - - {`context.machineState.internalCallStack.push(context.machineState.pc) +OpcodeNameSummaryExpression
0x00\[\`ADD\`\](#isa-section-add)Addition (a + b){ + `M[dstOffset] = M[aOffset] + M[bOffset] mod 2^k` + }
0x01\[\`SUB\`\](#isa-section-sub)Subtraction (a - b){ + `M[dstOffset] = M[aOffset] - M[bOffset] mod 2^k` + }
0x02\[\`MUL\`\](#isa-section-mul)Multiplication (a * b){ + `M[dstOffset] = M[aOffset] * M[bOffset] mod 2^k` + }
0x03\[\`DIV\`\](#isa-section-div)Unsigned integer division (a / b){ + `M[dstOffset] = M[aOffset] / M[bOffset]` + }
0x04\[\`FDIV\`\](#isa-section-fdiv)Field division (a / b){ + `M[dstOffset] = M[aOffset] / M[bOffset]` + }
0x05\[\`EQ\`\](#isa-section-eq)Equality check (a == b){ + `M[dstOffset] = M[aOffset] == M[bOffset] ? 1 : 0` + }
0x06\[\`LT\`\](#isa-section-lt)Less-than check (a < b){ + `M[dstOffset] = M[aOffset] < M[bOffset] ? 1 : 0` + }
0x07\[\`LTE\`\](#isa-section-lte)Less-than-or-equals check (a <= b){ + `M[dstOffset] = M[aOffset] <= M[bOffset] ? 1 : 0` + }
0x08\[\`AND\`\](#isa-section-and)Bitwise AND (a & b){ + `M[dstOffset] = M[aOffset] AND M[bOffset]` + }
0x09\[\`OR\`\](#isa-section-or)Bitwise OR (a | b){ + `M[dstOffset] = M[aOffset] OR M[bOffset]` + }
0x0a\[\`XOR\`\](#isa-section-xor)Bitwise XOR (a ^ b){ + `M[dstOffset] = M[aOffset] XOR M[bOffset]` + }
0x0b\[\`NOT\`\](#isa-section-not)Bitwise NOT (inversion){ + `M[dstOffset] = NOT M[aOffset]` + }
0x0c\[\`SHL\`\](#isa-section-shl)Bitwise leftward shift (a << b){ + `M[dstOffset] = M[aOffset] << M[bOffset]` + }
0x0d\[\`SHR\`\](#isa-section-shr)Bitwise rightward shift (a >> b){ + `M[dstOffset] = M[aOffset] >> M[bOffset]` + }
0x0e\[\`CAST\`\](#isa-section-cast)Type cast{ + `M[dstOffset] = cast(M[aOffset])` + }
0x0f\[\`ADDRESS\`\](#isa-section-address)Get the address of the currently executing l2 contract{ + `M[dstOffset] = context.environment.address` + }
0x10\[\`SENDER\`\](#isa-section-sender)Get the address of the sender (caller of the current context){ + `M[dstOffset] = context.environment.sender` + }
0x11\[\`TRANSACTIONFEE\`\](#isa-section-transactionfee)Get the computed transaction fee during teardown phase, zero otherwise{ + `M[dstOffset] = context.environment.transactionFee` + }
0x12\[\`CHAINID\`\](#isa-section-chainid)Get this rollup's L1 chain ID{ + `M[dstOffset] = context.environment.globals.chainId` + }
0x13\[\`VERSION\`\](#isa-section-version)Get this rollup's L2 version ID{ + `M[dstOffset] = context.environment.globals.version` + }
0x14\[\`BLOCKNUMBER\`\](#isa-section-blocknumber)Get this L2 block's number{ + `M[dstOffset] = context.environment.globals.blocknumber` + }
0x15\[\`TIMESTAMP\`\](#isa-section-timestamp)Get this L2 block's timestamp{ + `M[dstOffset] = context.environment.globals.timestamp` + }
0x16\[\`FEEPERL2GAS\`\](#isa-section-feeperl2gas)Get the fee to be paid per "L2 gas" - constant for entire transaction{ + `M[dstOffset] = context.environment.globals.feePerL2Gas` + }
0x17\[\`FEEPERDAGAS\`\](#isa-section-feeperdagas)Get the fee to be paid per "DA gas" - constant for entire transaction{ + `M[dstOffset] = context.environment.globals.feePerDaGas` + }
0x18\[\`CALLDATACOPY\`\](#isa-section-calldatacopy)Copy calldata into memory{ + `M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]` + }
0x19\[\`L2GASLEFT\`\](#isa-section-l2gasleft)Remaining "L2 gas" for this call (after this instruction){ + `M[dstOffset] = context.MachineState.l2GasLeft` + }
0x1a\[\`DAGASLEFT\`\](#isa-section-dagasleft)Remaining "DA gas" for this call (after this instruction){ + `M[dstOffset] = context.machineState.daGasLeft` + }
0x1b\[\`JUMP\`\](#isa-section-jump)Jump to a location in the bytecode{ + `context.machineState.pc = loc` + }
0x1c\[\`JUMPI\`\](#isa-section-jumpi)Conditionally jump to a location in the bytecode{ + `context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc` + }
0x1d\[\`INTERNALCALL\`\](#isa-section-internalcall)Make an internal call. Push the current PC to the internal call stack and jump to the target location. +{`context.machineState.internalCallStack.push(context.machineState.pc) context.machineState.pc = loc`} - -
0x1f - - \[\`INTERNALRETURN\`\](#isa-section-internalreturn) - - - Return from an internal call. Pop from the internal call stack and jump - to the popped location. - - - {`context.machineState.pc = context.machineState.internalCallStack.pop()`} -
0x20 - - \[\`SET\`\](#isa-section-set) - - Set a memory word from a constant in the bytecode - - {`M[dstOffset] = const`} -
0x21 - - \[\`MOV\`\](#isa-section-mov) - - - Move a word from source memory location to destination - - - {`M[dstOffset] = M[srcOffset]`} -
0x22 - - \[\`CMOV\`\](#isa-section-cmov) - - - Move a word (conditionally chosen) from one memory location to another - (`d = cond > 0 ? a : b`) - - - {`M[dstOffset] = M[condOffset] > 0 ? M[aOffset] : M[bOffset]`} -
0x23 - - \[\`SLOAD\`\](#isa-section-sload) - - - Load a word from this contract's persistent public storage. Zero is - loaded for unwritten slots. - - - {`M[dstOffset] = S[M[slotOffset]]`} -
0x24 - - \[\`SSTORE\`\](#isa-section-sstore) - - - Write a word to this contract's persistent public storage - - - {`S[M[slotOffset]] = M[srcOffset]`} -
0x25 - - \[\`NOTEHASHEXISTS\`\](#isa-section-notehashexists) - - - Check whether a note hash exists in the note hash tree (as of the start - of the current block) - - - - {`exists = context.worldState.noteHashes.has({ +
0x1e\[\`INTERNALRETURN\`\](#isa-section-internalreturn)Return from an internal call. Pop from the internal call stack and jump to the popped location.{ + `context.machineState.pc = context.machineState.internalCallStack.pop()` + }
0x1f\[\`SET\`\](#isa-section-set)Set a memory word from a constant in the bytecode{ + `M[dstOffset] = const` + }
0x20\[\`MOV\`\](#isa-section-mov)Move a word from source memory location to destination{ + `M[dstOffset] = M[srcOffset]` + }
0x21\[\`CMOV\`\](#isa-section-cmov)Move a word (conditionally chosen) from one memory location to another (`d = cond > 0 ? a : b`){ + `M[dstOffset] = M[condOffset] > 0 ? M[aOffset] : M[bOffset]` + }
0x22\[\`SLOAD\`\](#isa-section-sload)Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots. +{`M[dstOffset] = S[M[slotOffset]]`} +
0x23\[\`SSTORE\`\](#isa-section-sstore)Write a word to this contract's persistent public storage +{`S[M[slotOffset]] = M[srcOffset]`} +
0x24\[\`NOTEHASHEXISTS\`\](#isa-section-notehashexists)Check whether a note hash exists in the note hash tree (as of the start of the current block) +{`exists = context.worldState.noteHashes.has({ leafIndex: M[leafIndexOffset] leaf: hash(context.environment.address, M[noteHashOffset]), }) M[existsOffset] = exists`} - -
0x26 - - \[\`EMITNOTEHASH\`\](#isa-section-emitnotehash) - - - Emit a new note hash to be inserted into the note hash tree - - - - {`context.worldState.noteHashes.append( +
0x25\[\`EMITNOTEHASH\`\](#isa-section-emitnotehash)Emit a new note hash to be inserted into the note hash tree +{`context.worldState.noteHashes.append( hash(context.environment.address, M[noteHashOffset]) )`} - -
0x27 - - \[\`NULLIFIEREXISTS\`\](#isa-section-nullifierexists) - - - Check whether a nullifier exists in the nullifier tree (including - nullifiers from earlier in the current transaction or from earlier in - the current block) - - - - {`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( +
0x26\[\`NULLIFIEREXISTS\`\](#isa-section-nullifierexists)Check whether a nullifier exists in the nullifier tree (including nullifiers from earlier in the current transaction or from earlier in the current block) +{`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( hash(M[addressOffset], M[nullifierOffset]) ) M[existsOffset] = exists`} - -
0x28 - - \[\`EMITNULLIFIER\`\](#isa-section-emitnullifier) - - - Emit a new nullifier to be inserted into the nullifier tree - - - - {`context.worldState.nullifiers.append( +
0x27\[\`EMITNULLIFIER\`\](#isa-section-emitnullifier)Emit a new nullifier to be inserted into the nullifier tree +{`context.worldState.nullifiers.append( hash(context.environment.address, M[nullifierOffset]) )`} - -
0x29 - - \[\`L1TOL2MSGEXISTS\`\](#isa-section-l1tol2msgexists) - - - Check if a message exists in the L1-to-L2 message tree - - - - {`exists = context.worldState.l1ToL2Messages.has({ +
0x28\[\`L1TOL2MSGEXISTS\`\](#isa-section-l1tol2msgexists)Check if a message exists in the L1-to-L2 message tree +{`exists = context.worldState.l1ToL2Messages.has({ leafIndex: M[msgLeafIndexOffset], leaf: M[msgHashOffset] }) M[existsOffset] = exists`} - -
0x2a - - - \[\`GETCONTRACTINSTANCE\`\](#isa-section-getcontractinstance) - - - Copies contract instance data to memory - - - {`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ +
0x29\[\`GETCONTRACTINSTANCE\`\](#isa-section-getcontractinstance)Copies contract instance data to memory +{`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ instance_found_in_address, instance.salt ?? 0, instance.deployer ?? 0, @@ -639,64 +370,41 @@ M[existsOffset] = exists`} instance.portalContractAddress ?? 0, instance.publicKeysHash ?? 0, ]`} - -
0x2b - - - \[\`EMITUNENCRYPTEDLOG\`\](#isa-section-emitunencryptedlog) - - - Emit an unencrypted log - - - {`context.accruedSubstate.unencryptedLogs.append( +
0x2a\[\`EMITUNENCRYPTEDLOG\`\](#isa-section-emitunencryptedlog)Emit an unencrypted log +{`context.accruedSubstate.unencryptedLogs.append( UnencryptedLog { address: context.environment.address, log: M[logOffset:logOffset+M[logSizeOffset]], } )`} - -
0x2c - - \[\`SENDL2TOL1MSG\`\](#isa-section-sendl2tol1msg) - - Send an L2-to-L1 message - - - {`context.accruedSubstate.sentL2ToL1Messages.append( +
0x2b\[\`SENDL2TOL1MSG\`\](#isa-section-sendl2tol1msg)Send an L2-to-L1 message +{`context.accruedSubstate.sentL2ToL1Messages.append( SentL2ToL1Message { address: context.environment.address, recipient: M[recipientOffset], message: M[contentOffset] } )`} - -
0x2d - - \[\`CALL\`\](#isa-section-call) - - Call into another contract - - - {`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +
0x2c\[\`CALL\`\](#isa-section-call)Call into another contract +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) @@ -704,24 +412,14 @@ traceNestedCall(context, instr.args.addrOffset) nestedContext = deriveContext(context, instr.args, isStaticCall=false) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} - -
0x2e - - \[\`STATICCALL\`\](#isa-section-staticcall) - - - Call into another contract, disallowing World State and Accrued Substate - modifications - - - - {`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +
0x2d\[\`STATICCALL\`\](#isa-section-staticcall)Call into another contract, disallowing World State and Accrued Substate modifications +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) @@ -729,84 +427,52 @@ traceNestedCall(context, instr.args.addrOffset) nestedContext = deriveContext(context, instr.args, isStaticCall=true execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} - -
0x2f - - \[\`RETURN\`\](#isa-section-return) - - - Halt execution within this context (without revert), optionally - returning some data - - - - {`context.contractCallResults.output = M[retOffset:retOffset+retSize] +
0x2e\[\`RETURN\`\](#isa-section-return)Halt execution within this context (without revert), optionally returning some data +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] halt`} - -
0x30 - - \[\`REVERT\`\](#isa-section-revert) - - - Halt execution within this context as `reverted`, optionally returning - some data - - - - {`context.contractCallResults.output = M[retOffset:retOffset+retSize] +
0x2f\[\`REVERT\`\](#isa-section-revert)Halt execution within this context as `reverted`, optionally returning some data +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] context.contractCallResults.reverted = true halt`} - -
0x31 - - \[\`TORADIXLE\`\](#isa-section-to_radix_le) - - - Convert a word to an array of limbs in little-endian radix form - - - - TBD: Storage of limbs and if T[dstOffset] is constrained to U8 - -
0x30\[\`TORADIXLE\`\](#isa-section-to_radix_le)Convert a word to an array of limbs in little-endian radix formTBD: Storage of limbs and if T[dstOffset] is constrained to U8
+ ## Instructions ### `ADD` - Addition (a + b) [See in table.](#isa-table-add) - **Opcode**: 0x00 - **Category**: Compute - Arithmetic -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] + M[bOffset] mod 2^k` - **Details**: Wraps on overflow - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` @@ -816,20 +482,19 @@ Addition (a + b) [![](/img/protocol-specs/public-vm/bit-formats/ADD.png)](/img/protocol-specs/public-vm/bit-formats/ADD.png) ### `SUB` - Subtraction (a - b) [See in table.](#isa-table-sub) - **Opcode**: 0x01 - **Category**: Compute - Arithmetic -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] - M[bOffset] mod 2^k` - **Details**: Wraps on undeflow - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` @@ -839,20 +504,19 @@ Subtraction (a - b) [![](/img/protocol-specs/public-vm/bit-formats/SUB.png)](/img/protocol-specs/public-vm/bit-formats/SUB.png) ### `MUL` - -Multiplication (a \* b) +Multiplication (a * b) [See in table.](#isa-table-mul) - **Opcode**: 0x02 - **Category**: Compute - Arithmetic -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] * M[bOffset] mod 2^k` - **Details**: Wraps on overflow - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` @@ -862,20 +526,19 @@ Multiplication (a \* b) [![](/img/protocol-specs/public-vm/bit-formats/MUL.png)](/img/protocol-specs/public-vm/bit-formats/MUL.png) ### `DIV` - Unsigned integer division (a / b) [See in table.](#isa-table-div) - **Opcode**: 0x03 - **Category**: Compute - Arithmetic -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] / M[bOffset]` - **Details**: If the input is a field, it will be interpreted as an integer - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` @@ -885,39 +548,38 @@ Unsigned integer division (a / b) [![](/img/protocol-specs/public-vm/bit-formats/DIV.png)](/img/protocol-specs/public-vm/bit-formats/DIV.png) ### `FDIV` - Field division (a / b) [See in table.](#isa-table-fdiv) - **Opcode**: 0x04 - **Category**: Compute - Arithmetic -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] / M[bOffset]` - **Tag checks**: `T[aOffset] == T[bOffset] == field` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 120 -### `EQ` +### `EQ` Equality check (a \=\= b) [See in table.](#isa-table-eq) - **Opcode**: 0x05 - **Category**: Compute - Comparators -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] == M[bOffset] ? 1 : 0` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = u8` @@ -926,20 +588,19 @@ Equality check (a \=\= b) [![](/img/protocol-specs/public-vm/bit-formats/EQ.png)](/img/protocol-specs/public-vm/bit-formats/EQ.png) ### `LT` - Less-than check (a \< b) [See in table.](#isa-table-lt) - **Opcode**: 0x06 - **Category**: Compute - Comparators -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] < M[bOffset] ? 1 : 0` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = u8` @@ -948,20 +609,19 @@ Less-than check (a \< b) [![](/img/protocol-specs/public-vm/bit-formats/LT.png)](/img/protocol-specs/public-vm/bit-formats/LT.png) ### `LTE` - Less-than-or-equals check (a \<\= b) [See in table.](#isa-table-lte) - **Opcode**: 0x07 - **Category**: Compute - Comparators -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] <= M[bOffset] ? 1 : 0` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = u8` @@ -970,20 +630,19 @@ Less-than-or-equals check (a \<\= b) [![](/img/protocol-specs/public-vm/bit-formats/LTE.png)](/img/protocol-specs/public-vm/bit-formats/LTE.png) ### `AND` - Bitwise AND (a & b) [See in table.](#isa-table-and) - **Opcode**: 0x08 - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] AND M[bOffset]` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = inTag` @@ -992,20 +651,19 @@ Bitwise AND (a & b) [![](/img/protocol-specs/public-vm/bit-formats/AND.png)](/img/protocol-specs/public-vm/bit-formats/AND.png) ### `OR` - Bitwise OR (a | b) [See in table.](#isa-table-or) - **Opcode**: 0x09 - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] OR M[bOffset]` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = inTag` @@ -1014,20 +672,19 @@ Bitwise OR (a | b) [![](/img/protocol-specs/public-vm/bit-formats/OR.png)](/img/protocol-specs/public-vm/bit-formats/OR.png) ### `XOR` - Bitwise XOR (a ^ b) [See in table.](#isa-table-xor) - **Opcode**: 0x0a - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] XOR M[bOffset]` - **Tag checks**: `T[aOffset] == T[bOffset] == inTag` - **Tag updates**: `T[dstOffset] = inTag` @@ -1036,19 +693,18 @@ Bitwise XOR (a ^ b) [![](/img/protocol-specs/public-vm/bit-formats/XOR.png)](/img/protocol-specs/public-vm/bit-formats/XOR.png) ### `NOT` - Bitwise NOT (inversion) [See in table.](#isa-table-not) - **Opcode**: 0x0b - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = NOT M[aOffset]` - **Tag checks**: `T[aOffset] == inTag` - **Tag updates**: `T[dstOffset] = inTag` @@ -1057,20 +713,19 @@ Bitwise NOT (inversion) [![](/img/protocol-specs/public-vm/bit-formats/NOT.png)](/img/protocol-specs/public-vm/bit-formats/NOT.png) ### `SHL` - Bitwise leftward shift (a \<\< b) [See in table.](#isa-table-shl) - **Opcode**: 0x0c - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] << M[bOffset]` - **Tag checks**: `T[aOffset] == inTag`, `T[bOffset] == u8` - **Tag updates**: `T[dstOffset] = inTag` @@ -1079,20 +734,19 @@ Bitwise leftward shift (a \<\< b) [![](/img/protocol-specs/public-vm/bit-formats/SHL.png)](/img/protocol-specs/public-vm/bit-formats/SHL.png) ### `SHR` - Bitwise rightward shift (a \>\> b) [See in table.](#isa-table-shr) - **Opcode**: 0x0d - **Category**: Compute - Bitwise -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. -- **Args**: - - **aOffset**: memory offset of the operation's left input - - **bOffset**: memory offset of the operation's right input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[aOffset] >> M[bOffset]` - **Tag checks**: `T[aOffset] == inTag`, `T[bOffset] == u8` - **Tag updates**: `T[dstOffset] = inTag` @@ -1101,19 +755,18 @@ Bitwise rightward shift (a \>\> b) [![](/img/protocol-specs/public-vm/bit-formats/SHR.png)](/img/protocol-specs/public-vm/bit-formats/SHR.png) ### `CAST` - Type cast [See in table.](#isa-table-cast) - **Opcode**: 0x0e - **Category**: Type Conversions -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **dstTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to tag the destination with but not to check inputs against. -- **Args**: - - **aOffset**: memory offset of word to cast - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **dstTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to tag the destination with but not to check inputs against. +- **Args**: + - **aOffset**: memory offset of word to cast + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = cast(M[aOffset])` - **Details**: Cast a word in memory based on the `dstTag` specified in the bytecode. Truncates (`M[dstOffset] = M[aOffset] mod 2^dstsize`) when casting to a smaller type, left-zero-pads when casting to a larger type. See [here](./memory-model#cast-and-tag-conversions) for more details. - **Tag updates**: `T[dstOffset] = dstTag` @@ -1122,17 +775,16 @@ Type cast [![](/img/protocol-specs/public-vm/bit-formats/CAST.png)](/img/protocol-specs/public-vm/bit-formats/CAST.png) ### `ADDRESS` - Get the address of the currently executing l2 contract [See in table.](#isa-table-address) - **Opcode**: 0x0f - **Category**: Execution Environment -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.address` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1140,17 +792,16 @@ Get the address of the currently executing l2 contract [![](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png)](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png) ### `SENDER` - Get the address of the sender (caller of the current context) [See in table.](#isa-table-sender) - **Opcode**: 0x10 - **Category**: Execution Environment -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.sender` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1158,33 +809,32 @@ Get the address of the sender (caller of the current context) [![](/img/protocol-specs/public-vm/bit-formats/SENDER.png)](/img/protocol-specs/public-vm/bit-formats/SENDER.png) ### `TRANSACTIONFEE` - Get the computed transaction fee during teardown phase, zero otherwise [See in table.](#isa-table-transactionfee) -- **Opcode**: 0x12 +- **Opcode**: 0x11 - **Category**: Execution Environment -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.transactionFee` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 -### `CHAINID` +### `CHAINID` Get this rollup's L1 chain ID [See in table.](#isa-table-chainid) -- **Opcode**: 0x13 +- **Opcode**: 0x12 - **Category**: Execution Environment - Globals -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.chainId` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1192,17 +842,16 @@ Get this rollup's L1 chain ID [![](/img/protocol-specs/public-vm/bit-formats/CHAINID.png)](/img/protocol-specs/public-vm/bit-formats/CHAINID.png) ### `VERSION` - Get this rollup's L2 version ID [See in table.](#isa-table-version) -- **Opcode**: 0x14 +- **Opcode**: 0x13 - **Category**: Execution Environment - Globals -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.version` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1210,17 +859,16 @@ Get this rollup's L2 version ID [![](/img/protocol-specs/public-vm/bit-formats/VERSION.png)](/img/protocol-specs/public-vm/bit-formats/VERSION.png) ### `BLOCKNUMBER` - Get this L2 block's number [See in table.](#isa-table-blocknumber) -- **Opcode**: 0x15 +- **Opcode**: 0x14 - **Category**: Execution Environment - Globals -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.blocknumber` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1228,17 +876,16 @@ Get this L2 block's number [![](/img/protocol-specs/public-vm/bit-formats/BLOCKNUMBER.png)](/img/protocol-specs/public-vm/bit-formats/BLOCKNUMBER.png) ### `TIMESTAMP` - Get this L2 block's timestamp [See in table.](#isa-table-timestamp) -- **Opcode**: 0x16 +- **Opcode**: 0x15 - **Category**: Execution Environment - Globals -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.timestamp` - **Tag updates**: `T[dstOffset] = u64` - **Bit-size**: 56 @@ -1246,17 +893,16 @@ Get this L2 block's timestamp [![](/img/protocol-specs/public-vm/bit-formats/TIMESTAMP.png)](/img/protocol-specs/public-vm/bit-formats/TIMESTAMP.png) ### `FEEPERL2GAS` - Get the fee to be paid per "L2 gas" - constant for entire transaction [See in table.](#isa-table-feeperl2gas) -- **Opcode**: 0x17 +- **Opcode**: 0x16 - **Category**: Execution Environment - Globals - Gas -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.feePerL2Gas` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1264,17 +910,16 @@ Get the fee to be paid per "L2 gas" - constant for entire transaction [![](/img/protocol-specs/public-vm/bit-formats/FEEPERL2GAS.png)](/img/protocol-specs/public-vm/bit-formats/FEEPERL2GAS.png) ### `FEEPERDAGAS` - Get the fee to be paid per "DA gas" - constant for entire transaction [See in table.](#isa-table-feeperdagas) -- **Opcode**: 0x18 +- **Opcode**: 0x17 - **Category**: Execution Environment - Globals - Gas -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.environment.globals.feePerDaGas` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 56 @@ -1282,19 +927,18 @@ Get the fee to be paid per "DA gas" - constant for entire transaction [![](/img/protocol-specs/public-vm/bit-formats/FEEPERDAGAS.png)](/img/protocol-specs/public-vm/bit-formats/FEEPERDAGAS.png) ### `CALLDATACOPY` - Copy calldata into memory [See in table.](#isa-table-calldatacopy) -- **Opcode**: 0x19 +- **Opcode**: 0x18 - **Category**: Execution Environment - Calldata -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **cdOffset**: offset into calldata to copy from - - **copySize**: number of words to copy - - **dstOffset**: memory offset specifying where to copy the first word to +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **cdOffset**: offset into calldata to copy from + - **copySize**: number of words to copy + - **dstOffset**: memory offset specifying where to copy the first word to - **Expression**: `M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]` - **Details**: Calldata is read-only and cannot be directly operated on by other instructions. This instruction moves words from calldata into memory so they can be operated on normally. - **Tag updates**: `T[dstOffset:dstOffset+copySize] = field` @@ -1303,17 +947,16 @@ Copy calldata into memory [![](/img/protocol-specs/public-vm/bit-formats/CALLDATACOPY.png)](/img/protocol-specs/public-vm/bit-formats/CALLDATACOPY.png) ### `L2GASLEFT` - Remaining "L2 gas" for this call (after this instruction) [See in table.](#isa-table-l2gasleft) -- **Opcode**: 0x1a +- **Opcode**: 0x19 - **Category**: Machine State - Gas -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.MachineState.l2GasLeft` - **Tag updates**: `T[dstOffset] = u32` - **Bit-size**: 56 @@ -1321,17 +964,16 @@ Remaining "L2 gas" for this call (after this instruction) [![](/img/protocol-specs/public-vm/bit-formats/L2GASLEFT.png)](/img/protocol-specs/public-vm/bit-formats/L2GASLEFT.png) ### `DAGASLEFT` - Remaining "DA gas" for this call (after this instruction) [See in table.](#isa-table-dagasleft) -- **Opcode**: 0x1b +- **Opcode**: 0x1a - **Category**: Machine State - Gas -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = context.machineState.daGasLeft` - **Tag updates**: `T[dstOffset] = u32` - **Bit-size**: 56 @@ -1339,15 +981,14 @@ Remaining "DA gas" for this call (after this instruction) [![](/img/protocol-specs/public-vm/bit-formats/DAGASLEFT.png)](/img/protocol-specs/public-vm/bit-formats/DAGASLEFT.png) ### `JUMP` - Jump to a location in the bytecode [See in table.](#isa-table-jump) -- **Opcode**: 0x1c +- **Opcode**: 0x1b - **Category**: Machine State - Control Flow -- **Args**: - - **loc**: target location to jump to +- **Args**: + - **loc**: target location to jump to - **Expression**: `context.machineState.pc = loc` - **Details**: Target location is an immediate value (a constant in the bytecode). - **Bit-size**: 48 @@ -1355,18 +996,17 @@ Jump to a location in the bytecode [![](/img/protocol-specs/public-vm/bit-formats/JUMP.png)](/img/protocol-specs/public-vm/bit-formats/JUMP.png) ### `JUMPI` - Conditionally jump to a location in the bytecode [See in table.](#isa-table-jumpi) -- **Opcode**: 0x1d +- **Opcode**: 0x1c - **Category**: Machine State - Control Flow -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **loc**: target location conditionally jump to - - **condOffset**: memory offset of the operations 'conditional' input +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **loc**: target location conditionally jump to + - **condOffset**: memory offset of the operations 'conditional' input - **Expression**: `context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc` - **Details**: Target location is an immediate value (a constant in the bytecode). `T[condOffset]` is not checked because the greater-than-zero suboperation is the same regardless of type. - **Bit-size**: 88 @@ -1374,35 +1014,29 @@ Conditionally jump to a location in the bytecode [![](/img/protocol-specs/public-vm/bit-formats/JUMPI.png)](/img/protocol-specs/public-vm/bit-formats/JUMPI.png) ### `INTERNALCALL` - Make an internal call. Push the current PC to the internal call stack and jump to the target location. [See in table.](#isa-table-internalcall) -- **Opcode**: 0x1e +- **Opcode**: 0x1d - **Category**: Machine State - Control Flow -- **Args**: - - **loc**: target location to jump/call to -- **Expression**: - {" "} - {" "} - {" "} - - {`context.machineState.internalCallStack.push(context.machineState.pc) +- **Args**: + - **loc**: target location to jump/call to +- **Expression**: + +{`context.machineState.internalCallStack.push(context.machineState.pc) context.machineState.pc = loc`} - + - **Details**: Target location is an immediate value (a constant in the bytecode). - **Bit-size**: 48 -[![](/img/protocol-specs/public-vm/bit-formats/INTERNALCALL.png)](/img/protocol-specs/public-vm/bit-formats/INTERNALCALL.png) ### `INTERNALRETURN` - Return from an internal call. Pop from the internal call stack and jump to the popped location. [See in table.](#isa-table-internalreturn) -- **Opcode**: 0x1f +- **Opcode**: 0x1e - **Category**: Machine State - Control Flow - **Expression**: `context.machineState.pc = context.machineState.internalCallStack.pop()` - **Bit-size**: 16 @@ -1410,19 +1044,18 @@ Return from an internal call. Pop from the internal call stack and jump to the p [![](/img/protocol-specs/public-vm/bit-formats/INTERNALRETURN.png)](/img/protocol-specs/public-vm/bit-formats/INTERNALRETURN.png) ### `SET` - Set a memory word from a constant in the bytecode [See in table.](#isa-table-set) -- **Opcode**: 0x20 +- **Opcode**: 0x1f - **Category**: Machine State - Memory -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. - - **inTag**: The [type/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for SET. -- **Args**: - - **const**: an N-bit constant value from the bytecode to store in memory (any type except `field`) - - **dstOffset**: memory offset specifying where to store the constant +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [type/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for SET. +- **Args**: + - **const**: an N-bit constant value from the bytecode to store in memory (any type except `field`) + - **dstOffset**: memory offset specifying where to store the constant - **Expression**: `M[dstOffset] = const` - **Details**: Set memory word at `dstOffset` to `const`'s immediate value. `const`'s bit-size (N) can be 8, 16, 32, 64, or 128 based on `inTag`. It _cannot be 254 (`field` type)_! - **Tag updates**: `T[dstOffset] = inTag` @@ -1431,18 +1064,17 @@ Set a memory word from a constant in the bytecode [![](/img/protocol-specs/public-vm/bit-formats/SET.png)](/img/protocol-specs/public-vm/bit-formats/SET.png) ### `MOV` - Move a word from source memory location to destination [See in table.](#isa-table-mov) -- **Opcode**: 0x21 +- **Opcode**: 0x20 - **Category**: Machine State - Memory -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **srcOffset**: memory offset of word to move - - **dstOffset**: memory offset specifying where to store that word +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of word to move + - **dstOffset**: memory offset specifying where to store that word - **Expression**: `M[dstOffset] = M[srcOffset]` - **Tag updates**: `T[dstOffset] = T[srcOffset]` - **Bit-size**: 88 @@ -1450,20 +1082,19 @@ Move a word from source memory location to destination [![](/img/protocol-specs/public-vm/bit-formats/MOV.png)](/img/protocol-specs/public-vm/bit-formats/MOV.png) ### `CMOV` - Move a word (conditionally chosen) from one memory location to another (`d \= cond \> 0 ? a : b`) [See in table.](#isa-table-cmov) -- **Opcode**: 0x22 +- **Opcode**: 0x21 - **Category**: Machine State - Memory -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **aOffset**: memory offset of word 'a' to conditionally move - - **bOffset**: memory offset of word 'b' to conditionally move - - **condOffset**: memory offset of the operations 'conditional' input - - **dstOffset**: memory offset specifying where to store operation's result +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **aOffset**: memory offset of word 'a' to conditionally move + - **bOffset**: memory offset of word 'b' to conditionally move + - **condOffset**: memory offset of the operations 'conditional' input + - **dstOffset**: memory offset specifying where to store operation's result - **Expression**: `M[dstOffset] = M[condOffset] > 0 ? M[aOffset] : M[bOffset]` - **Details**: One of two source memory locations is chosen based on the condition. `T[condOffset]` is not checked because the greater-than-zero suboperation is the same regardless of type. - **Tag updates**: `T[dstOffset] = M[condOffset] > 0 ? T[aOffset] : T[bOffset]` @@ -1472,26 +1103,24 @@ Move a word (conditionally chosen) from one memory location to another (`d \= co [![](/img/protocol-specs/public-vm/bit-formats/CMOV.png)](/img/protocol-specs/public-vm/bit-formats/CMOV.png) ### `SLOAD` - Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots. [See in table.](#isa-table-sload) -- **Opcode**: 0x23 +- **Opcode**: 0x22 - **Category**: World State - Public Storage -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **slotOffset**: memory offset of the storage slot to load from - - **dstOffset**: memory offset specifying where to store operation's result -- **Expression**: - {`M[dstOffset] = S[M[slotOffset]]`} -- **Details**: - {" "} - {" "} - {" "} - - {`// Expression is shorthand for +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **slotOffset**: memory offset of the storage slot to load from + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: + +{`M[dstOffset] = S[M[slotOffset]]`} + +- **Details**: + +{`// Expression is shorthand for leafIndex = hash(context.environment.address, M[slotOffset]) exists = context.worldState.publicStorage.has(leafIndex) // exists == previously-written if exists: @@ -1499,13 +1128,10 @@ if exists: else: value = 0 M[dstOffset] = value`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.publicStorageReads.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.publicStorageReads.append( TracedStorageRead { callPointer: context.environment.callPointer, slot: M[slotOffset], @@ -1514,7 +1140,7 @@ M[dstOffset] = value`} counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Storage slot siloing (hash with contract address), public data tree membership check - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 88 @@ -1522,37 +1148,32 @@ M[dstOffset] = value`} [![](/img/protocol-specs/public-vm/bit-formats/SLOAD.png)](/img/protocol-specs/public-vm/bit-formats/SLOAD.png) ### `SSTORE` - Write a word to this contract's persistent public storage [See in table.](#isa-table-sstore) -- **Opcode**: 0x24 +- **Opcode**: 0x23 - **Category**: World State - Public Storage -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **srcOffset**: memory offset of the word to store - - **slotOffset**: memory offset containing the storage slot to store to -- **Expression**: - {`S[M[slotOffset]] = M[srcOffset]`} -- **Details**: - {" "} - {" "} - {" "} - - {`// Expression is shorthand for +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of the word to store + - **slotOffset**: memory offset containing the storage slot to store to +- **Expression**: + +{`S[M[slotOffset]] = M[srcOffset]`} + +- **Details**: + +{`// Expression is shorthand for context.worldState.publicStorage.set({ leafIndex: hash(context.environment.address, M[slotOffset]), leaf: M[srcOffset], })`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.publicStorageWrites.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.publicStorageWrites.append( TracedStorageWrite { callPointer: context.environment.callPointer, slot: M[slotOffset], @@ -1560,43 +1181,36 @@ context.worldState.publicStorage.set({ counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Storage slot siloing (hash with contract address), public data tree update - **Bit-size**: 88 [![](/img/protocol-specs/public-vm/bit-formats/SSTORE.png)](/img/protocol-specs/public-vm/bit-formats/SSTORE.png) ### `NOTEHASHEXISTS` - Check whether a note hash exists in the note hash tree (as of the start of the current block) [See in table.](#isa-table-notehashexists) -- **Opcode**: 0x25 +- **Opcode**: 0x24 - **Category**: World State - Notes & Nullifiers -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **noteHashOffset**: memory offset of the note hash - - **leafIndexOffset**: memory offset of the leaf index - - **existsOffset**: memory offset specifying where to store operation's result (whether the note hash leaf exists) -- **Expression**: - {" "} - {" "} - {" "} - - {`exists = context.worldState.noteHashes.has({ +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **noteHashOffset**: memory offset of the note hash + - **leafIndexOffset**: memory offset of the leaf index + - **existsOffset**: memory offset specifying where to store operation's result (whether the note hash leaf exists) +- **Expression**: + +{`exists = context.worldState.noteHashes.has({ leafIndex: M[leafIndexOffset] leaf: hash(context.environment.address, M[noteHashOffset]), }) M[existsOffset] = exists`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.noteHashChecks.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.noteHashChecks.append( TracedNoteHashCheck { callPointer: context.environment.callPointer, leafIndex: M[leafIndexOffset] @@ -1605,80 +1219,67 @@ M[existsOffset] = exists`} counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Note hash siloing (hash with storage contract address), note hash tree membership check - **Tag updates**: `T[existsOffset] = u8` - **Bit-size**: 120 -### `EMITNOTEHASH` +### `EMITNOTEHASH` Emit a new note hash to be inserted into the note hash tree [See in table.](#isa-table-emitnotehash) -- **Opcode**: 0x26 +- **Opcode**: 0x25 - **Category**: World State - Notes & Nullifiers -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **noteHashOffset**: memory offset of the note hash -- **Expression**: - {" "} - {" "} - {" "} - - {`context.worldState.noteHashes.append( +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **noteHashOffset**: memory offset of the note hash +- **Expression**: + +{`context.worldState.noteHashes.append( hash(context.environment.address, M[noteHashOffset]) )`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.noteHashes.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.noteHashes.append( TracedNoteHash { callPointer: context.environment.callPointer, noteHash: M[noteHashOffset], // unsiloed note hash counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Note hash siloing (hash with contract address), note hash tree insertion. - **Bit-size**: 56 [![](/img/protocol-specs/public-vm/bit-formats/EMITNOTEHASH.png)](/img/protocol-specs/public-vm/bit-formats/EMITNOTEHASH.png) ### `NULLIFIEREXISTS` - Check whether a nullifier exists in the nullifier tree (including nullifiers from earlier in the current transaction or from earlier in the current block) [See in table.](#isa-table-nullifierexists) -- **Opcode**: 0x27 +- **Opcode**: 0x26 - **Category**: World State - Notes & Nullifiers -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **nullifierOffset**: memory offset of the unsiloed nullifier - - **addressOffset**: memory offset of the storage address - - **existsOffset**: memory offset specifying where to store operation's result (whether the nullifier exists) -- **Expression**: - {" "} - {" "} - {" "} - - {`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **nullifierOffset**: memory offset of the unsiloed nullifier + - **addressOffset**: memory offset of the storage address + - **existsOffset**: memory offset specifying where to store operation's result (whether the nullifier exists) +- **Expression**: + +{`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( hash(M[addressOffset], M[nullifierOffset]) ) M[existsOffset] = exists`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.nullifierChecks.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.nullifierChecks.append( TracedNullifierCheck { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], @@ -1687,80 +1288,67 @@ M[existsOffset] = exists`} counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Nullifier siloing (hash with storage contract address), nullifier tree membership check - **Tag updates**: `T[existsOffset] = u8` - **Bit-size**: 120 -### `EMITNULLIFIER` +### `EMITNULLIFIER` Emit a new nullifier to be inserted into the nullifier tree [See in table.](#isa-table-emitnullifier) -- **Opcode**: 0x28 +- **Opcode**: 0x27 - **Category**: World State - Notes & Nullifiers -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **nullifierOffset**: memory offset of nullifier -- **Expression**: - {" "} - {" "} - {" "} - - {`context.worldState.nullifiers.append( +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **nullifierOffset**: memory offset of nullifier +- **Expression**: + +{`context.worldState.nullifiers.append( hash(context.environment.address, M[nullifierOffset]) )`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.nullifiers.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.nullifiers.append( TracedNullifier { callPointer: context.environment.callPointer, nullifier: M[nullifierOffset], // unsiloed nullifier counter: ++context.worldStateAccessTrace.accessCounter, } )`} - + - **Triggers downstream circuit operations**: Nullifier siloing (hash with contract address), nullifier tree non-membership-check and insertion. - **Bit-size**: 56 [![](/img/protocol-specs/public-vm/bit-formats/EMITNULLIFIER.png)](/img/protocol-specs/public-vm/bit-formats/EMITNULLIFIER.png) ### `L1TOL2MSGEXISTS` - Check if a message exists in the L1-to-L2 message tree [See in table.](#isa-table-l1tol2msgexists) -- **Opcode**: 0x29 +- **Opcode**: 0x28 - **Category**: World State - Messaging -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **msgHashOffset**: memory offset of the message hash - - **msgLeafIndexOffset**: memory offset of the message's leaf index in the L1-to-L2 message tree - - **existsOffset**: memory offset specifying where to store operation's result (whether the message exists in the L1-to-L2 message tree) -- **Expression**: - {" "} - {" "} - {" "} - - {`exists = context.worldState.l1ToL2Messages.has({ +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **msgHashOffset**: memory offset of the message hash + - **msgLeafIndexOffset**: memory offset of the message's leaf index in the L1-to-L2 message tree + - **existsOffset**: memory offset specifying where to store operation's result (whether the message exists in the L1-to-L2 message tree) +- **Expression**: + +{`exists = context.worldState.l1ToL2Messages.has({ leafIndex: M[msgLeafIndexOffset], leaf: M[msgHashOffset] }) M[existsOffset] = exists`} - -- **World State access tracing**: - {" "} - {" "} - {" "} - - {`context.worldStateAccessTrace.l1ToL2MessagesChecks.append( + +- **World State access tracing**: + +{`context.worldStateAccessTrace.l1ToL2MessagesChecks.append( L1ToL2Message { callPointer: context.environment.callPointer, leafIndex: M[msgLeafIndexOffset], @@ -1768,31 +1356,30 @@ M[existsOffset] = exists`} exists: exists, // defined above } )`} - + - **Triggers downstream circuit operations**: L1-to-L2 message tree membership check -- **Tag updates**: - {`T[existsOffset] = u8,`} +- **Tag updates**: + +{`T[existsOffset] = u8,`} + - **Bit-size**: 120 -### `GETCONTRACTINSTANCE` +### `GETCONTRACTINSTANCE` Copies contract instance data to memory [See in table.](#isa-table-getcontractinstance) -- **Opcode**: 0x2a +- **Opcode**: 0x29 - **Category**: Other -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **addressOffset**: memory offset of the contract instance address - - **dstOffset**: location to write the contract instance information to -- **Expression**: - {" "} - {" "} - {" "} - - {`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **addressOffset**: memory offset of the contract instance address + - **dstOffset**: location to write the contract instance information to +- **Expression**: + +{`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ instance_found_in_address, instance.salt ?? 0, instance.deployer ?? 0, @@ -1801,95 +1388,84 @@ Copies contract instance data to memory instance.portalContractAddress ?? 0, instance.publicKeysHash ?? 0, ]`} - + - **Additional AVM circuit checks**: TO-DO - **Triggers downstream circuit operations**: TO-DO - **Tag updates**: T[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = field - **Bit-size**: 88 -### `EMITUNENCRYPTEDLOG` +### `EMITUNENCRYPTEDLOG` Emit an unencrypted log [See in table.](#isa-table-emitunencryptedlog) -- **Opcode**: 0x2b +- **Opcode**: 0x2a - **Category**: Accrued Substate - Logging -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **logOffset**: memory offset of the data to log - - **logSizeOffset**: memory offset to number of words to log -- **Expression**: - {" "} - {" "} - {" "} - - {`context.accruedSubstate.unencryptedLogs.append( +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **logOffset**: memory offset of the data to log + - **logSizeOffset**: memory offset to number of words to log +- **Expression**: + +{`context.accruedSubstate.unencryptedLogs.append( UnencryptedLog { address: context.environment.address, log: M[logOffset:logOffset+M[logSizeOffset]], } )`} - + - **Bit-size**: 88 [![](/img/protocol-specs/public-vm/bit-formats/EMITUNENCRYPTEDLOG.png)](/img/protocol-specs/public-vm/bit-formats/EMITUNENCRYPTEDLOG.png) ### `SENDL2TOL1MSG` - Send an L2-to-L1 message [See in table.](#isa-table-sendl2tol1msg) -- **Opcode**: 0x2c +- **Opcode**: 0x2b - **Category**: Accrued Substate - Messaging -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **recipientOffset**: memory offset of the message recipient - - **contentOffset**: memory offset of the message content -- **Expression**: - {" "} - {" "} - {" "} - - {`context.accruedSubstate.sentL2ToL1Messages.append( +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **recipientOffset**: memory offset of the message recipient + - **contentOffset**: memory offset of the message content +- **Expression**: + +{`context.accruedSubstate.sentL2ToL1Messages.append( SentL2ToL1Message { address: context.environment.address, recipient: M[recipientOffset], message: M[contentOffset] } )`} - + - **Bit-size**: 88 [![](/img/protocol-specs/public-vm/bit-formats/SENDL2TOL1MSG.png)](/img/protocol-specs/public-vm/bit-formats/SENDL2TOL1MSG.png) ### `CALL` - Call into another contract [See in table.](#isa-table-call) -- **Opcode**: 0x2d +- **Opcode**: 0x2c - **Category**: Control Flow - Contract Calls -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee - - **addrOffset**: address of the contract to call - - **argsOffset**: memory offset to args (will become the callee's calldata) - - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata - - **retOffset**: destination memory offset specifying where to store the data returned from the callee - - **retSize**: number of words to copy from data returned by callee - - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) -- **Expression**: - {" "} - {" "} - {" "} - - {`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee + - **addrOffset**: address of the contract to call + - **argsOffset**: memory offset to args (will become the callee's calldata) + - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata + - **retOffset**: destination memory offset specifying where to store the data returned from the callee + - **retSize**: number of words to copy from data returned by callee + - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) +- **Expression**: + +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) @@ -1897,53 +1473,46 @@ traceNestedCall(context, instr.args.addrOffset) nestedContext = deriveContext(context, instr.args, isStaticCall=false) execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} - + - **Details**: Creates a new (nested) execution context and triggers execution within that context. - Execution proceeds in the nested context until it reaches a halt at which point - execution resumes in the current/calling context. - A non-existent contract or one with no code will return success. - ["Nested contract calls"](./nested-calls) provides a full explanation of this - instruction along with the shorthand used in the expression above. - The explanation includes details on charging gas for nested calls, - nested context derivation, world state tracing, and updating the parent context - after the nested call halts. + Execution proceeds in the nested context until it reaches a halt at which point + execution resumes in the current/calling context. + A non-existent contract or one with no code will return success. + ["Nested contract calls"](./nested-calls) provides a full explanation of this + instruction along with the shorthand used in the expression above. + The explanation includes details on charging gas for nested calls, + nested context derivation, world state tracing, and updating the parent context + after the nested call halts. - **Tag checks**: `T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32` -- **Tag updates**: - {" "} - {" "} - {" "} - - {`T[successOffset] = u8 +- **Tag updates**: + +{`T[successOffset] = u8 T[retOffset:retOffset+retSize] = field`} - + - **Bit-size**: 248 [![](/img/protocol-specs/public-vm/bit-formats/CALL.png)](/img/protocol-specs/public-vm/bit-formats/CALL.png) ### `STATICCALL` - Call into another contract, disallowing World State and Accrued Substate modifications [See in table.](#isa-table-staticcall) -- **Opcode**: 0x2e +- **Opcode**: 0x2d - **Category**: Control Flow - Contract Calls -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee - - **addrOffset**: address of the contract to call - - **argsOffset**: memory offset to args (will become the callee's calldata) - - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata - - **retOffset**: destination memory offset specifying where to store the data returned from the callee - - **retSize**: number of words to copy from data returned by callee - - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) -- **Expression**: - {" "} - {" "} - {" "} - - {`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee + - **addrOffset**: address of the contract to call + - **argsOffset**: memory offset to args (will become the callee's calldata) + - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata + - **retOffset**: destination memory offset specifying where to store the data returned from the callee + - **retSize**: number of words to copy from data returned by callee + - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) +- **Expression**: + +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } chargeGas(context, l2GasCost=M[instr.args.gasOffset], daGasCost=M[instr.args.gasOffset+1]) @@ -1951,95 +1520,84 @@ traceNestedCall(context, instr.args.addrOffset) nestedContext = deriveContext(context, instr.args, isStaticCall=true execute(nestedContext) updateContextAfterNestedCall(context, instr.args, nestedContext)`} - -- **Details**: Same as `CALL`, but disallows World State and Accrued Substate modifications. - ["Nested contract calls"](./nested-calls) provides a full explanation of this - instruction along with the shorthand used in the expression above. - The explanation includes details on charging gas for nested calls, - nested context derivation, world state tracing, and updating the parent context - after the nested call halts. + +- **Details**: Same as `CALL`, but disallows World State and Accrued Substate modifications. + ["Nested contract calls"](./nested-calls) provides a full explanation of this + instruction along with the shorthand used in the expression above. + The explanation includes details on charging gas for nested calls, + nested context derivation, world state tracing, and updating the parent context + after the nested call halts. - **Tag checks**: `T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32` -- **Tag updates**: - {" "} - {" "} - {" "} - - {`T[successOffset] = u8 +- **Tag updates**: + +{`T[successOffset] = u8 T[retOffset:retOffset+retSize] = field`} - + - **Bit-size**: 248 [![](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png)](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png) ### `RETURN` - Halt execution within this context (without revert), optionally returning some data [See in table.](#isa-table-return) -- **Opcode**: 0x2f +- **Opcode**: 0x2e - **Category**: Control Flow - Contract Calls -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **retOffset**: memory offset of first word to return - - **retSize**: number of words to return -- **Expression**: - {" "} - {" "} - {" "} - - {`context.contractCallResults.output = M[retOffset:retOffset+retSize] +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **retOffset**: memory offset of first word to return + - **retSize**: number of words to return +- **Expression**: + +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] halt`} - + - **Details**: Return control flow to the calling context/contract. Caller will accept World State and Accrued Substate modifications. See ["Halting"](./execution#halting) to learn more. See ["Nested contract calls"](./nested-calls) to see how the caller updates its context after the nested call halts. - **Bit-size**: 88 [![](/img/protocol-specs/public-vm/bit-formats/RETURN.png)](/img/protocol-specs/public-vm/bit-formats/RETURN.png) ### `REVERT` - Halt execution within this context as `reverted`, optionally returning some data [See in table.](#isa-table-revert) -- **Opcode**: 0x30 +- **Opcode**: 0x2f - **Category**: Control Flow - Contract Calls -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **retOffset**: memory offset of first word to return - - **retSize**: number of words to return -- **Expression**: - {" "} - {" "} - {" "} - - {`context.contractCallResults.output = M[retOffset:retOffset+retSize] +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **retOffset**: memory offset of first word to return + - **retSize**: number of words to return +- **Expression**: + +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] context.contractCallResults.reverted = true halt`} - + - **Details**: Return control flow to the calling context/contract. Caller will reject World State and Accrued Substate modifications. See ["Halting"](./execution#halting) to learn more. See ["Nested contract calls"](./nested-calls) to see how the caller updates its context after the nested call halts. - **Bit-size**: 88 [![](/img/protocol-specs/public-vm/bit-formats/REVERT.png)](/img/protocol-specs/public-vm/bit-formats/REVERT.png) ### `TORADIXLE` - Convert a word to an array of limbs in little-endian radix form [See in table.](#isa-table-to_radix_le) -- **Opcode**: 0x31 +- **Opcode**: 0x30 - **Category**: Conversions -- **Flags**: - - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. -- **Args**: - - **srcOffset**: memory offset of word to convert. - - **dstOffset**: memory offset specifying where the first limb of the radix-conversion result is stored. - - **radix**: the maximum bit-size of each limb. - - **numLimbs**: the number of limbs the word will be converted into. +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of word to convert. + - **dstOffset**: memory offset specifying where the first limb of the radix-conversion result is stored. + - **radix**: the maximum bit-size of each limb. + - **numLimbs**: the number of limbs the word will be converted into. - **Expression**: TBD: Storage of limbs and if T[dstOffset] is constrained to U8 - **Details**: The limbs will be stored in a contiguous memory block starting at `dstOffset`. - **Tag checks**: `T[srcOffset] == field` - **Bit-size**: 152 + diff --git a/docs/docs/reference/developer_references/cli_wallet_reference.md b/docs/docs/reference/developer_references/cli_wallet_reference.md index 22c1e67e892..d256feb6bad 100644 --- a/docs/docs/reference/developer_references/cli_wallet_reference.md +++ b/docs/docs/reference/developer_references/cli_wallet_reference.md @@ -9,7 +9,7 @@ For development, it may be useful to deploy, transact, or create notes in a non- - Deploying contracts - Sending transactions -- Bridging L1 [Fee Juice](../../protocol-specs/gas-and-fees/fee-juice.md) into Aztec +- Bridging L1 "Fee Juice" into Aztec - Pushing arbitrary [notes](../../guides/developer_guides/smart_contracts/writing_contracts/notes/index.md) to your PXE - Creating [authwits](../../guides/developer_guides/smart_contracts/writing_contracts/authwit.md) - Aliasing info and secrets for further usage @@ -143,7 +143,7 @@ aztec-wallet simulate --profile --from master_yoda --contract-address jedi_order ### Bridge Fee Juice -The wallet provides an easy way to mint the fee-paying asset on L1 and bridging it to L2. We call it Fee Juice and you can read more about it in the [protocol specs](../../protocol-specs/gas-and-fees/fee-juice.md). +The wallet provides an easy way to mint the fee-paying asset on L1 and bridging it to L2. Current placeholder-name "fee juice". Using the sandbox, there's already a Fee Juice contract that manages this enshrined asset. You can optionally mint more Juice before bridging it. diff --git a/docs/docs/reference/developer_references/smart_contract_reference/macros.md b/docs/docs/reference/developer_references/smart_contract_reference/macros.md index edf3adc8442..cabe9000e99 100644 --- a/docs/docs/reference/developer_references/smart_contract_reference/macros.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/macros.md @@ -13,7 +13,7 @@ It is also worth mentioning Noir's `unconstrained` function type [here (Noir doc - `#[public]` or `#[private]` - Whether the function is to be executed from a public or private context (see Further Reading) - `#[initializer]` - If one or more functions are marked as an initializer, then one of them must be called before any non-initializer functions - `#[noinitcheck]` - The function is able to be called before an initializer (if one exists) -- `#[view]` - Makes calls to the function static (see also [Static calls in the protocol spec](../../../protocol-specs/calls/static-calls.md)) +- `#[view]` - Makes calls to the function static - `#[internal]` - Function can only be called from within the contract - `#[note]` - Creates a custom note - `#[storage]` - Defines contract storage diff --git a/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/4_typescript_glue_code.md b/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/4_typescript_glue_code.md index cf7a02878be..4020d5f6df8 100644 --- a/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/4_typescript_glue_code.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/4_typescript_glue_code.md @@ -171,5 +171,4 @@ Follow the tutorial [here](../../js_tutorials/aztecjs-getting-started.md). ### Optional: Learn more about concepts mentioned here -- [Portals (protocol specs)](../../../../protocol-specs/l1-smart-contracts/index.md#portals) - [Functions under the hood (concepts)](../../../../aztec/smart_contracts/functions/function_transforms.md) diff --git a/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/index.md b/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/index.md index 72a0c7061df..7041b051745 100644 --- a/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/index.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/token_bridge/index.md @@ -5,7 +5,7 @@ sidebar_position: 6 import Image from "@theme/IdealImage"; -In this tutorial, we will learn how to build the entire flow of a cross-chain token using portals. If this is your first time hearing the word portal, you’ll want to read [this page in the protocol specs](../../../../protocol-specs/l1-smart-contracts/index.md). +In this tutorial, we will learn how to build the entire flow of a cross-chain token using portals. ## A refresher on Portals diff --git a/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md index 064365bb3dd..364e4a50e54 100644 --- a/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md @@ -119,4 +119,3 @@ Follow the token contract tutorial on the [next page](./token_contract.md) and l - [Schnorr signer account contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/schnorr_account_contract) - [Account abstraction](../../../aztec/concepts/accounts/index.md#what-is-account-abstraction) - [Authentication witness](../../../aztec/concepts/accounts/authwit.md) -- [Fee abstraction](../../../protocol-specs/gas-and-fees/tx-setup-and-teardown.md). From ad4d45ceb62a96c4478ccdea4369e7f35de64329 Mon Sep 17 00:00:00 2001 From: James Zaki Date: Tue, 17 Dec 2024 23:14:07 +0000 Subject: [PATCH 2/4] Remove link to specs from main Resources menu --- docs/docusaurus.config.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 3c480ffaba6..df9dff30a4d 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -292,12 +292,6 @@ const config = { label: "Aztec Connect Sunset", className: "no-external-icon", }, - { - type: "docSidebar", - sidebarId: "protocolSpecSidebar", - label: "Protocol Specification", - className: "no-external-icon", - }, { type: "docSidebar", sidebarId: "roadmapSidebar", From 874f8cfc2f73a35fd71ef490ce1f27faa5b09519 Mon Sep 17 00:00:00 2001 From: James Zaki Date: Mon, 23 Dec 2024 16:59:52 +0000 Subject: [PATCH 3/4] docs: hide specs from docusaurus --- .../addresses-and-keys/address.md | 0 .../diversified-and-stealth.md | 0 .../diversified-and-stealth-keys.md | 0 .../example-usage/encrypt-and-tag.md | 0 .../example-usage/nullifier.md | 0 .../example-usage/tag-sequence-derivation.md | 0 .../addresses-and-keys/index.md | 0 .../addresses-and-keys/keys-requirements.md | 0 .../addresses-and-keys/keys.md | 0 .../addresses-and-keys/precompiles.md | 0 .../bytecode/index.md | 0 .../calls/batched-calls.md | 0 .../calls/enqueued-calls.md | 0 .../calls/index.md | 0 .../calls/public-private-messaging.md | 0 .../calls/static-calls.md | 0 .../calls/sync-calls.md | 0 .../calls/unconstrained-calls.md | 0 .../circuits/high-level-topology.md | 0 .../circuits/private-function.md | 0 .../circuits/private-kernel-initial.mdx | 0 .../circuits/private-kernel-inner.mdx | 0 .../circuits/private-kernel-reset.md | 0 .../circuits/private-kernel-tail.md | 0 .../circuits/public-kernel-initial.md | 0 .../circuits/public-kernel-inner.md | 0 .../circuits/public-kernel-tail.md | 0 .../constants.md | 0 .../contract-deployment/classes.md | 0 .../contract-deployment/index.md | 0 .../contract-deployment/instances.md | 0 .../cryptography/hashing/hashing.md | 0 .../cryptography/hashing/pedersen.md | 0 .../cryptography/hashing/poseidon2.md | 0 .../cryptography/index.md | 0 .../cryptography/merkle-trees.md | 0 .../cryptography/proving-system/data-bus.md | 0 .../cryptography/proving-system/overview.md | 0 .../proving-system/performance-targets.md | 0 .../index.md | 0 .../overview.md | 0 .../published-data.md | 0 .../decentralization/actors.md | 0 .../decentralization/block-production.md | 0 .../decentralization/governance.md | 0 .../decentralization/p2p-network.md | 0 .../gas-and-fees/fee-juice.md | 0 .../gas-and-fees/fee-schedule.md | 0 .../gas-and-fees/index.md | 0 .../gas-and-fees/kernel-tracking.md | 0 .../published-gas-and-fee-data.md | 0 .../gas-and-fees/specifying-gas-fee-info.md | 0 .../gas-and-fees/tx-setup-and-teardown.md | 0 .../intro.md | 0 .../l1-smart-contracts/frontier.md | 0 .../l1-smart-contracts/index.md | 0 .../logs/index.md | 0 .../pre-compiled-contracts/index.md | 0 .../pre-compiled-contracts/registry.md | 0 .../private-message-delivery/index.md | 0 .../private-msg-delivery.md | 0 .../send-note-guidelines.md | 0 .../public-vm/_nested-context.md | 0 .../public-vm/alu.md | 0 .../public-vm/avm-circuit.md | 0 .../public-vm/bytecode-validation-circuit.md | 0 .../public-vm/circuit-index.md | 0 .../public-vm/context.mdx | 0 .../public-vm/control-flow.md | 0 .../public-vm/execution.md | 0 .../public-vm/gen/_instruction-set.mdx | 1603 +++++++++++++++++ .../public-vm/index.md | 0 .../public-vm/instruction-set.mdx | 0 .../public-vm/intro.md | 0 .../public-vm/memory-model.md | 0 .../public-vm/nested-calls.mdx | 0 .../public-vm/security.md | 0 .../public-vm/state.md | 0 .../public-vm/type-structs.md | 0 .../rollup-circuits/base-rollup.md | 0 .../rollup-circuits/index.md | 0 .../rollup-circuits/merge-rollup.md | 0 .../rollup-circuits/root-rollup.md | 0 .../rollup-circuits/tree-parity.md | 0 .../state/archive.md | 0 .../state/index.md | 0 .../state/note-hash-tree.md | 0 .../state/nullifier-tree.md | 0 .../state/public-data-tree.md | 0 .../state/tree-implementations.md | 0 .../state/wonky-tree.md | 0 .../todo.md | 0 .../transactions/index.md | 0 .../transactions/local-execution.md | 0 .../transactions/public-execution.md | 0 .../transactions/tx-object.md | 0 .../transactions/validity.md | 0 97 files changed, 1603 insertions(+) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/address.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/diversified-and-stealth.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/example-usage/diversified-and-stealth-keys.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/example-usage/encrypt-and-tag.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/example-usage/nullifier.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/example-usage/tag-sequence-derivation.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/keys-requirements.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/keys.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/addresses-and-keys/precompiles.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/bytecode/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/batched-calls.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/enqueued-calls.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/public-private-messaging.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/static-calls.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/sync-calls.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/calls/unconstrained-calls.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/high-level-topology.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/private-function.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/private-kernel-initial.mdx (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/private-kernel-inner.mdx (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/private-kernel-reset.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/private-kernel-tail.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/public-kernel-initial.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/public-kernel-inner.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/circuits/public-kernel-tail.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/constants.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/contract-deployment/classes.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/contract-deployment/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/contract-deployment/instances.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/hashing/hashing.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/hashing/pedersen.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/hashing/poseidon2.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/merkle-trees.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/proving-system/data-bus.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/proving-system/overview.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/cryptography/proving-system/performance-targets.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/data-publication-and-availability/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/data-publication-and-availability/overview.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/data-publication-and-availability/published-data.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/decentralization/actors.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/decentralization/block-production.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/decentralization/governance.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/decentralization/p2p-network.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/fee-juice.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/fee-schedule.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/kernel-tracking.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/published-gas-and-fee-data.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/specifying-gas-fee-info.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/gas-and-fees/tx-setup-and-teardown.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/intro.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/l1-smart-contracts/frontier.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/l1-smart-contracts/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/logs/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/pre-compiled-contracts/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/pre-compiled-contracts/registry.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/private-message-delivery/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/private-message-delivery/private-msg-delivery.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/private-message-delivery/send-note-guidelines.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/_nested-context.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/alu.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/avm-circuit.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/bytecode-validation-circuit.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/circuit-index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/context.mdx (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/control-flow.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/execution.md (100%) create mode 100644 docs/docs/_protocol-specs/public-vm/gen/_instruction-set.mdx rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/instruction-set.mdx (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/intro.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/memory-model.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/nested-calls.mdx (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/security.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/state.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/public-vm/type-structs.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/rollup-circuits/base-rollup.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/rollup-circuits/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/rollup-circuits/merge-rollup.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/rollup-circuits/root-rollup.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/rollup-circuits/tree-parity.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/archive.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/note-hash-tree.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/nullifier-tree.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/public-data-tree.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/tree-implementations.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/state/wonky-tree.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/todo.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/transactions/index.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/transactions/local-execution.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/transactions/public-execution.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/transactions/tx-object.md (100%) rename docs/docs/{protocol-specs => _protocol-specs}/transactions/validity.md (100%) diff --git a/docs/docs/protocol-specs/addresses-and-keys/address.md b/docs/docs/_protocol-specs/addresses-and-keys/address.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/address.md rename to docs/docs/_protocol-specs/addresses-and-keys/address.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/diversified-and-stealth.md b/docs/docs/_protocol-specs/addresses-and-keys/diversified-and-stealth.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/diversified-and-stealth.md rename to docs/docs/_protocol-specs/addresses-and-keys/diversified-and-stealth.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/example-usage/diversified-and-stealth-keys.md b/docs/docs/_protocol-specs/addresses-and-keys/example-usage/diversified-and-stealth-keys.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/example-usage/diversified-and-stealth-keys.md rename to docs/docs/_protocol-specs/addresses-and-keys/example-usage/diversified-and-stealth-keys.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/example-usage/encrypt-and-tag.md b/docs/docs/_protocol-specs/addresses-and-keys/example-usage/encrypt-and-tag.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/example-usage/encrypt-and-tag.md rename to docs/docs/_protocol-specs/addresses-and-keys/example-usage/encrypt-and-tag.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/example-usage/nullifier.md b/docs/docs/_protocol-specs/addresses-and-keys/example-usage/nullifier.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/example-usage/nullifier.md rename to docs/docs/_protocol-specs/addresses-and-keys/example-usage/nullifier.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/example-usage/tag-sequence-derivation.md b/docs/docs/_protocol-specs/addresses-and-keys/example-usage/tag-sequence-derivation.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/example-usage/tag-sequence-derivation.md rename to docs/docs/_protocol-specs/addresses-and-keys/example-usage/tag-sequence-derivation.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/index.md b/docs/docs/_protocol-specs/addresses-and-keys/index.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/index.md rename to docs/docs/_protocol-specs/addresses-and-keys/index.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/keys-requirements.md b/docs/docs/_protocol-specs/addresses-and-keys/keys-requirements.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/keys-requirements.md rename to docs/docs/_protocol-specs/addresses-and-keys/keys-requirements.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/keys.md b/docs/docs/_protocol-specs/addresses-and-keys/keys.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/keys.md rename to docs/docs/_protocol-specs/addresses-and-keys/keys.md diff --git a/docs/docs/protocol-specs/addresses-and-keys/precompiles.md b/docs/docs/_protocol-specs/addresses-and-keys/precompiles.md similarity index 100% rename from docs/docs/protocol-specs/addresses-and-keys/precompiles.md rename to docs/docs/_protocol-specs/addresses-and-keys/precompiles.md diff --git a/docs/docs/protocol-specs/bytecode/index.md b/docs/docs/_protocol-specs/bytecode/index.md similarity index 100% rename from docs/docs/protocol-specs/bytecode/index.md rename to docs/docs/_protocol-specs/bytecode/index.md diff --git a/docs/docs/protocol-specs/calls/batched-calls.md b/docs/docs/_protocol-specs/calls/batched-calls.md similarity index 100% rename from docs/docs/protocol-specs/calls/batched-calls.md rename to docs/docs/_protocol-specs/calls/batched-calls.md diff --git a/docs/docs/protocol-specs/calls/enqueued-calls.md b/docs/docs/_protocol-specs/calls/enqueued-calls.md similarity index 100% rename from docs/docs/protocol-specs/calls/enqueued-calls.md rename to docs/docs/_protocol-specs/calls/enqueued-calls.md diff --git a/docs/docs/protocol-specs/calls/index.md b/docs/docs/_protocol-specs/calls/index.md similarity index 100% rename from docs/docs/protocol-specs/calls/index.md rename to docs/docs/_protocol-specs/calls/index.md diff --git a/docs/docs/protocol-specs/calls/public-private-messaging.md b/docs/docs/_protocol-specs/calls/public-private-messaging.md similarity index 100% rename from docs/docs/protocol-specs/calls/public-private-messaging.md rename to docs/docs/_protocol-specs/calls/public-private-messaging.md diff --git a/docs/docs/protocol-specs/calls/static-calls.md b/docs/docs/_protocol-specs/calls/static-calls.md similarity index 100% rename from docs/docs/protocol-specs/calls/static-calls.md rename to docs/docs/_protocol-specs/calls/static-calls.md diff --git a/docs/docs/protocol-specs/calls/sync-calls.md b/docs/docs/_protocol-specs/calls/sync-calls.md similarity index 100% rename from docs/docs/protocol-specs/calls/sync-calls.md rename to docs/docs/_protocol-specs/calls/sync-calls.md diff --git a/docs/docs/protocol-specs/calls/unconstrained-calls.md b/docs/docs/_protocol-specs/calls/unconstrained-calls.md similarity index 100% rename from docs/docs/protocol-specs/calls/unconstrained-calls.md rename to docs/docs/_protocol-specs/calls/unconstrained-calls.md diff --git a/docs/docs/protocol-specs/circuits/high-level-topology.md b/docs/docs/_protocol-specs/circuits/high-level-topology.md similarity index 100% rename from docs/docs/protocol-specs/circuits/high-level-topology.md rename to docs/docs/_protocol-specs/circuits/high-level-topology.md diff --git a/docs/docs/protocol-specs/circuits/private-function.md b/docs/docs/_protocol-specs/circuits/private-function.md similarity index 100% rename from docs/docs/protocol-specs/circuits/private-function.md rename to docs/docs/_protocol-specs/circuits/private-function.md diff --git a/docs/docs/protocol-specs/circuits/private-kernel-initial.mdx b/docs/docs/_protocol-specs/circuits/private-kernel-initial.mdx similarity index 100% rename from docs/docs/protocol-specs/circuits/private-kernel-initial.mdx rename to docs/docs/_protocol-specs/circuits/private-kernel-initial.mdx diff --git a/docs/docs/protocol-specs/circuits/private-kernel-inner.mdx b/docs/docs/_protocol-specs/circuits/private-kernel-inner.mdx similarity index 100% rename from docs/docs/protocol-specs/circuits/private-kernel-inner.mdx rename to docs/docs/_protocol-specs/circuits/private-kernel-inner.mdx diff --git a/docs/docs/protocol-specs/circuits/private-kernel-reset.md b/docs/docs/_protocol-specs/circuits/private-kernel-reset.md similarity index 100% rename from docs/docs/protocol-specs/circuits/private-kernel-reset.md rename to docs/docs/_protocol-specs/circuits/private-kernel-reset.md diff --git a/docs/docs/protocol-specs/circuits/private-kernel-tail.md b/docs/docs/_protocol-specs/circuits/private-kernel-tail.md similarity index 100% rename from docs/docs/protocol-specs/circuits/private-kernel-tail.md rename to docs/docs/_protocol-specs/circuits/private-kernel-tail.md diff --git a/docs/docs/protocol-specs/circuits/public-kernel-initial.md b/docs/docs/_protocol-specs/circuits/public-kernel-initial.md similarity index 100% rename from docs/docs/protocol-specs/circuits/public-kernel-initial.md rename to docs/docs/_protocol-specs/circuits/public-kernel-initial.md diff --git a/docs/docs/protocol-specs/circuits/public-kernel-inner.md b/docs/docs/_protocol-specs/circuits/public-kernel-inner.md similarity index 100% rename from docs/docs/protocol-specs/circuits/public-kernel-inner.md rename to docs/docs/_protocol-specs/circuits/public-kernel-inner.md diff --git a/docs/docs/protocol-specs/circuits/public-kernel-tail.md b/docs/docs/_protocol-specs/circuits/public-kernel-tail.md similarity index 100% rename from docs/docs/protocol-specs/circuits/public-kernel-tail.md rename to docs/docs/_protocol-specs/circuits/public-kernel-tail.md diff --git a/docs/docs/protocol-specs/constants.md b/docs/docs/_protocol-specs/constants.md similarity index 100% rename from docs/docs/protocol-specs/constants.md rename to docs/docs/_protocol-specs/constants.md diff --git a/docs/docs/protocol-specs/contract-deployment/classes.md b/docs/docs/_protocol-specs/contract-deployment/classes.md similarity index 100% rename from docs/docs/protocol-specs/contract-deployment/classes.md rename to docs/docs/_protocol-specs/contract-deployment/classes.md diff --git a/docs/docs/protocol-specs/contract-deployment/index.md b/docs/docs/_protocol-specs/contract-deployment/index.md similarity index 100% rename from docs/docs/protocol-specs/contract-deployment/index.md rename to docs/docs/_protocol-specs/contract-deployment/index.md diff --git a/docs/docs/protocol-specs/contract-deployment/instances.md b/docs/docs/_protocol-specs/contract-deployment/instances.md similarity index 100% rename from docs/docs/protocol-specs/contract-deployment/instances.md rename to docs/docs/_protocol-specs/contract-deployment/instances.md diff --git a/docs/docs/protocol-specs/cryptography/hashing/hashing.md b/docs/docs/_protocol-specs/cryptography/hashing/hashing.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/hashing/hashing.md rename to docs/docs/_protocol-specs/cryptography/hashing/hashing.md diff --git a/docs/docs/protocol-specs/cryptography/hashing/pedersen.md b/docs/docs/_protocol-specs/cryptography/hashing/pedersen.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/hashing/pedersen.md rename to docs/docs/_protocol-specs/cryptography/hashing/pedersen.md diff --git a/docs/docs/protocol-specs/cryptography/hashing/poseidon2.md b/docs/docs/_protocol-specs/cryptography/hashing/poseidon2.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/hashing/poseidon2.md rename to docs/docs/_protocol-specs/cryptography/hashing/poseidon2.md diff --git a/docs/docs/protocol-specs/cryptography/index.md b/docs/docs/_protocol-specs/cryptography/index.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/index.md rename to docs/docs/_protocol-specs/cryptography/index.md diff --git a/docs/docs/protocol-specs/cryptography/merkle-trees.md b/docs/docs/_protocol-specs/cryptography/merkle-trees.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/merkle-trees.md rename to docs/docs/_protocol-specs/cryptography/merkle-trees.md diff --git a/docs/docs/protocol-specs/cryptography/proving-system/data-bus.md b/docs/docs/_protocol-specs/cryptography/proving-system/data-bus.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/proving-system/data-bus.md rename to docs/docs/_protocol-specs/cryptography/proving-system/data-bus.md diff --git a/docs/docs/protocol-specs/cryptography/proving-system/overview.md b/docs/docs/_protocol-specs/cryptography/proving-system/overview.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/proving-system/overview.md rename to docs/docs/_protocol-specs/cryptography/proving-system/overview.md diff --git a/docs/docs/protocol-specs/cryptography/proving-system/performance-targets.md b/docs/docs/_protocol-specs/cryptography/proving-system/performance-targets.md similarity index 100% rename from docs/docs/protocol-specs/cryptography/proving-system/performance-targets.md rename to docs/docs/_protocol-specs/cryptography/proving-system/performance-targets.md diff --git a/docs/docs/protocol-specs/data-publication-and-availability/index.md b/docs/docs/_protocol-specs/data-publication-and-availability/index.md similarity index 100% rename from docs/docs/protocol-specs/data-publication-and-availability/index.md rename to docs/docs/_protocol-specs/data-publication-and-availability/index.md diff --git a/docs/docs/protocol-specs/data-publication-and-availability/overview.md b/docs/docs/_protocol-specs/data-publication-and-availability/overview.md similarity index 100% rename from docs/docs/protocol-specs/data-publication-and-availability/overview.md rename to docs/docs/_protocol-specs/data-publication-and-availability/overview.md diff --git a/docs/docs/protocol-specs/data-publication-and-availability/published-data.md b/docs/docs/_protocol-specs/data-publication-and-availability/published-data.md similarity index 100% rename from docs/docs/protocol-specs/data-publication-and-availability/published-data.md rename to docs/docs/_protocol-specs/data-publication-and-availability/published-data.md diff --git a/docs/docs/protocol-specs/decentralization/actors.md b/docs/docs/_protocol-specs/decentralization/actors.md similarity index 100% rename from docs/docs/protocol-specs/decentralization/actors.md rename to docs/docs/_protocol-specs/decentralization/actors.md diff --git a/docs/docs/protocol-specs/decentralization/block-production.md b/docs/docs/_protocol-specs/decentralization/block-production.md similarity index 100% rename from docs/docs/protocol-specs/decentralization/block-production.md rename to docs/docs/_protocol-specs/decentralization/block-production.md diff --git a/docs/docs/protocol-specs/decentralization/governance.md b/docs/docs/_protocol-specs/decentralization/governance.md similarity index 100% rename from docs/docs/protocol-specs/decentralization/governance.md rename to docs/docs/_protocol-specs/decentralization/governance.md diff --git a/docs/docs/protocol-specs/decentralization/p2p-network.md b/docs/docs/_protocol-specs/decentralization/p2p-network.md similarity index 100% rename from docs/docs/protocol-specs/decentralization/p2p-network.md rename to docs/docs/_protocol-specs/decentralization/p2p-network.md diff --git a/docs/docs/protocol-specs/gas-and-fees/fee-juice.md b/docs/docs/_protocol-specs/gas-and-fees/fee-juice.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/fee-juice.md rename to docs/docs/_protocol-specs/gas-and-fees/fee-juice.md diff --git a/docs/docs/protocol-specs/gas-and-fees/fee-schedule.md b/docs/docs/_protocol-specs/gas-and-fees/fee-schedule.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/fee-schedule.md rename to docs/docs/_protocol-specs/gas-and-fees/fee-schedule.md diff --git a/docs/docs/protocol-specs/gas-and-fees/index.md b/docs/docs/_protocol-specs/gas-and-fees/index.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/index.md rename to docs/docs/_protocol-specs/gas-and-fees/index.md diff --git a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md b/docs/docs/_protocol-specs/gas-and-fees/kernel-tracking.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md rename to docs/docs/_protocol-specs/gas-and-fees/kernel-tracking.md diff --git a/docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md b/docs/docs/_protocol-specs/gas-and-fees/published-gas-and-fee-data.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md rename to docs/docs/_protocol-specs/gas-and-fees/published-gas-and-fee-data.md diff --git a/docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md b/docs/docs/_protocol-specs/gas-and-fees/specifying-gas-fee-info.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md rename to docs/docs/_protocol-specs/gas-and-fees/specifying-gas-fee-info.md diff --git a/docs/docs/protocol-specs/gas-and-fees/tx-setup-and-teardown.md b/docs/docs/_protocol-specs/gas-and-fees/tx-setup-and-teardown.md similarity index 100% rename from docs/docs/protocol-specs/gas-and-fees/tx-setup-and-teardown.md rename to docs/docs/_protocol-specs/gas-and-fees/tx-setup-and-teardown.md diff --git a/docs/docs/protocol-specs/intro.md b/docs/docs/_protocol-specs/intro.md similarity index 100% rename from docs/docs/protocol-specs/intro.md rename to docs/docs/_protocol-specs/intro.md diff --git a/docs/docs/protocol-specs/l1-smart-contracts/frontier.md b/docs/docs/_protocol-specs/l1-smart-contracts/frontier.md similarity index 100% rename from docs/docs/protocol-specs/l1-smart-contracts/frontier.md rename to docs/docs/_protocol-specs/l1-smart-contracts/frontier.md diff --git a/docs/docs/protocol-specs/l1-smart-contracts/index.md b/docs/docs/_protocol-specs/l1-smart-contracts/index.md similarity index 100% rename from docs/docs/protocol-specs/l1-smart-contracts/index.md rename to docs/docs/_protocol-specs/l1-smart-contracts/index.md diff --git a/docs/docs/protocol-specs/logs/index.md b/docs/docs/_protocol-specs/logs/index.md similarity index 100% rename from docs/docs/protocol-specs/logs/index.md rename to docs/docs/_protocol-specs/logs/index.md diff --git a/docs/docs/protocol-specs/pre-compiled-contracts/index.md b/docs/docs/_protocol-specs/pre-compiled-contracts/index.md similarity index 100% rename from docs/docs/protocol-specs/pre-compiled-contracts/index.md rename to docs/docs/_protocol-specs/pre-compiled-contracts/index.md diff --git a/docs/docs/protocol-specs/pre-compiled-contracts/registry.md b/docs/docs/_protocol-specs/pre-compiled-contracts/registry.md similarity index 100% rename from docs/docs/protocol-specs/pre-compiled-contracts/registry.md rename to docs/docs/_protocol-specs/pre-compiled-contracts/registry.md diff --git a/docs/docs/protocol-specs/private-message-delivery/index.md b/docs/docs/_protocol-specs/private-message-delivery/index.md similarity index 100% rename from docs/docs/protocol-specs/private-message-delivery/index.md rename to docs/docs/_protocol-specs/private-message-delivery/index.md diff --git a/docs/docs/protocol-specs/private-message-delivery/private-msg-delivery.md b/docs/docs/_protocol-specs/private-message-delivery/private-msg-delivery.md similarity index 100% rename from docs/docs/protocol-specs/private-message-delivery/private-msg-delivery.md rename to docs/docs/_protocol-specs/private-message-delivery/private-msg-delivery.md diff --git a/docs/docs/protocol-specs/private-message-delivery/send-note-guidelines.md b/docs/docs/_protocol-specs/private-message-delivery/send-note-guidelines.md similarity index 100% rename from docs/docs/protocol-specs/private-message-delivery/send-note-guidelines.md rename to docs/docs/_protocol-specs/private-message-delivery/send-note-guidelines.md diff --git a/docs/docs/protocol-specs/public-vm/_nested-context.md b/docs/docs/_protocol-specs/public-vm/_nested-context.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/_nested-context.md rename to docs/docs/_protocol-specs/public-vm/_nested-context.md diff --git a/docs/docs/protocol-specs/public-vm/alu.md b/docs/docs/_protocol-specs/public-vm/alu.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/alu.md rename to docs/docs/_protocol-specs/public-vm/alu.md diff --git a/docs/docs/protocol-specs/public-vm/avm-circuit.md b/docs/docs/_protocol-specs/public-vm/avm-circuit.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/avm-circuit.md rename to docs/docs/_protocol-specs/public-vm/avm-circuit.md diff --git a/docs/docs/protocol-specs/public-vm/bytecode-validation-circuit.md b/docs/docs/_protocol-specs/public-vm/bytecode-validation-circuit.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/bytecode-validation-circuit.md rename to docs/docs/_protocol-specs/public-vm/bytecode-validation-circuit.md diff --git a/docs/docs/protocol-specs/public-vm/circuit-index.md b/docs/docs/_protocol-specs/public-vm/circuit-index.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/circuit-index.md rename to docs/docs/_protocol-specs/public-vm/circuit-index.md diff --git a/docs/docs/protocol-specs/public-vm/context.mdx b/docs/docs/_protocol-specs/public-vm/context.mdx similarity index 100% rename from docs/docs/protocol-specs/public-vm/context.mdx rename to docs/docs/_protocol-specs/public-vm/context.mdx diff --git a/docs/docs/protocol-specs/public-vm/control-flow.md b/docs/docs/_protocol-specs/public-vm/control-flow.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/control-flow.md rename to docs/docs/_protocol-specs/public-vm/control-flow.md diff --git a/docs/docs/protocol-specs/public-vm/execution.md b/docs/docs/_protocol-specs/public-vm/execution.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/execution.md rename to docs/docs/_protocol-specs/public-vm/execution.md diff --git a/docs/docs/_protocol-specs/public-vm/gen/_instruction-set.mdx b/docs/docs/_protocol-specs/public-vm/gen/_instruction-set.mdx new file mode 100644 index 00000000000..b7de3caf134 --- /dev/null +++ b/docs/docs/_protocol-specs/public-vm/gen/_instruction-set.mdx @@ -0,0 +1,1603 @@ +[comment]: # (THIS IS A GENERATED FILE! DO NOT EDIT!) +[comment]: # (Generated via `yarn preprocess`) + +[comment]: # (Generated by genMarkdown.js, InstructionSet.js, InstructionSize.js) + +import Markdown from 'react-markdown' +import CodeBlock from '@theme/CodeBlock' + + +## Instructions Table + +Click on an instruction name to jump to its section. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OpcodeNameSummaryExpression
0x00\[\`ADD\`\](#isa-section-add)Addition (a + b){ + `M[dstOffset] = M[aOffset] + M[bOffset] mod 2^k` + }
0x01\[\`SUB\`\](#isa-section-sub)Subtraction (a - b){ + `M[dstOffset] = M[aOffset] - M[bOffset] mod 2^k` + }
0x02\[\`MUL\`\](#isa-section-mul)Multiplication (a * b){ + `M[dstOffset] = M[aOffset] * M[bOffset] mod 2^k` + }
0x03\[\`DIV\`\](#isa-section-div)Unsigned integer division (a / b){ + `M[dstOffset] = M[aOffset] / M[bOffset]` + }
0x04\[\`FDIV\`\](#isa-section-fdiv)Field division (a / b){ + `M[dstOffset] = M[aOffset] / M[bOffset]` + }
0x05\[\`EQ\`\](#isa-section-eq)Equality check (a == b){ + `M[dstOffset] = M[aOffset] == M[bOffset] ? 1 : 0` + }
0x06\[\`LT\`\](#isa-section-lt)Less-than check (a < b){ + `M[dstOffset] = M[aOffset] < M[bOffset] ? 1 : 0` + }
0x07\[\`LTE\`\](#isa-section-lte)Less-than-or-equals check (a <= b){ + `M[dstOffset] = M[aOffset] <= M[bOffset] ? 1 : 0` + }
0x08\[\`AND\`\](#isa-section-and)Bitwise AND (a & b){ + `M[dstOffset] = M[aOffset] AND M[bOffset]` + }
0x09\[\`OR\`\](#isa-section-or)Bitwise OR (a | b){ + `M[dstOffset] = M[aOffset] OR M[bOffset]` + }
0x0a\[\`XOR\`\](#isa-section-xor)Bitwise XOR (a ^ b){ + `M[dstOffset] = M[aOffset] XOR M[bOffset]` + }
0x0b\[\`NOT\`\](#isa-section-not)Bitwise NOT (inversion){ + `M[dstOffset] = NOT M[aOffset]` + }
0x0c\[\`SHL\`\](#isa-section-shl)Bitwise leftward shift (a << b){ + `M[dstOffset] = M[aOffset] << M[bOffset]` + }
0x0d\[\`SHR\`\](#isa-section-shr)Bitwise rightward shift (a >> b){ + `M[dstOffset] = M[aOffset] >> M[bOffset]` + }
0x0e\[\`CAST\`\](#isa-section-cast)Type cast{ + `M[dstOffset] = cast(M[aOffset])` + }
0x0f\[\`ADDRESS\`\](#isa-section-address)Get the address of the currently executing l2 contract{ + `M[dstOffset] = context.environment.address` + }
0x10\[\`SENDER\`\](#isa-section-sender)Get the address of the sender (caller of the current context){ + `M[dstOffset] = context.environment.sender` + }
0x11\[\`TRANSACTIONFEE\`\](#isa-section-transactionfee)Get the computed transaction fee during teardown phase, zero otherwise{ + `M[dstOffset] = context.environment.transactionFee` + }
0x12\[\`CHAINID\`\](#isa-section-chainid)Get this rollup's L1 chain ID{ + `M[dstOffset] = context.environment.globals.chainId` + }
0x13\[\`VERSION\`\](#isa-section-version)Get this rollup's L2 version ID{ + `M[dstOffset] = context.environment.globals.version` + }
0x14\[\`BLOCKNUMBER\`\](#isa-section-blocknumber)Get this L2 block's number{ + `M[dstOffset] = context.environment.globals.blocknumber` + }
0x15\[\`TIMESTAMP\`\](#isa-section-timestamp)Get this L2 block's timestamp{ + `M[dstOffset] = context.environment.globals.timestamp` + }
0x16\[\`FEEPERL2GAS\`\](#isa-section-feeperl2gas)Get the fee to be paid per "L2 gas" - constant for entire transaction{ + `M[dstOffset] = context.environment.globals.feePerL2Gas` + }
0x17\[\`FEEPERDAGAS\`\](#isa-section-feeperdagas)Get the fee to be paid per "DA gas" - constant for entire transaction{ + `M[dstOffset] = context.environment.globals.feePerDaGas` + }
0x18\[\`CALLDATACOPY\`\](#isa-section-calldatacopy)Copy calldata into memory{ + `M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]` + }
0x19\[\`L2GASLEFT\`\](#isa-section-l2gasleft)Remaining "L2 gas" for this call (after this instruction){ + `M[dstOffset] = context.MachineState.l2GasLeft` + }
0x1a\[\`DAGASLEFT\`\](#isa-section-dagasleft)Remaining "DA gas" for this call (after this instruction){ + `M[dstOffset] = context.machineState.daGasLeft` + }
0x1b\[\`JUMP\`\](#isa-section-jump)Jump to a location in the bytecode{ + `context.machineState.pc = loc` + }
0x1c\[\`JUMPI\`\](#isa-section-jumpi)Conditionally jump to a location in the bytecode{ + `context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc` + }
0x1d\[\`INTERNALCALL\`\](#isa-section-internalcall)Make an internal call. Push the current PC to the internal call stack and jump to the target location. +{`context.machineState.internalCallStack.push(context.machineState.pc) +context.machineState.pc = loc`} +
0x1e\[\`INTERNALRETURN\`\](#isa-section-internalreturn)Return from an internal call. Pop from the internal call stack and jump to the popped location.{ + `context.machineState.pc = context.machineState.internalCallStack.pop()` + }
0x1f\[\`SET\`\](#isa-section-set)Set a memory word from a constant in the bytecode{ + `M[dstOffset] = const` + }
0x20\[\`MOV\`\](#isa-section-mov)Move a word from source memory location to destination{ + `M[dstOffset] = M[srcOffset]` + }
0x21\[\`CMOV\`\](#isa-section-cmov)Move a word (conditionally chosen) from one memory location to another (`d = cond > 0 ? a : b`){ + `M[dstOffset] = M[condOffset] > 0 ? M[aOffset] : M[bOffset]` + }
0x22\[\`SLOAD\`\](#isa-section-sload)Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots. +{`M[dstOffset] = S[M[slotOffset]]`} +
0x23\[\`SSTORE\`\](#isa-section-sstore)Write a word to this contract's persistent public storage +{`S[M[slotOffset]] = M[srcOffset]`} +
0x24\[\`NOTEHASHEXISTS\`\](#isa-section-notehashexists)Check whether a note hash exists in the note hash tree (as of the start of the current block) +{`exists = context.worldState.noteHashes.has({ + leafIndex: M[leafIndexOffset] + leaf: hash(context.environment.address, M[noteHashOffset]), +}) +M[existsOffset] = exists`} +
0x25\[\`EMITNOTEHASH\`\](#isa-section-emitnotehash)Emit a new note hash to be inserted into the note hash tree +{`context.worldState.noteHashes.append( + hash(context.environment.address, M[noteHashOffset]) +)`} +
0x26\[\`NULLIFIEREXISTS\`\](#isa-section-nullifierexists)Check whether a nullifier exists in the nullifier tree (including nullifiers from earlier in the current transaction or from earlier in the current block) +{`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( + hash(M[addressOffset], M[nullifierOffset]) +) +M[existsOffset] = exists`} +
0x27\[\`EMITNULLIFIER\`\](#isa-section-emitnullifier)Emit a new nullifier to be inserted into the nullifier tree +{`context.worldState.nullifiers.append( + hash(context.environment.address, M[nullifierOffset]) +)`} +
0x28\[\`L1TOL2MSGEXISTS\`\](#isa-section-l1tol2msgexists)Check if a message exists in the L1-to-L2 message tree +{`exists = context.worldState.l1ToL2Messages.has({ + leafIndex: M[msgLeafIndexOffset], leaf: M[msgHashOffset] +}) +M[existsOffset] = exists`} +
0x29\[\`GETCONTRACTINSTANCE\`\](#isa-section-getcontractinstance)Copies contract instance data to memory +{`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ + instance_found_in_address, + instance.salt ?? 0, + instance.deployer ?? 0, + instance.contractClassId ?? 0, + instance.initializationHash ?? 0, + instance.portalContractAddress ?? 0, + instance.publicKeysHash ?? 0, +]`} +
0x2a\[\`EMITUNENCRYPTEDLOG\`\](#isa-section-emitunencryptedlog)Emit an unencrypted log +{`context.accruedSubstate.unencryptedLogs.append( + UnencryptedLog { + address: context.environment.address, + log: M[logOffset:logOffset+M[logSizeOffset]], + } +)`} +
0x2b\[\`SENDL2TOL1MSG\`\](#isa-section-sendl2tol1msg)Send an L2-to-L1 message +{`context.accruedSubstate.sentL2ToL1Messages.append( + SentL2ToL1Message { + address: context.environment.address, + recipient: M[recipientOffset], + message: M[contentOffset] + } +)`} +
0x2c\[\`CALL\`\](#isa-section-call)Call into another contract +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +chargeGas(context, + l2GasCost=M[instr.args.gasOffset], + daGasCost=M[instr.args.gasOffset+1]) +traceNestedCall(context, instr.args.addrOffset) +nestedContext = deriveContext(context, instr.args, isStaticCall=false) +execute(nestedContext) +updateContextAfterNestedCall(context, instr.args, nestedContext)`} +
0x2d\[\`STATICCALL\`\](#isa-section-staticcall)Call into another contract, disallowing World State and Accrued Substate modifications +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +chargeGas(context, + l2GasCost=M[instr.args.gasOffset], + daGasCost=M[instr.args.gasOffset+1]) +traceNestedCall(context, instr.args.addrOffset) +nestedContext = deriveContext(context, instr.args, isStaticCall=true +execute(nestedContext) +updateContextAfterNestedCall(context, instr.args, nestedContext)`} +
0x2e\[\`RETURN\`\](#isa-section-return)Halt execution within this context (without revert), optionally returning some data +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] +halt`} +
0x2f\[\`REVERT\`\](#isa-section-revert)Halt execution within this context as `reverted`, optionally returning some data +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] +context.contractCallResults.reverted = true +halt`} +
0x30\[\`TORADIXLE\`\](#isa-section-to_radix_le)Convert a word to an array of limbs in little-endian radix formTBD: Storage of limbs and if T[dstOffset] is constrained to U8
+ + +## Instructions + +###
`ADD` +Addition (a + b) + +[See in table.](#isa-table-add) + +- **Opcode**: 0x00 +- **Category**: Compute - Arithmetic +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] + M[bOffset] mod 2^k` +- **Details**: Wraps on overflow +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/ADD.png)](/img/protocol-specs/public-vm/bit-formats/ADD.png) + +### `SUB` +Subtraction (a - b) + +[See in table.](#isa-table-sub) + +- **Opcode**: 0x01 +- **Category**: Compute - Arithmetic +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] - M[bOffset] mod 2^k` +- **Details**: Wraps on undeflow +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/SUB.png)](/img/protocol-specs/public-vm/bit-formats/SUB.png) + +### `MUL` +Multiplication (a * b) + +[See in table.](#isa-table-mul) + +- **Opcode**: 0x02 +- **Category**: Compute - Arithmetic +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] * M[bOffset] mod 2^k` +- **Details**: Wraps on overflow +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/MUL.png)](/img/protocol-specs/public-vm/bit-formats/MUL.png) + +### `DIV` +Unsigned integer division (a / b) + +[See in table.](#isa-table-div) + +- **Opcode**: 0x03 +- **Category**: Compute - Arithmetic +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] / M[bOffset]` +- **Details**: If the input is a field, it will be interpreted as an integer +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/DIV.png)](/img/protocol-specs/public-vm/bit-formats/DIV.png) + +### `FDIV` +Field division (a / b) + +[See in table.](#isa-table-fdiv) + +- **Opcode**: 0x04 +- **Category**: Compute - Arithmetic +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] / M[bOffset]` +- **Tag checks**: `T[aOffset] == T[bOffset] == field` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 120 + + +### `EQ` +Equality check (a \=\= b) + +[See in table.](#isa-table-eq) + +- **Opcode**: 0x05 +- **Category**: Compute - Comparators +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] == M[bOffset] ? 1 : 0` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = u8` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/EQ.png)](/img/protocol-specs/public-vm/bit-formats/EQ.png) + +### `LT` +Less-than check (a \< b) + +[See in table.](#isa-table-lt) + +- **Opcode**: 0x06 +- **Category**: Compute - Comparators +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] < M[bOffset] ? 1 : 0` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = u8` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/LT.png)](/img/protocol-specs/public-vm/bit-formats/LT.png) + +### `LTE` +Less-than-or-equals check (a \<\= b) + +[See in table.](#isa-table-lte) + +- **Opcode**: 0x07 +- **Category**: Compute - Comparators +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] <= M[bOffset] ? 1 : 0` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = u8` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/LTE.png)](/img/protocol-specs/public-vm/bit-formats/LTE.png) + +### `AND` +Bitwise AND (a & b) + +[See in table.](#isa-table-and) + +- **Opcode**: 0x08 +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] AND M[bOffset]` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/AND.png)](/img/protocol-specs/public-vm/bit-formats/AND.png) + +### `OR` +Bitwise OR (a | b) + +[See in table.](#isa-table-or) + +- **Opcode**: 0x09 +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] OR M[bOffset]` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/OR.png)](/img/protocol-specs/public-vm/bit-formats/OR.png) + +### `XOR` +Bitwise XOR (a ^ b) + +[See in table.](#isa-table-xor) + +- **Opcode**: 0x0a +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] XOR M[bOffset]` +- **Tag checks**: `T[aOffset] == T[bOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/XOR.png)](/img/protocol-specs/public-vm/bit-formats/XOR.png) + +### `NOT` +Bitwise NOT (inversion) + +[See in table.](#isa-table-not) + +- **Opcode**: 0x0b +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = NOT M[aOffset]` +- **Tag checks**: `T[aOffset] == inTag` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 96 + +[![](/img/protocol-specs/public-vm/bit-formats/NOT.png)](/img/protocol-specs/public-vm/bit-formats/NOT.png) + +### `SHL` +Bitwise leftward shift (a \<\< b) + +[See in table.](#isa-table-shl) + +- **Opcode**: 0x0c +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] << M[bOffset]` +- **Tag checks**: `T[aOffset] == inTag`, `T[bOffset] == u8` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/SHL.png)](/img/protocol-specs/public-vm/bit-formats/SHL.png) + +### `SHR` +Bitwise rightward shift (a \>\> b) + +[See in table.](#isa-table-shr) + +- **Opcode**: 0x0d +- **Category**: Compute - Bitwise +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for this instruction. +- **Args**: + - **aOffset**: memory offset of the operation's left input + - **bOffset**: memory offset of the operation's right input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[aOffset] >> M[bOffset]` +- **Tag checks**: `T[aOffset] == inTag`, `T[bOffset] == u8` +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 128 + +[![](/img/protocol-specs/public-vm/bit-formats/SHR.png)](/img/protocol-specs/public-vm/bit-formats/SHR.png) + +### `CAST` +Type cast + +[See in table.](#isa-table-cast) + +- **Opcode**: 0x0e +- **Category**: Type Conversions +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **dstTag**: The [tag/size](./memory-model#tags-and-tagged-memory) to tag the destination with but not to check inputs against. +- **Args**: + - **aOffset**: memory offset of word to cast + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = cast(M[aOffset])` +- **Details**: Cast a word in memory based on the `dstTag` specified in the bytecode. Truncates (`M[dstOffset] = M[aOffset] mod 2^dstsize`) when casting to a smaller type, left-zero-pads when casting to a larger type. See [here](./memory-model#cast-and-tag-conversions) for more details. +- **Tag updates**: `T[dstOffset] = dstTag` +- **Bit-size**: 96 + +[![](/img/protocol-specs/public-vm/bit-formats/CAST.png)](/img/protocol-specs/public-vm/bit-formats/CAST.png) + +### `ADDRESS` +Get the address of the currently executing l2 contract + +[See in table.](#isa-table-address) + +- **Opcode**: 0x0f +- **Category**: Execution Environment +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.address` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png)](/img/protocol-specs/public-vm/bit-formats/ADDRESS.png) + +### `SENDER` +Get the address of the sender (caller of the current context) + +[See in table.](#isa-table-sender) + +- **Opcode**: 0x10 +- **Category**: Execution Environment +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.sender` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/SENDER.png)](/img/protocol-specs/public-vm/bit-formats/SENDER.png) + +### `TRANSACTIONFEE` +Get the computed transaction fee during teardown phase, zero otherwise + +[See in table.](#isa-table-transactionfee) + +- **Opcode**: 0x11 +- **Category**: Execution Environment +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.transactionFee` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + + +### `CHAINID` +Get this rollup's L1 chain ID + +[See in table.](#isa-table-chainid) + +- **Opcode**: 0x12 +- **Category**: Execution Environment - Globals +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.chainId` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/CHAINID.png)](/img/protocol-specs/public-vm/bit-formats/CHAINID.png) + +### `VERSION` +Get this rollup's L2 version ID + +[See in table.](#isa-table-version) + +- **Opcode**: 0x13 +- **Category**: Execution Environment - Globals +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.version` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/VERSION.png)](/img/protocol-specs/public-vm/bit-formats/VERSION.png) + +### `BLOCKNUMBER` +Get this L2 block's number + +[See in table.](#isa-table-blocknumber) + +- **Opcode**: 0x14 +- **Category**: Execution Environment - Globals +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.blocknumber` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/BLOCKNUMBER.png)](/img/protocol-specs/public-vm/bit-formats/BLOCKNUMBER.png) + +### `TIMESTAMP` +Get this L2 block's timestamp + +[See in table.](#isa-table-timestamp) + +- **Opcode**: 0x15 +- **Category**: Execution Environment - Globals +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.timestamp` +- **Tag updates**: `T[dstOffset] = u64` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/TIMESTAMP.png)](/img/protocol-specs/public-vm/bit-formats/TIMESTAMP.png) + +### `FEEPERL2GAS` +Get the fee to be paid per "L2 gas" - constant for entire transaction + +[See in table.](#isa-table-feeperl2gas) + +- **Opcode**: 0x16 +- **Category**: Execution Environment - Globals - Gas +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.feePerL2Gas` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/FEEPERL2GAS.png)](/img/protocol-specs/public-vm/bit-formats/FEEPERL2GAS.png) + +### `FEEPERDAGAS` +Get the fee to be paid per "DA gas" - constant for entire transaction + +[See in table.](#isa-table-feeperdagas) + +- **Opcode**: 0x17 +- **Category**: Execution Environment - Globals - Gas +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.environment.globals.feePerDaGas` +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/FEEPERDAGAS.png)](/img/protocol-specs/public-vm/bit-formats/FEEPERDAGAS.png) + +### `CALLDATACOPY` +Copy calldata into memory + +[See in table.](#isa-table-calldatacopy) + +- **Opcode**: 0x18 +- **Category**: Execution Environment - Calldata +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **cdOffset**: offset into calldata to copy from + - **copySize**: number of words to copy + - **dstOffset**: memory offset specifying where to copy the first word to +- **Expression**: `M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]` +- **Details**: Calldata is read-only and cannot be directly operated on by other instructions. This instruction moves words from calldata into memory so they can be operated on normally. +- **Tag updates**: `T[dstOffset:dstOffset+copySize] = field` +- **Bit-size**: 120 + +[![](/img/protocol-specs/public-vm/bit-formats/CALLDATACOPY.png)](/img/protocol-specs/public-vm/bit-formats/CALLDATACOPY.png) + +### `L2GASLEFT` +Remaining "L2 gas" for this call (after this instruction) + +[See in table.](#isa-table-l2gasleft) + +- **Opcode**: 0x19 +- **Category**: Machine State - Gas +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.MachineState.l2GasLeft` +- **Tag updates**: `T[dstOffset] = u32` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/L2GASLEFT.png)](/img/protocol-specs/public-vm/bit-formats/L2GASLEFT.png) + +### `DAGASLEFT` +Remaining "DA gas" for this call (after this instruction) + +[See in table.](#isa-table-dagasleft) + +- **Opcode**: 0x1a +- **Category**: Machine State - Gas +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = context.machineState.daGasLeft` +- **Tag updates**: `T[dstOffset] = u32` +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/DAGASLEFT.png)](/img/protocol-specs/public-vm/bit-formats/DAGASLEFT.png) + +### `JUMP` +Jump to a location in the bytecode + +[See in table.](#isa-table-jump) + +- **Opcode**: 0x1b +- **Category**: Machine State - Control Flow +- **Args**: + - **loc**: target location to jump to +- **Expression**: `context.machineState.pc = loc` +- **Details**: Target location is an immediate value (a constant in the bytecode). +- **Bit-size**: 48 + +[![](/img/protocol-specs/public-vm/bit-formats/JUMP.png)](/img/protocol-specs/public-vm/bit-formats/JUMP.png) + +### `JUMPI` +Conditionally jump to a location in the bytecode + +[See in table.](#isa-table-jumpi) + +- **Opcode**: 0x1c +- **Category**: Machine State - Control Flow +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **loc**: target location conditionally jump to + - **condOffset**: memory offset of the operations 'conditional' input +- **Expression**: `context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc` +- **Details**: Target location is an immediate value (a constant in the bytecode). `T[condOffset]` is not checked because the greater-than-zero suboperation is the same regardless of type. +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/JUMPI.png)](/img/protocol-specs/public-vm/bit-formats/JUMPI.png) + +### `INTERNALCALL` +Make an internal call. Push the current PC to the internal call stack and jump to the target location. + +[See in table.](#isa-table-internalcall) + +- **Opcode**: 0x1d +- **Category**: Machine State - Control Flow +- **Args**: + - **loc**: target location to jump/call to +- **Expression**: + +{`context.machineState.internalCallStack.push(context.machineState.pc) +context.machineState.pc = loc`} + +- **Details**: Target location is an immediate value (a constant in the bytecode). +- **Bit-size**: 48 + + +### `INTERNALRETURN` +Return from an internal call. Pop from the internal call stack and jump to the popped location. + +[See in table.](#isa-table-internalreturn) + +- **Opcode**: 0x1e +- **Category**: Machine State - Control Flow +- **Expression**: `context.machineState.pc = context.machineState.internalCallStack.pop()` +- **Bit-size**: 16 + +[![](/img/protocol-specs/public-vm/bit-formats/INTERNALRETURN.png)](/img/protocol-specs/public-vm/bit-formats/INTERNALRETURN.png) + +### `SET` +Set a memory word from a constant in the bytecode + +[See in table.](#isa-table-set) + +- **Opcode**: 0x1f +- **Category**: Machine State - Memory +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. + - **inTag**: The [type/size](./memory-model#tags-and-tagged-memory) to check inputs against and tag the destination with. `field` type is NOT supported for SET. +- **Args**: + - **const**: an N-bit constant value from the bytecode to store in memory (any type except `field`) + - **dstOffset**: memory offset specifying where to store the constant +- **Expression**: `M[dstOffset] = const` +- **Details**: Set memory word at `dstOffset` to `const`'s immediate value. `const`'s bit-size (N) can be 8, 16, 32, 64, or 128 based on `inTag`. It _cannot be 254 (`field` type)_! +- **Tag updates**: `T[dstOffset] = inTag` +- **Bit-size**: 64+N + +[![](/img/protocol-specs/public-vm/bit-formats/SET.png)](/img/protocol-specs/public-vm/bit-formats/SET.png) + +### `MOV` +Move a word from source memory location to destination + +[See in table.](#isa-table-mov) + +- **Opcode**: 0x20 +- **Category**: Machine State - Memory +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of word to move + - **dstOffset**: memory offset specifying where to store that word +- **Expression**: `M[dstOffset] = M[srcOffset]` +- **Tag updates**: `T[dstOffset] = T[srcOffset]` +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/MOV.png)](/img/protocol-specs/public-vm/bit-formats/MOV.png) + +### `CMOV` +Move a word (conditionally chosen) from one memory location to another (`d \= cond \> 0 ? a : b`) + +[See in table.](#isa-table-cmov) + +- **Opcode**: 0x21 +- **Category**: Machine State - Memory +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **aOffset**: memory offset of word 'a' to conditionally move + - **bOffset**: memory offset of word 'b' to conditionally move + - **condOffset**: memory offset of the operations 'conditional' input + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: `M[dstOffset] = M[condOffset] > 0 ? M[aOffset] : M[bOffset]` +- **Details**: One of two source memory locations is chosen based on the condition. `T[condOffset]` is not checked because the greater-than-zero suboperation is the same regardless of type. +- **Tag updates**: `T[dstOffset] = M[condOffset] > 0 ? T[aOffset] : T[bOffset]` +- **Bit-size**: 152 + +[![](/img/protocol-specs/public-vm/bit-formats/CMOV.png)](/img/protocol-specs/public-vm/bit-formats/CMOV.png) + +### `SLOAD` +Load a word from this contract's persistent public storage. Zero is loaded for unwritten slots. + +[See in table.](#isa-table-sload) + +- **Opcode**: 0x22 +- **Category**: World State - Public Storage +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **slotOffset**: memory offset of the storage slot to load from + - **dstOffset**: memory offset specifying where to store operation's result +- **Expression**: + +{`M[dstOffset] = S[M[slotOffset]]`} + +- **Details**: + +{`// Expression is shorthand for +leafIndex = hash(context.environment.address, M[slotOffset]) +exists = context.worldState.publicStorage.has(leafIndex) // exists == previously-written +if exists: + value = context.worldState.publicStorage.get(leafIndex: leafIndex) +else: + value = 0 +M[dstOffset] = value`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.publicStorageReads.append( + TracedStorageRead { + callPointer: context.environment.callPointer, + slot: M[slotOffset], + exists: exists, // defined above + value: value, // defined above + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Storage slot siloing (hash with contract address), public data tree membership check +- **Tag updates**: `T[dstOffset] = field` +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/SLOAD.png)](/img/protocol-specs/public-vm/bit-formats/SLOAD.png) + +### `SSTORE` +Write a word to this contract's persistent public storage + +[See in table.](#isa-table-sstore) + +- **Opcode**: 0x23 +- **Category**: World State - Public Storage +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of the word to store + - **slotOffset**: memory offset containing the storage slot to store to +- **Expression**: + +{`S[M[slotOffset]] = M[srcOffset]`} + +- **Details**: + +{`// Expression is shorthand for +context.worldState.publicStorage.set({ + leafIndex: hash(context.environment.address, M[slotOffset]), + leaf: M[srcOffset], +})`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.publicStorageWrites.append( + TracedStorageWrite { + callPointer: context.environment.callPointer, + slot: M[slotOffset], + value: M[srcOffset], + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Storage slot siloing (hash with contract address), public data tree update +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/SSTORE.png)](/img/protocol-specs/public-vm/bit-formats/SSTORE.png) + +### `NOTEHASHEXISTS` +Check whether a note hash exists in the note hash tree (as of the start of the current block) + +[See in table.](#isa-table-notehashexists) + +- **Opcode**: 0x24 +- **Category**: World State - Notes & Nullifiers +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **noteHashOffset**: memory offset of the note hash + - **leafIndexOffset**: memory offset of the leaf index + - **existsOffset**: memory offset specifying where to store operation's result (whether the note hash leaf exists) +- **Expression**: + +{`exists = context.worldState.noteHashes.has({ + leafIndex: M[leafIndexOffset] + leaf: hash(context.environment.address, M[noteHashOffset]), +}) +M[existsOffset] = exists`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.noteHashChecks.append( + TracedNoteHashCheck { + callPointer: context.environment.callPointer, + leafIndex: M[leafIndexOffset] + noteHash: M[noteHashOffset], + exists: exists, // defined above + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Note hash siloing (hash with storage contract address), note hash tree membership check +- **Tag updates**: `T[existsOffset] = u8` +- **Bit-size**: 120 + + +### `EMITNOTEHASH` +Emit a new note hash to be inserted into the note hash tree + +[See in table.](#isa-table-emitnotehash) + +- **Opcode**: 0x25 +- **Category**: World State - Notes & Nullifiers +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **noteHashOffset**: memory offset of the note hash +- **Expression**: + +{`context.worldState.noteHashes.append( + hash(context.environment.address, M[noteHashOffset]) +)`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.noteHashes.append( + TracedNoteHash { + callPointer: context.environment.callPointer, + noteHash: M[noteHashOffset], // unsiloed note hash + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Note hash siloing (hash with contract address), note hash tree insertion. +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/EMITNOTEHASH.png)](/img/protocol-specs/public-vm/bit-formats/EMITNOTEHASH.png) + +### `NULLIFIEREXISTS` +Check whether a nullifier exists in the nullifier tree (including nullifiers from earlier in the current transaction or from earlier in the current block) + +[See in table.](#isa-table-nullifierexists) + +- **Opcode**: 0x26 +- **Category**: World State - Notes & Nullifiers +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **nullifierOffset**: memory offset of the unsiloed nullifier + - **addressOffset**: memory offset of the storage address + - **existsOffset**: memory offset specifying where to store operation's result (whether the nullifier exists) +- **Expression**: + +{`exists = pendingNullifiers.has(M[addressOffset], M[nullifierOffset]) || context.worldState.nullifiers.has( + hash(M[addressOffset], M[nullifierOffset]) +) +M[existsOffset] = exists`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.nullifierChecks.append( + TracedNullifierCheck { + callPointer: context.environment.callPointer, + nullifier: M[nullifierOffset], + address: M[addressOffset], + exists: exists, // defined above + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Nullifier siloing (hash with storage contract address), nullifier tree membership check +- **Tag updates**: `T[existsOffset] = u8` +- **Bit-size**: 120 + + +### `EMITNULLIFIER` +Emit a new nullifier to be inserted into the nullifier tree + +[See in table.](#isa-table-emitnullifier) + +- **Opcode**: 0x27 +- **Category**: World State - Notes & Nullifiers +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **nullifierOffset**: memory offset of nullifier +- **Expression**: + +{`context.worldState.nullifiers.append( + hash(context.environment.address, M[nullifierOffset]) +)`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.nullifiers.append( + TracedNullifier { + callPointer: context.environment.callPointer, + nullifier: M[nullifierOffset], // unsiloed nullifier + counter: ++context.worldStateAccessTrace.accessCounter, + } +)`} + +- **Triggers downstream circuit operations**: Nullifier siloing (hash with contract address), nullifier tree non-membership-check and insertion. +- **Bit-size**: 56 + +[![](/img/protocol-specs/public-vm/bit-formats/EMITNULLIFIER.png)](/img/protocol-specs/public-vm/bit-formats/EMITNULLIFIER.png) + +### `L1TOL2MSGEXISTS` +Check if a message exists in the L1-to-L2 message tree + +[See in table.](#isa-table-l1tol2msgexists) + +- **Opcode**: 0x28 +- **Category**: World State - Messaging +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **msgHashOffset**: memory offset of the message hash + - **msgLeafIndexOffset**: memory offset of the message's leaf index in the L1-to-L2 message tree + - **existsOffset**: memory offset specifying where to store operation's result (whether the message exists in the L1-to-L2 message tree) +- **Expression**: + +{`exists = context.worldState.l1ToL2Messages.has({ + leafIndex: M[msgLeafIndexOffset], leaf: M[msgHashOffset] +}) +M[existsOffset] = exists`} + +- **World State access tracing**: + +{`context.worldStateAccessTrace.l1ToL2MessagesChecks.append( + L1ToL2Message { + callPointer: context.environment.callPointer, + leafIndex: M[msgLeafIndexOffset], + msgHash: M[msgHashOffset], + exists: exists, // defined above + } +)`} + +- **Triggers downstream circuit operations**: L1-to-L2 message tree membership check +- **Tag updates**: + +{`T[existsOffset] = u8,`} + +- **Bit-size**: 120 + + +### `GETCONTRACTINSTANCE` +Copies contract instance data to memory + +[See in table.](#isa-table-getcontractinstance) + +- **Opcode**: 0x29 +- **Category**: Other +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **addressOffset**: memory offset of the contract instance address + - **dstOffset**: location to write the contract instance information to +- **Expression**: + +{`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [ + instance_found_in_address, + instance.salt ?? 0, + instance.deployer ?? 0, + instance.contractClassId ?? 0, + instance.initializationHash ?? 0, + instance.portalContractAddress ?? 0, + instance.publicKeysHash ?? 0, +]`} + +- **Additional AVM circuit checks**: TO-DO +- **Triggers downstream circuit operations**: TO-DO +- **Tag updates**: T[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = field +- **Bit-size**: 88 + + +### `EMITUNENCRYPTEDLOG` +Emit an unencrypted log + +[See in table.](#isa-table-emitunencryptedlog) + +- **Opcode**: 0x2a +- **Category**: Accrued Substate - Logging +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **logOffset**: memory offset of the data to log + - **logSizeOffset**: memory offset to number of words to log +- **Expression**: + +{`context.accruedSubstate.unencryptedLogs.append( + UnencryptedLog { + address: context.environment.address, + log: M[logOffset:logOffset+M[logSizeOffset]], + } +)`} + +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/EMITUNENCRYPTEDLOG.png)](/img/protocol-specs/public-vm/bit-formats/EMITUNENCRYPTEDLOG.png) + +### `SENDL2TOL1MSG` +Send an L2-to-L1 message + +[See in table.](#isa-table-sendl2tol1msg) + +- **Opcode**: 0x2b +- **Category**: Accrued Substate - Messaging +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **recipientOffset**: memory offset of the message recipient + - **contentOffset**: memory offset of the message content +- **Expression**: + +{`context.accruedSubstate.sentL2ToL1Messages.append( + SentL2ToL1Message { + address: context.environment.address, + recipient: M[recipientOffset], + message: M[contentOffset] + } +)`} + +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/SENDL2TOL1MSG.png)](/img/protocol-specs/public-vm/bit-formats/SENDL2TOL1MSG.png) + +### `CALL` +Call into another contract + +[See in table.](#isa-table-call) + +- **Opcode**: 0x2c +- **Category**: Control Flow - Contract Calls +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee + - **addrOffset**: address of the contract to call + - **argsOffset**: memory offset to args (will become the callee's calldata) + - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata + - **retOffset**: destination memory offset specifying where to store the data returned from the callee + - **retSize**: number of words to copy from data returned by callee + - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) +- **Expression**: + +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +chargeGas(context, + l2GasCost=M[instr.args.gasOffset], + daGasCost=M[instr.args.gasOffset+1]) +traceNestedCall(context, instr.args.addrOffset) +nestedContext = deriveContext(context, instr.args, isStaticCall=false) +execute(nestedContext) +updateContextAfterNestedCall(context, instr.args, nestedContext)`} + +- **Details**: Creates a new (nested) execution context and triggers execution within that context. + Execution proceeds in the nested context until it reaches a halt at which point + execution resumes in the current/calling context. + A non-existent contract or one with no code will return success. + ["Nested contract calls"](./nested-calls) provides a full explanation of this + instruction along with the shorthand used in the expression above. + The explanation includes details on charging gas for nested calls, + nested context derivation, world state tracing, and updating the parent context + after the nested call halts. +- **Tag checks**: `T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32` +- **Tag updates**: + +{`T[successOffset] = u8 +T[retOffset:retOffset+retSize] = field`} + +- **Bit-size**: 248 + +[![](/img/protocol-specs/public-vm/bit-formats/CALL.png)](/img/protocol-specs/public-vm/bit-formats/CALL.png) + +### `STATICCALL` +Call into another contract, disallowing World State and Accrued Substate modifications + +[See in table.](#isa-table-staticcall) + +- **Opcode**: 0x2d +- **Category**: Control Flow - Contract Calls +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **gasOffset**: offset to two words containing `{l2GasLeft, daGasLeft}`: amount of gas to provide to the callee + - **addrOffset**: address of the contract to call + - **argsOffset**: memory offset to args (will become the callee's calldata) + - **argsSizeOffset**: memory offset for the number of words to pass via callee's calldata + - **retOffset**: destination memory offset specifying where to store the data returned from the callee + - **retSize**: number of words to copy from data returned by callee + - **successOffset**: destination memory offset specifying where to store the call's success (0: failure, 1: success) +- **Expression**: + +{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize } +chargeGas(context, + l2GasCost=M[instr.args.gasOffset], + daGasCost=M[instr.args.gasOffset+1]) +traceNestedCall(context, instr.args.addrOffset) +nestedContext = deriveContext(context, instr.args, isStaticCall=true +execute(nestedContext) +updateContextAfterNestedCall(context, instr.args, nestedContext)`} + +- **Details**: Same as `CALL`, but disallows World State and Accrued Substate modifications. + ["Nested contract calls"](./nested-calls) provides a full explanation of this + instruction along with the shorthand used in the expression above. + The explanation includes details on charging gas for nested calls, + nested context derivation, world state tracing, and updating the parent context + after the nested call halts. +- **Tag checks**: `T[gasOffset] == T[gasOffset+1] == T[gasOffset+2] == u32` +- **Tag updates**: + +{`T[successOffset] = u8 +T[retOffset:retOffset+retSize] = field`} + +- **Bit-size**: 248 + +[![](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png)](/img/protocol-specs/public-vm/bit-formats/STATICCALL.png) + +### `RETURN` +Halt execution within this context (without revert), optionally returning some data + +[See in table.](#isa-table-return) + +- **Opcode**: 0x2e +- **Category**: Control Flow - Contract Calls +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **retOffset**: memory offset of first word to return + - **retSize**: number of words to return +- **Expression**: + +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] +halt`} + +- **Details**: Return control flow to the calling context/contract. Caller will accept World State and Accrued Substate modifications. See ["Halting"](./execution#halting) to learn more. See ["Nested contract calls"](./nested-calls) to see how the caller updates its context after the nested call halts. +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/RETURN.png)](/img/protocol-specs/public-vm/bit-formats/RETURN.png) + +### `REVERT` +Halt execution within this context as `reverted`, optionally returning some data + +[See in table.](#isa-table-revert) + +- **Opcode**: 0x2f +- **Category**: Control Flow - Contract Calls +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **retOffset**: memory offset of first word to return + - **retSize**: number of words to return +- **Expression**: + +{`context.contractCallResults.output = M[retOffset:retOffset+retSize] +context.contractCallResults.reverted = true +halt`} + +- **Details**: Return control flow to the calling context/contract. Caller will reject World State and Accrued Substate modifications. See ["Halting"](./execution#halting) to learn more. See ["Nested contract calls"](./nested-calls) to see how the caller updates its context after the nested call halts. +- **Bit-size**: 88 + +[![](/img/protocol-specs/public-vm/bit-formats/REVERT.png)](/img/protocol-specs/public-vm/bit-formats/REVERT.png) + +### `TORADIXLE` +Convert a word to an array of limbs in little-endian radix form + +[See in table.](#isa-table-to_radix_le) + +- **Opcode**: 0x30 +- **Category**: Conversions +- **Flags**: + - **indirect**: Toggles whether each memory-offset argument is an indirect offset. Rightmost bit corresponds to 0th offset arg, etc. Indirect offsets result in memory accesses like `M[M[offset]]` instead of the more standard `M[offset]`. +- **Args**: + - **srcOffset**: memory offset of word to convert. + - **dstOffset**: memory offset specifying where the first limb of the radix-conversion result is stored. + - **radix**: the maximum bit-size of each limb. + - **numLimbs**: the number of limbs the word will be converted into. +- **Expression**: TBD: Storage of limbs and if T[dstOffset] is constrained to U8 +- **Details**: The limbs will be stored in a contiguous memory block starting at `dstOffset`. +- **Tag checks**: `T[srcOffset] == field` +- **Bit-size**: 152 + diff --git a/docs/docs/protocol-specs/public-vm/index.md b/docs/docs/_protocol-specs/public-vm/index.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/index.md rename to docs/docs/_protocol-specs/public-vm/index.md diff --git a/docs/docs/protocol-specs/public-vm/instruction-set.mdx b/docs/docs/_protocol-specs/public-vm/instruction-set.mdx similarity index 100% rename from docs/docs/protocol-specs/public-vm/instruction-set.mdx rename to docs/docs/_protocol-specs/public-vm/instruction-set.mdx diff --git a/docs/docs/protocol-specs/public-vm/intro.md b/docs/docs/_protocol-specs/public-vm/intro.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/intro.md rename to docs/docs/_protocol-specs/public-vm/intro.md diff --git a/docs/docs/protocol-specs/public-vm/memory-model.md b/docs/docs/_protocol-specs/public-vm/memory-model.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/memory-model.md rename to docs/docs/_protocol-specs/public-vm/memory-model.md diff --git a/docs/docs/protocol-specs/public-vm/nested-calls.mdx b/docs/docs/_protocol-specs/public-vm/nested-calls.mdx similarity index 100% rename from docs/docs/protocol-specs/public-vm/nested-calls.mdx rename to docs/docs/_protocol-specs/public-vm/nested-calls.mdx diff --git a/docs/docs/protocol-specs/public-vm/security.md b/docs/docs/_protocol-specs/public-vm/security.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/security.md rename to docs/docs/_protocol-specs/public-vm/security.md diff --git a/docs/docs/protocol-specs/public-vm/state.md b/docs/docs/_protocol-specs/public-vm/state.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/state.md rename to docs/docs/_protocol-specs/public-vm/state.md diff --git a/docs/docs/protocol-specs/public-vm/type-structs.md b/docs/docs/_protocol-specs/public-vm/type-structs.md similarity index 100% rename from docs/docs/protocol-specs/public-vm/type-structs.md rename to docs/docs/_protocol-specs/public-vm/type-structs.md diff --git a/docs/docs/protocol-specs/rollup-circuits/base-rollup.md b/docs/docs/_protocol-specs/rollup-circuits/base-rollup.md similarity index 100% rename from docs/docs/protocol-specs/rollup-circuits/base-rollup.md rename to docs/docs/_protocol-specs/rollup-circuits/base-rollup.md diff --git a/docs/docs/protocol-specs/rollup-circuits/index.md b/docs/docs/_protocol-specs/rollup-circuits/index.md similarity index 100% rename from docs/docs/protocol-specs/rollup-circuits/index.md rename to docs/docs/_protocol-specs/rollup-circuits/index.md diff --git a/docs/docs/protocol-specs/rollup-circuits/merge-rollup.md b/docs/docs/_protocol-specs/rollup-circuits/merge-rollup.md similarity index 100% rename from docs/docs/protocol-specs/rollup-circuits/merge-rollup.md rename to docs/docs/_protocol-specs/rollup-circuits/merge-rollup.md diff --git a/docs/docs/protocol-specs/rollup-circuits/root-rollup.md b/docs/docs/_protocol-specs/rollup-circuits/root-rollup.md similarity index 100% rename from docs/docs/protocol-specs/rollup-circuits/root-rollup.md rename to docs/docs/_protocol-specs/rollup-circuits/root-rollup.md diff --git a/docs/docs/protocol-specs/rollup-circuits/tree-parity.md b/docs/docs/_protocol-specs/rollup-circuits/tree-parity.md similarity index 100% rename from docs/docs/protocol-specs/rollup-circuits/tree-parity.md rename to docs/docs/_protocol-specs/rollup-circuits/tree-parity.md diff --git a/docs/docs/protocol-specs/state/archive.md b/docs/docs/_protocol-specs/state/archive.md similarity index 100% rename from docs/docs/protocol-specs/state/archive.md rename to docs/docs/_protocol-specs/state/archive.md diff --git a/docs/docs/protocol-specs/state/index.md b/docs/docs/_protocol-specs/state/index.md similarity index 100% rename from docs/docs/protocol-specs/state/index.md rename to docs/docs/_protocol-specs/state/index.md diff --git a/docs/docs/protocol-specs/state/note-hash-tree.md b/docs/docs/_protocol-specs/state/note-hash-tree.md similarity index 100% rename from docs/docs/protocol-specs/state/note-hash-tree.md rename to docs/docs/_protocol-specs/state/note-hash-tree.md diff --git a/docs/docs/protocol-specs/state/nullifier-tree.md b/docs/docs/_protocol-specs/state/nullifier-tree.md similarity index 100% rename from docs/docs/protocol-specs/state/nullifier-tree.md rename to docs/docs/_protocol-specs/state/nullifier-tree.md diff --git a/docs/docs/protocol-specs/state/public-data-tree.md b/docs/docs/_protocol-specs/state/public-data-tree.md similarity index 100% rename from docs/docs/protocol-specs/state/public-data-tree.md rename to docs/docs/_protocol-specs/state/public-data-tree.md diff --git a/docs/docs/protocol-specs/state/tree-implementations.md b/docs/docs/_protocol-specs/state/tree-implementations.md similarity index 100% rename from docs/docs/protocol-specs/state/tree-implementations.md rename to docs/docs/_protocol-specs/state/tree-implementations.md diff --git a/docs/docs/protocol-specs/state/wonky-tree.md b/docs/docs/_protocol-specs/state/wonky-tree.md similarity index 100% rename from docs/docs/protocol-specs/state/wonky-tree.md rename to docs/docs/_protocol-specs/state/wonky-tree.md diff --git a/docs/docs/protocol-specs/todo.md b/docs/docs/_protocol-specs/todo.md similarity index 100% rename from docs/docs/protocol-specs/todo.md rename to docs/docs/_protocol-specs/todo.md diff --git a/docs/docs/protocol-specs/transactions/index.md b/docs/docs/_protocol-specs/transactions/index.md similarity index 100% rename from docs/docs/protocol-specs/transactions/index.md rename to docs/docs/_protocol-specs/transactions/index.md diff --git a/docs/docs/protocol-specs/transactions/local-execution.md b/docs/docs/_protocol-specs/transactions/local-execution.md similarity index 100% rename from docs/docs/protocol-specs/transactions/local-execution.md rename to docs/docs/_protocol-specs/transactions/local-execution.md diff --git a/docs/docs/protocol-specs/transactions/public-execution.md b/docs/docs/_protocol-specs/transactions/public-execution.md similarity index 100% rename from docs/docs/protocol-specs/transactions/public-execution.md rename to docs/docs/_protocol-specs/transactions/public-execution.md diff --git a/docs/docs/protocol-specs/transactions/tx-object.md b/docs/docs/_protocol-specs/transactions/tx-object.md similarity index 100% rename from docs/docs/protocol-specs/transactions/tx-object.md rename to docs/docs/_protocol-specs/transactions/tx-object.md diff --git a/docs/docs/protocol-specs/transactions/validity.md b/docs/docs/_protocol-specs/transactions/validity.md similarity index 100% rename from docs/docs/protocol-specs/transactions/validity.md rename to docs/docs/_protocol-specs/transactions/validity.md From 079f75a3969a899a437dceda4d75223471c84573 Mon Sep 17 00:00:00 2001 From: James Zaki Date: Mon, 23 Dec 2024 17:00:23 +0000 Subject: [PATCH 4/4] docs: remove specs from sidebar --- docs/sidebars.js | 234 ++--------------------------------------------- 1 file changed, 7 insertions(+), 227 deletions(-) diff --git a/docs/sidebars.js b/docs/sidebars.js index 673ca9602fa..3c6fd4f846d 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -68,9 +68,9 @@ export default { guidesSidebar: [ { - type: "doc", - id: "guides/index", - label: "Guides and Tutorials", + type: "doc", + id: "guides/index", + label: "Guides and Tutorials", }, { type: "html", @@ -80,7 +80,7 @@ export default { { type: "doc", label: "Quickstart", - id: "guides/getting_started" + id: "guides/getting_started" }, { type: "html", @@ -121,7 +121,7 @@ export default { type: "html", value: '', }, - ], + ], referenceSidebar: [ { @@ -150,7 +150,7 @@ export default { { type: "doc", label: "Privacy Considerations", - id: "guides/privacy_considerations" + id: "guides/privacy_considerations" }, { type: "html", @@ -160,7 +160,7 @@ export default { type: "doc", id: "aztec_connect_sunset", }, - ], + ], roadmapSidebar: [ { @@ -168,224 +168,4 @@ export default { dirName: "aztec/roadmap", }, ], - protocolSpecSidebar: [ - "protocol-specs/intro", - { - label: "Cryptography", - type: "category", - link: { type: "doc", id: "protocol-specs/cryptography/index" }, - items: [ - { - label: "Proving System", - type: "category", - items: [ - "protocol-specs/cryptography/proving-system/performance-targets", - "protocol-specs/cryptography/proving-system/overview", - "protocol-specs/cryptography/proving-system/data-bus", - ], - }, - { - label: "Hashing", - type: "category", - items: [ - "protocol-specs/cryptography/hashing/hashing", - "protocol-specs/cryptography/hashing/poseidon2", - "protocol-specs/cryptography/hashing/pedersen", - ], - }, - "protocol-specs/cryptography/merkle-trees", - ], - }, - { - label: "Addresses & Keys", - type: "category", - link: { type: "doc", id: "protocol-specs/addresses-and-keys/index" }, - items: [ - "protocol-specs/addresses-and-keys/address", - "protocol-specs/addresses-and-keys/keys-requirements", - "protocol-specs/addresses-and-keys/keys", - { - label: "Example Usage of Keys", - type: "category", - items: [ - "protocol-specs/addresses-and-keys/example-usage/nullifier", - "protocol-specs/addresses-and-keys/example-usage/diversified-and-stealth-keys", - "protocol-specs/addresses-and-keys/example-usage/tag-sequence-derivation", - "protocol-specs/addresses-and-keys/example-usage/encrypt-and-tag", - ], - }, - "protocol-specs/addresses-and-keys/precompiles", - "protocol-specs/addresses-and-keys/diversified-and-stealth", - ], - }, - { - label: "State", - type: "category", - link: { type: "doc", id: "protocol-specs/state/index" }, - items: [ - "protocol-specs/state/tree-implementations", - "protocol-specs/state/archive", - "protocol-specs/state/note-hash-tree", - "protocol-specs/state/nullifier-tree", - "protocol-specs/state/public-data-tree", - "protocol-specs/state/wonky-tree", - ], - }, - { - label: "Transactions", - type: "category", - link: { type: "doc", id: "protocol-specs/transactions/index" }, - items: [ - "protocol-specs/transactions/local-execution", - "protocol-specs/transactions/public-execution", - "protocol-specs/transactions/tx-object", - "protocol-specs/transactions/validity", - ], - }, - { - label: "Bytecode", - type: "category", - link: { type: "doc", id: "protocol-specs/bytecode/index" }, - items: [], - }, - { - label: "Contract Deployment", - type: "category", - link: { type: "doc", id: "protocol-specs/contract-deployment/index" }, - items: [ - "protocol-specs/contract-deployment/classes", - "protocol-specs/contract-deployment/instances", - ], - }, - { - label: "Calls", - type: "category", - link: { type: "doc", id: "protocol-specs/calls/index" }, - items: [ - "protocol-specs/calls/sync-calls", - "protocol-specs/calls/enqueued-calls", - "protocol-specs/calls/batched-calls", - "protocol-specs/calls/static-calls", - "protocol-specs/calls/unconstrained-calls", - "protocol-specs/calls/public-private-messaging", - ], - }, - { - label: "L1 smart contracts", - type: "category", - link: { type: "doc", id: "protocol-specs/l1-smart-contracts/index" }, - items: ["protocol-specs/l1-smart-contracts/frontier"], - }, - { - label: "Data availability", - type: "category", - link: { - type: "doc", - id: "protocol-specs/data-publication-and-availability/index", - }, - items: [ - "protocol-specs/data-publication-and-availability/overview", - "protocol-specs/data-publication-and-availability/published-data", - ], - }, - { - label: "Logs", - type: "category", - link: { type: "doc", id: "protocol-specs/logs/index" }, - items: [], - }, - { - label: "Pre-compiled Contracts", - type: "category", - link: { type: "doc", id: "protocol-specs/pre-compiled-contracts/index" }, - items: ["protocol-specs/pre-compiled-contracts/registry"], - }, - { - label: "Private Message Delivery", - type: "category", - link: { - type: "doc", - id: "protocol-specs/private-message-delivery/index", - }, - items: [ - "protocol-specs/private-message-delivery/private-msg-delivery", // renamed to avoid routing problems - "protocol-specs/private-message-delivery/send-note-guidelines", - ], - }, - { - label: "Gas & Fees", - type: "category", - link: { type: "doc", id: "protocol-specs/gas-and-fees/index" }, - items: [ - "protocol-specs/gas-and-fees/fee-juice", - "protocol-specs/gas-and-fees/specifying-gas-fee-info", - "protocol-specs/gas-and-fees/tx-setup-and-teardown", - "protocol-specs/gas-and-fees/kernel-tracking", - "protocol-specs/gas-and-fees/fee-schedule", - "protocol-specs/gas-and-fees/published-gas-and-fee-data", - ], - }, - { - label: "Decentralization", - type: "category", - items: [ - "protocol-specs/decentralization/actors", - "protocol-specs/decentralization/governance", - "protocol-specs/decentralization/block-production", - "protocol-specs/decentralization/p2p-network", - ], - }, - { - label: "Circuits", - type: "category", - link: { type: "doc", id: "protocol-specs/circuits/high-level-topology" }, - items: [ - "protocol-specs/circuits/private-function", - "protocol-specs/circuits/private-kernel-initial", - "protocol-specs/circuits/private-kernel-inner", - "protocol-specs/circuits/private-kernel-reset", - "protocol-specs/circuits/private-kernel-tail", - "protocol-specs/circuits/public-kernel-initial", - "protocol-specs/circuits/public-kernel-inner", - "protocol-specs/circuits/public-kernel-tail", - ], - }, - { - label: "Rollup Circuits", - type: "category", - link: { type: "doc", id: "protocol-specs/rollup-circuits/index" }, - items: [ - "protocol-specs/rollup-circuits/base-rollup", - "protocol-specs/rollup-circuits/merge-rollup", - "protocol-specs/rollup-circuits/tree-parity", - "protocol-specs/rollup-circuits/root-rollup", - ], - }, - { - label: "Aztec (Public) VM", - type: "category", - link: { type: "doc", id: "protocol-specs/public-vm/index" }, - items: [ - "protocol-specs/public-vm/intro", - "protocol-specs/public-vm/state", - "protocol-specs/public-vm/memory-model", - "protocol-specs/public-vm/context", - "protocol-specs/public-vm/execution", - "protocol-specs/public-vm/nested-calls", - "protocol-specs/public-vm/instruction-set", - { - label: "AVM Circuit", - type: "category", - link: { type: "doc", id: "protocol-specs/public-vm/circuit-index" }, - items: [ - "protocol-specs/public-vm/avm-circuit", - "protocol-specs/public-vm/control-flow", - "protocol-specs/public-vm/alu", - "protocol-specs/public-vm/bytecode-validation-circuit", - ], - }, - "protocol-specs/public-vm/type-structs", - ], - }, - ], };