diff --git a/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md b/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md
index dd646d383fba..656f1f9e4c82 100644
--- a/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md
+++ b/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md
@@ -88,14 +88,12 @@ Its arguments are `PXE` client and contract constructor arguments.
Additionally the `.send()` method can have a few optional arguments too, which are specified in an optional object:
-- `portalContract?: EthAddress`: The L1 portal address to link the contract to. See the section on [Portals to learn more about them](../writing_contracts/portals/portals.md).
- `contractAddressSalt?: Fr`: A salt which is one of the inputs when computing a contract address of the contract to be deployed.
By default is set to a random value.
Set it, if you need a deterministic contract address (same functionality as Ethereum's `CREATE2` opcode).
```ts
const tx = ExampleContract.deploy(pxe).send({
- portalContract: EthAddress.from("0x1234..."),
contractAddressSalt: new Fr(3n),
});
```
diff --git a/docs/docs/developers/contracts/references/history_lib_reference.md b/docs/docs/developers/contracts/references/history_lib_reference.md
index cc592a6760ab..89e0fb575cae 100644
--- a/docs/docs/developers/contracts/references/history_lib_reference.md
+++ b/docs/docs/developers/contracts/references/history_lib_reference.md
@@ -139,12 +139,9 @@ This proves that a contract exists in, ie had been deployed before or in, a cert
| contract_address_salt | Field | Unique identifier for the contract's address |
| function_tree_root | Field | Root of the contract's function tree |
| constructor_hash | Field | Hash of the contract's constructor |
-| portal_contract_address | EthAddress | Ethereum address of the associated portal contract |
| block_number | u32 | Block number for proof verification |
| context | PrivateContext | Private context |
-If there is no associated portal contract, you can use a zero Ethereum address:
-
```ts
new EthAddress(Buffer.alloc(EthAddress.SIZE_IN_BYTES));
```
diff --git a/docs/docs/developers/contracts/writing_contracts/functions/context.md b/docs/docs/developers/contracts/writing_contracts/functions/context.md
index 172d13890ea5..fbaa0e09dcfe 100644
--- a/docs/docs/developers/contracts/writing_contracts/functions/context.md
+++ b/docs/docs/developers/contracts/writing_contracts/functions/context.md
@@ -61,9 +61,7 @@ The call context contains information about the current call being made:
- This value is the address of the current context's contract address. This value will be the value of the current contract that is being executed except for when the current call is a delegate call (Warning: This is yet to be implemented). In this case the value will be that of the sending contract.
-3. Portal Contract Address
- - This value stores the current contract's linked [portal contract](../portals/portals.md) address. As a quick recap, this value is the value of the contracts related ethereum l1 contract address, and will be the recipient of any messages that are created by this contract.
-4. Flags
+3. Flags
- Furthermore there are a series of flags that are stored within the application context:
- is_delegate_call: Denotes whether the current call is a delegate call. If true, then the storage contract address will be the address of the sender.
- is_static_call: This will be set if and only if the current call is a static call. In a static call, state changing altering operations are not allowed.
diff --git a/docs/docs/developers/contracts/writing_contracts/portals/deploy_with_portal.md b/docs/docs/developers/contracts/writing_contracts/portals/deploy_with_portal.md
index 34c6d593d0a1..18a3d98c88bc 100644
--- a/docs/docs/developers/contracts/writing_contracts/portals/deploy_with_portal.md
+++ b/docs/docs/developers/contracts/writing_contracts/portals/deploy_with_portal.md
@@ -3,7 +3,7 @@ title: How to deploy a contract with a Portal
---
- Deploy to L1 using Viem, Foundry or your preferred tool;
-- Deploy to L2 passing in the address of the L1 portal as an argument;
+- Deploy to L2 and supply the L1 portal as an argument so you can store it in the contract;
```typescript
const deploymentTx = Contract.deploy(wallet, tokenPortalAddress).send();
```
diff --git a/docs/docs/developers/contracts/writing_contracts/portals/portals.md b/docs/docs/developers/contracts/writing_contracts/portals/portals.md
index 642bad03eb4e..fe42eff02b8b 100644
--- a/docs/docs/developers/contracts/writing_contracts/portals/portals.md
+++ b/docs/docs/developers/contracts/writing_contracts/portals/portals.md
@@ -2,6 +2,6 @@
title: Portals
---
-A portal is the point of contact between L1 and a specific contract on Aztec. For applications such as token bridges, this is the point where the tokens are held on L1 while used in L2.
+A portal is a point of contact between L1 and a contract on Aztec. For applications such as token bridges, this is the point where the tokens are held on L1 while used in L2.
-As outlined in [Communication](../../../../learn/concepts/communication/cross_chain_calls.md), an Aztec L2 contract is linked to _ONE_ L1 address at time of deployment (specified by the developer). This L1 address is the only address that can send messages to that specific L2 contract, and the only address that can receive messages sent from the L2 contract to L1. Note, that a portal don't actually need to be a contract, it could be any address on L1. We say that an Aztec contract is attached to a portal.
+As outlined in [Communication](../../../../learn/concepts/communication/cross_chain_calls.md), an Aztec L2 contract is linked to _ONE_ L1 address at time of deployment (specified by the developer). This L1 address is the only address that can send messages to that specific L2 contract, and the only address that can receive messages sent from the L2 contract to L1. Note, that a portal don't actually need to be a contract, it could be any address on L1.
diff --git a/docs/docs/developers/debugging/aztecnr-errors.md b/docs/docs/developers/debugging/aztecnr-errors.md
index 67b6496612dd..c19be19ec954 100644
--- a/docs/docs/developers/debugging/aztecnr-errors.md
+++ b/docs/docs/developers/debugging/aztecnr-errors.md
@@ -45,7 +45,7 @@ To address the error. find the line in the contract that is throwing the error a
This error occurs when you are trying to interact with a smart contract via an Private Execution Environment (PXE) that does not have the necessary information to execute a transaction.
-To execute a transaction, the PXE needs to know the complete address of a contract, portal address (if portal is used) and contract artifacts.
+To execute a transaction, the PXE needs to know the complete address of a contract and contract artifacts.
To address the error, add the contract to the PXE by calling [`pxe.addContracts(...)`](../../apis/pxe/interfaces/PXE.md#addcontracts).
diff --git a/docs/docs/developers/tutorials/token_portal/minting_on_aztec.md b/docs/docs/developers/tutorials/token_portal/minting_on_aztec.md
index 0eb400f0acbf..1e0bcf5a363e 100644
--- a/docs/docs/developers/tutorials/token_portal/minting_on_aztec.md
+++ b/docs/docs/developers/tutorials/token_portal/minting_on_aztec.md
@@ -24,12 +24,13 @@ The `claim_public` function enables anyone to consume the message on the user's
**What’s happening here?**
1. We first recompute the L1->L2 message content by calling `get_mint_public_content_hash()`. Note that the method does exactly the same as what the TokenPortal contract does in `depositToAztecPublic()` to create the content hash.
-2. We then attempt to consume the L1->L2 message by passing the `msg_key`, the the content hash, and the "secret". Since we are depositing to Aztec publicly, this secret is public, anyone can know this and is usually 0.
- - `context.consume_l1_to_l2_message()` takes in the content_hash and secret to recreate the original message. The L1 to L2 message consists of:
- - Sender - who on L1 sent the message + chain ID of L1. The context variable knows the portal address on L1 and adds that
- - Recipient - i.e. this aztec contract address which is consuming the message + the current version of the aztec rollup.
- - The content - which is reconstructed in the `get_mint_public_content_hash()`
- - Note that the `content_hash` requires `to`, `amount` and `canceller`. If a malicious user tries to mint tokens to their address by changing the to address, the content hash will be different to what the token portal had calculated on L1 and the `msg_Key` will also be different, thus preventing the L1->L2 message from being consumed. This is why we add these parameters into the content.
+2. We then attempt to consume the L1->L2 message. Since we are depositing to Aztec publicly, all of the inputs are public.
+ - `context.consume_l1_to_l2_message()` takes in the few parameters:
+ - `content_hash`: The content - which is reconstructed in the `get_mint_public_content_hash()`
+ - `secret`: The secret used for consumption, often 0 for public messages
+ - `sender`: Who on L1 sent the message. Which should match the stored `portal_address` in our case as we only want to allow messages from a specific sender.
+ - `message_leaf_index`: The index in the message tree of the message.
+ - Note that the `content_hash` requires `to` and `amount`. If a malicious user tries to mint tokens to their address by changing the to address, the content hash will be different to what the token portal had calculated on L1 and thus not be in the tree, failing the consumption. This is why we add these parameters into the content.
3. Then we call `Token::at(storage.token.read()).mint_public()` to mint the tokens to the to address.
## Private flow
diff --git a/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md b/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md
index 524e106ef516..76ee92226fff 100644
--- a/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md
+++ b/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md
@@ -18,6 +18,7 @@ The `exit_to_l1_public` function enables anyone to withdraw their L2 tokens back
1. Like with our deposit function, we need to create the L2 to L1 message. The content is the _amount_ to burn, the recipient address, and who can execute the withdraw on the L1 portal on behalf of the user. It can be `0x0` for anyone, or a specified address.
2. `context.message_portal()` passes this content to the [kernel circuit](../../../learn/concepts/circuits/kernels/public_kernel.md) which creates the proof for the transaction. The kernel circuit then adds the sender (the L2 address of the bridge + version of aztec) and the recipient (the portal to the L2 address + the chain ID of L1) under the hood, to create the message which gets added as part of the transaction data published by the sequencer and is stored in the outbox for consumption.
+2. The `context.message_portal()` takes the recipient and content as input, and will insert a message into the outbox. We set the recipient to be the portal address read from storage of the contract.
3. Finally, you also burn the tokens on L2! Note that it burning is done at the end to follow the check effects interaction pattern. Note that the caller has to first approve the bridge contract to burn tokens on its behalf. Refer to [burn_public function on the token contract](../writing_token_contract.md#burn_public). The nonce parameter refers to the approval message that the user creates - also refer to [authorizing token spends here](../writing_token_contract.md#authorizing-token-spends).
- We burn the tokens from the `msg_sender()`. Otherwise, a malicious user could burn someone else’s tokens and mint tokens on L1 to themselves. One could add another approval flow on the bridge but that might make it complex for other applications to call the bridge.
@@ -58,7 +59,7 @@ Before we can compile and use the contract, we need to add two additional functi
We need a function that lets us read the token value. Paste this into `main.nr`:
-#include_code read_token /noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr rust
+#include_code get_token /noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr rust
## Compile code
diff --git a/docs/docs/misc/migration_notes.md b/docs/docs/misc/migration_notes.md
index f906c8ad3be9..c25077f537fa 100644
--- a/docs/docs/misc/migration_notes.md
+++ b/docs/docs/misc/migration_notes.md
@@ -6,6 +6,28 @@ keywords: [sandbox, cli, aztec, notes, migration, updating, upgrading]
Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.
+## [T.B.D]
+
+## [Aztec.nr & js] Portal addresses
+The deployment have been cleansed from the portal addresses as a immutable value passed in differently to other variables and instead should be implemented using usual storage by those who require it using the storage that matches the usecase - likely the shared storage to support private and public.
+
+This means that you will likely add the portal as a constructor argument
+```diff
+- fn constructor(token: AztecAddress) {
+- storage.token.write(token);
+- }
++ fn constructor(token: AztecAddress, portal_address: EthAddress) {
++ storage.token.write(token);
++ storage.portal_address.initialize(portal_address);
++ }
+```
+
+And read it from storage whenever needed instead of from the context.
+```diff
+- context.this_portal_address(),
++ storage.portal_address.read_public(),
+```
+
## 0.36.0
### [Aztec.nr] Oracles
diff --git a/docs/docs/protocol-specs/contract-deployment/instances.md b/docs/docs/protocol-specs/contract-deployment/instances.md
index 69e836924c55..84b3048be40b 100644
--- a/docs/docs/protocol-specs/contract-deployment/instances.md
+++ b/docs/docs/protocol-specs/contract-deployment/instances.md
@@ -110,7 +110,6 @@ fn deploy (
salt: Field,
contract_class_id: Field,
initialization_hash: Field,
- portal_contract_address: Field,
public_keys_hash: Field,
universal_deploy?: boolean,
)
@@ -118,8 +117,6 @@ fn deploy (
assert(nullifier_exists(silo(contract_class_id, contract_class_registerer.address)));
- assert(is_valid_eth_address(portal_contract_address));
-
let deployer: Address = if universal_deploy { 0 } else { msg_sender };
let version: Field = 1;
@@ -129,13 +126,12 @@ fn deploy (
deployer,
contract_class_id,
initialization_hash,
- portal_contract_address,
public_keys_hash
);
emit_nullifier(address);
- emit_unencrypted_event(ContractInstanceDeployed::new(address, version, salt, contract_class_id, initialization_hash, portal_contract_address, public_keys_hash));
+ emit_unencrypted_event(ContractInstanceDeployed::new(address, version, salt, contract_class_id, initialization_hash, public_keys_hash));
```
> See [address](../addresses-and-keys/address.md) for `address_crh`.
diff --git a/docs/docs/protocol-specs/l1-smart-contracts/index.md b/docs/docs/protocol-specs/l1-smart-contracts/index.md
index 0a2f7a924d8d..74ca8d23748a 100644
--- a/docs/docs/protocol-specs/l1-smart-contracts/index.md
+++ b/docs/docs/protocol-specs/l1-smart-contracts/index.md
@@ -12,7 +12,7 @@ The purpose of the L1 contracts are simple:
- Facilitate cross-chain communication such that L1 liquidity can be used on L2
- Act as a validating light node for L2 that every L1 node implicitly run
- :::
+:::
## Overview
@@ -188,8 +188,9 @@ Insertions require a L2 transaction, and it is then to be consumed and moved to
### Portals
-When deploying a contract on L2, it is possible to specify its "portal" address.
-This is an immutable variable, that can be used to constrain who the L2 contract expects messages from, and who it sends messages to.
+Some contracts on L2 might wish to talk to contract on L1 - these recipients on L1 are called portals.
+
+Often it is desired to constrain where messages are sent to and received from, which can be done by keeping the portal address in the storage of the L2 contract, such that it can be loaded on demand.
### Messages
@@ -488,7 +489,7 @@ Also, some of the conditions are repetitions of what we saw earlier from the [st
- For cost purposes, it can be useful to commit to the public inputs to just pass a single value into the circuit.
- Time constraints might change depending on the exact sequencer selection mechanism.
- :::
+:::
## Logical Execution
diff --git a/docs/docs/protocol-specs/public-vm/_nested-context.md b/docs/docs/protocol-specs/public-vm/_nested-context.md
index aa081d17a382..232118d88e6c 100644
--- a/docs/docs/protocol-specs/public-vm/_nested-context.md
+++ b/docs/docs/protocol-specs/public-vm/_nested-context.md
@@ -17,7 +17,6 @@ nestedExecutionEnvironment = ExecutionEnvironment {
sender: isDelegateCall ? context.sender : context.address,
address: M[addrOffset],
storageAddress: isDelegateCall ? context.storageAddress : M[addrOffset],
- portal: callingContext.worldState.contracts[M[addrOffset]].portal,
feePerL1Gas: context.environment.feePerL1Gas,
feePerL2Gas: context.environment.feePerL2Gas,
feePerDaGas: context.environment.feePerDaGas,
diff --git a/docs/docs/protocol-specs/public-vm/avm-circuit.md b/docs/docs/protocol-specs/public-vm/avm-circuit.md
index b5c3d1ab215e..ecc54a1de6be 100644
--- a/docs/docs/protocol-specs/public-vm/avm-circuit.md
+++ b/docs/docs/protocol-specs/public-vm/avm-circuit.md
@@ -185,7 +185,6 @@ AvmSessionInputs {
address: AztecAddress,
storageAddress: AztecAddress,
sender: AztecAddress,
- portal: AztecAddress,
contractCallDepth: field,
isStaticCall: boolean,
isDelegateCall: boolean,
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 d1f4fa379c37..0870b1400613 100644
--- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx
+++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx
@@ -140,140 +140,133 @@ Click on an instruction name to jump to its section.
}
- 0x12 | [`PORTAL`](#isa-section-portal) |
- Get the address of the l1 portal contract |
- {
- `M[dstOffset] = context.environment.portal`
- } |
-
-
- 0x13 | [`FEEPERL1GAS`](#isa-section-feeperl1gas) |
+ 0x12 | [`FEEPERL1GAS`](#isa-section-feeperl1gas) |
Get the fee to be paid per "L1 gas" - constant for entire transaction |
{
`M[dstOffset] = context.environment.feePerL1Gas`
} |
- 0x14 | [`FEEPERL2GAS`](#isa-section-feeperl2gas) |
+ 0x13 | [`FEEPERL2GAS`](#isa-section-feeperl2gas) |
Get the fee to be paid per "L2 gas" - constant for entire transaction |
{
`M[dstOffset] = context.environment.feePerL2Gas`
} |
- 0x15 | [`FEEPERDAGAS`](#isa-section-feeperdagas) |
+ 0x14 | [`FEEPERDAGAS`](#isa-section-feeperdagas) |
Get the fee to be paid per "DA gas" - constant for entire transaction |
{
`M[dstOffset] = context.environment.feePerDaGas`
} |
- 0x16 | [`CONTRACTCALLDEPTH`](#isa-section-contractcalldepth) |
+ 0x15 | [`CONTRACTCALLDEPTH`](#isa-section-contractcalldepth) |
Get how many contract calls deep the current call context is |
{
`M[dstOffset] = context.environment.contractCallDepth`
} |
- 0x17 | [`CHAINID`](#isa-section-chainid) |
+ 0x16 | [`CHAINID`](#isa-section-chainid) |
Get this rollup's L1 chain ID |
{
`M[dstOffset] = context.environment.globals.chainId`
} |
- 0x18 | [`VERSION`](#isa-section-version) |
+ 0x17 | [`VERSION`](#isa-section-version) |
Get this rollup's L2 version ID |
{
`M[dstOffset] = context.environment.globals.version`
} |
- 0x19 | [`BLOCKNUMBER`](#isa-section-blocknumber) |
+ 0x18 | [`BLOCKNUMBER`](#isa-section-blocknumber) |
Get this L2 block's number |
{
`M[dstOffset] = context.environment.globals.blocknumber`
} |
- 0x1a | [`TIMESTAMP`](#isa-section-timestamp) |
+ 0x19 | [`TIMESTAMP`](#isa-section-timestamp) |
Get this L2 block's timestamp |
{
`M[dstOffset] = context.environment.globals.timestamp`
} |
- 0x1b | [`COINBASE`](#isa-section-coinbase) |
+ 0x1a | [`COINBASE`](#isa-section-coinbase) |
Get the block's beneficiary address |
{
`M[dstOffset] = context.environment.globals.coinbase`
} |
- 0x1c | [`BLOCKL1GASLIMIT`](#isa-section-blockl1gaslimit) |
+ 0x1b | [`BLOCKL1GASLIMIT`](#isa-section-blockl1gaslimit) |
Total amount of "L1 gas" that a block can consume |
{
`M[dstOffset] = context.environment.globals.l1GasLimit`
} |
- 0x1d | [`BLOCKL2GASLIMIT`](#isa-section-blockl2gaslimit) |
+ 0x1c | [`BLOCKL2GASLIMIT`](#isa-section-blockl2gaslimit) |
Total amount of "L2 gas" that a block can consume |
{
`M[dstOffset] = context.environment.globals.l2GasLimit`
} |
- 0x1e | [`BLOCKDAGASLIMIT`](#isa-section-blockdagaslimit) |
+ 0x1d | [`BLOCKDAGASLIMIT`](#isa-section-blockdagaslimit) |
Total amount of "DA gas" that a block can consume |
{
`M[dstOffset] = context.environment.globals.daGasLimit`
} |
- 0x1f | [`CALLDATACOPY`](#isa-section-calldatacopy) |
+ 0x1e | [`CALLDATACOPY`](#isa-section-calldatacopy) |
Copy calldata into memory |
{
`M[dstOffset:dstOffset+copySize] = context.environment.calldata[cdOffset:cdOffset+copySize]`
} |
- 0x20 | [`L1GASLEFT`](#isa-section-l1gasleft) |
+ 0x1f | [`L1GASLEFT`](#isa-section-l1gasleft) |
Remaining "L1 gas" for this call (after this instruction) |
{
`M[dstOffset] = context.machineState.l1GasLeft`
} |
- 0x21 | [`L2GASLEFT`](#isa-section-l2gasleft) |
+ 0x20 | [`L2GASLEFT`](#isa-section-l2gasleft) |
Remaining "L2 gas" for this call (after this instruction) |
{
`M[dstOffset] = context.MachineState.l2GasLeft`
} |
- 0x22 | [`DAGASLEFT`](#isa-section-dagasleft) |
+ 0x21 | [`DAGASLEFT`](#isa-section-dagasleft) |
Remaining "DA gas" for this call (after this instruction) |
{
`M[dstOffset] = context.machineState.daGasLeft`
} |
- 0x23 | [`JUMP`](#isa-section-jump) |
+ 0x22 | [`JUMP`](#isa-section-jump) |
Jump to a location in the bytecode |
{
`context.machineState.pc = loc`
} |
- 0x24 | [`JUMPI`](#isa-section-jumpi) |
+ 0x23 | [`JUMPI`](#isa-section-jumpi) |
Conditionally jump to a location in the bytecode |
{
`context.machineState.pc = M[condOffset] > 0 ? loc : context.machineState.pc`
} |
- 0x25 | [`INTERNALCALL`](#isa-section-internalcall) |
+ 0x24 | [`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)
@@ -281,49 +274,49 @@ context.machineState.pc = loc`}
|
- 0x26 | [`INTERNALRETURN`](#isa-section-internalreturn) |
+ 0x25 | [`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()`
} |
- 0x27 | [`SET`](#isa-section-set) |
+ 0x26 | [`SET`](#isa-section-set) |
Set a memory word from a constant in the bytecode |
{
`M[dstOffset] = const`
} |
- 0x28 | [`MOV`](#isa-section-mov) |
+ 0x27 | [`MOV`](#isa-section-mov) |
Move a word from source memory location to destination |
{
`M[dstOffset] = M[srcOffset]`
} |
- 0x29 | [`CMOV`](#isa-section-cmov) |
+ 0x28 | [`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]`
} |
- 0x2a | [`SLOAD`](#isa-section-sload) |
+ 0x29 | [`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]]`}
|
- 0x2b | [`SSTORE`](#isa-section-sstore) |
+ 0x2a | [`SSTORE`](#isa-section-sstore) |
Write a word to this contract's persistent public storage |
{`S[M[slotOffset]] = M[srcOffset]`}
|
- 0x2c | [`NOTEHASHEXISTS`](#isa-section-notehashexists) |
+ 0x2b | [`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({
@@ -334,7 +327,7 @@ M[existsOffset] = exists`}
|
- 0x2d | [`EMITNOTEHASH`](#isa-section-emitnotehash) |
+ 0x2c | [`EMITNOTEHASH`](#isa-section-emitnotehash) |
Emit a new note hash to be inserted into the note hash tree |
{`context.worldState.noteHashes.append(
@@ -343,7 +336,7 @@ M[existsOffset] = exists`}
|
- 0x2e | [`NULLIFIEREXISTS`](#isa-section-nullifierexists) |
+ 0x2d | [`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(
@@ -353,7 +346,7 @@ M[existsOffset] = exists`}
|
- 0x2f | [`EMITNULLIFIER`](#isa-section-emitnullifier) |
+ 0x2e | [`EMITNULLIFIER`](#isa-section-emitnullifier) |
Emit a new nullifier to be inserted into the nullifier tree |
{`context.worldState.nullifiers.append(
@@ -362,7 +355,7 @@ M[existsOffset] = exists`}
|
- 0x30 | [`L1TOL2MSGEXISTS`](#isa-section-l1tol2msgexists) |
+ 0x2f | [`L1TOL2MSGEXISTS`](#isa-section-l1tol2msgexists) |
Check if a message exists in the L1-to-L2 message tree |
{`exists = context.worldState.l1ToL2Messages.has({
@@ -372,7 +365,7 @@ M[existsOffset] = exists`}
|
- 0x31 | [`HEADERMEMBER`](#isa-section-headermember) |
+ 0x30 | [`HEADERMEMBER`](#isa-section-headermember) |
Check if a header exists in the [archive tree](../state/archive) and retrieve the specified member if so |
{`exists = context.worldState.header.has({
@@ -385,7 +378,7 @@ if exists:
|
- 0x32 | [`GETCONTRACTINSTANCE`](#isa-section-getcontractinstance) |
+ 0x31 | [`GETCONTRACTINSTANCE`](#isa-section-getcontractinstance) |
Copies contract instance data to memory |
{`M[dstOffset:dstOffset+CONTRACT_INSTANCE_SIZE+1] = [
@@ -400,7 +393,7 @@ if exists:
|
- 0x33 | [`EMITUNENCRYPTEDLOG`](#isa-section-emitunencryptedlog) |
+ 0x32 | [`EMITUNENCRYPTEDLOG`](#isa-section-emitunencryptedlog) |
Emit an unencrypted log |
{`context.accruedSubstate.unencryptedLogs.append(
@@ -413,7 +406,7 @@ if exists:
|
- 0x34 | [`SENDL2TOL1MSG`](#isa-section-sendl2tol1msg) |
+ 0x33 | [`SENDL2TOL1MSG`](#isa-section-sendl2tol1msg) |
Send an L2-to-L1 message |
{`context.accruedSubstate.sentL2ToL1Messages.append(
@@ -426,7 +419,7 @@ if exists:
|
- 0x35 | [`CALL`](#isa-section-call) |
+ 0x34 | [`CALL`](#isa-section-call) |
Call into another contract |
{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize }
@@ -441,7 +434,7 @@ updateContextAfterNestedCall(context, instr.args, nestedContext)`}
|
- 0x36 | [`STATICCALL`](#isa-section-staticcall) |
+ 0x35 | [`STATICCALL`](#isa-section-staticcall) |
Call into another contract, disallowing World State and Accrued Substate modifications |
{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize }
@@ -456,7 +449,7 @@ updateContextAfterNestedCall(context, instr.args, nestedContext)`}
|
- 0x37 | [`DELEGATECALL`](#isa-section-delegatecall) |
+ 0x36 | [`DELEGATECALL`](#isa-section-delegatecall) |
Call into another contract, but keep the caller's `sender` and `storageAddress` |
{`// instr.args are { gasOffset, addrOffset, argsOffset, retOffset, retSize }
@@ -471,7 +464,7 @@ updateContextAfterNestedCall(context, instr.args, nestedContext)`}
|
- 0x38 | [`RETURN`](#isa-section-return) |
+ 0x37 | [`RETURN`](#isa-section-return) |
Halt execution within this context (without revert), optionally returning some data |
{`context.contractCallResults.output = M[retOffset:retOffset+retSize]
@@ -479,7 +472,7 @@ halt`}
|
- 0x39 | [`REVERT`](#isa-section-revert) |
+ 0x38 | [`REVERT`](#isa-section-revert) |
Halt execution within this context as `reverted`, optionally returning some data |
{`context.contractCallResults.output = M[retOffset:retOffset+retSize]
@@ -859,29 +852,12 @@ Get the address of the sender (caller of the current context)
[](/img/protocol-specs/public-vm/bit-formats/SENDER.png)
-### `PORTAL`
-Get the address of the l1 portal contract
-
-[See in table.](#isa-table-portal)
-
-- **Opcode**: 0x12
-- **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.portal`
-- **Tag updates**: `T[dstOffset] = u32`
-- **Bit-size**: 56
-
-[](/img/protocol-specs/public-vm/bit-formats/PORTAL.png)
-
### `FEEPERL1GAS`
Get the fee to be paid per "L1 gas" - constant for entire transaction
[See in table.](#isa-table-feeperl1gas)
-- **Opcode**: 0x13
+- **Opcode**: 0x12
- **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]`.
@@ -898,7 +874,7 @@ Get the fee to be paid per "L2 gas" - constant for entire transaction
[See in table.](#isa-table-feeperl2gas)
-- **Opcode**: 0x14
+- **Opcode**: 0x13
- **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]`.
@@ -915,7 +891,7 @@ Get the fee to be paid per "DA gas" - constant for entire transaction
[See in table.](#isa-table-feeperdagas)
-- **Opcode**: 0x15
+- **Opcode**: 0x14
- **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]`.
@@ -932,7 +908,7 @@ Get how many contract calls deep the current call context is
[See in table.](#isa-table-contractcalldepth)
-- **Opcode**: 0x16
+- **Opcode**: 0x15
- **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]`.
@@ -950,7 +926,7 @@ Get this rollup's L1 chain ID
[See in table.](#isa-table-chainid)
-- **Opcode**: 0x17
+- **Opcode**: 0x16
- **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]`.
@@ -967,7 +943,7 @@ Get this rollup's L2 version ID
[See in table.](#isa-table-version)
-- **Opcode**: 0x18
+- **Opcode**: 0x17
- **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]`.
@@ -984,7 +960,7 @@ Get this L2 block's number
[See in table.](#isa-table-blocknumber)
-- **Opcode**: 0x19
+- **Opcode**: 0x18
- **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]`.
@@ -1001,7 +977,7 @@ Get this L2 block's timestamp
[See in table.](#isa-table-timestamp)
-- **Opcode**: 0x1a
+- **Opcode**: 0x19
- **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]`.
@@ -1018,7 +994,7 @@ Get the block's beneficiary address
[See in table.](#isa-table-coinbase)
-- **Opcode**: 0x1b
+- **Opcode**: 0x1a
- **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]`.
@@ -1035,7 +1011,7 @@ Total amount of "L1 gas" that a block can consume
[See in table.](#isa-table-blockl1gaslimit)
-- **Opcode**: 0x1c
+- **Opcode**: 0x1b
- **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]`.
@@ -1052,7 +1028,7 @@ Total amount of "L2 gas" that a block can consume
[See in table.](#isa-table-blockl2gaslimit)
-- **Opcode**: 0x1d
+- **Opcode**: 0x1c
- **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]`.
@@ -1069,7 +1045,7 @@ Total amount of "DA gas" that a block can consume
[See in table.](#isa-table-blockdagaslimit)
-- **Opcode**: 0x1e
+- **Opcode**: 0x1d
- **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]`.
@@ -1086,7 +1062,7 @@ Copy calldata into memory
[See in table.](#isa-table-calldatacopy)
-- **Opcode**: 0x1f
+- **Opcode**: 0x1e
- **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]`.
@@ -1106,7 +1082,7 @@ Remaining "L1 gas" for this call (after this instruction)
[See in table.](#isa-table-l1gasleft)
-- **Opcode**: 0x20
+- **Opcode**: 0x1f
- **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]`.
@@ -1123,7 +1099,7 @@ Remaining "L2 gas" for this call (after this instruction)
[See in table.](#isa-table-l2gasleft)
-- **Opcode**: 0x21
+- **Opcode**: 0x20
- **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]`.
@@ -1140,7 +1116,7 @@ Remaining "DA gas" for this call (after this instruction)
[See in table.](#isa-table-dagasleft)
-- **Opcode**: 0x22
+- **Opcode**: 0x21
- **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]`.
@@ -1157,7 +1133,7 @@ Jump to a location in the bytecode
[See in table.](#isa-table-jump)
-- **Opcode**: 0x23
+- **Opcode**: 0x22
- **Category**: Machine State - Control Flow
- **Args**:
- **loc**: target location to jump to
@@ -1172,7 +1148,7 @@ Conditionally jump to a location in the bytecode
[See in table.](#isa-table-jumpi)
-- **Opcode**: 0x24
+- **Opcode**: 0x23
- **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]`.
@@ -1190,7 +1166,7 @@ Make an internal call. Push the current PC to the internal call stack and jump t
[See in table.](#isa-table-internalcall)
-- **Opcode**: 0x25
+- **Opcode**: 0x24
- **Category**: Machine State - Control Flow
- **Args**:
- **loc**: target location to jump/call to
@@ -1208,7 +1184,7 @@ Return from an internal call. Pop from the internal call stack and jump to the p
[See in table.](#isa-table-internalreturn)
-- **Opcode**: 0x26
+- **Opcode**: 0x25
- **Category**: Machine State - Control Flow
- **Expression**: `context.machineState.pc = context.machineState.internalCallStack.pop()`
- **Bit-size**: 16
@@ -1220,7 +1196,7 @@ Set a memory word from a constant in the bytecode
[See in table.](#isa-table-set)
-- **Opcode**: 0x27
+- **Opcode**: 0x26
- **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]`.
@@ -1240,7 +1216,7 @@ Move a word from source memory location to destination
[See in table.](#isa-table-mov)
-- **Opcode**: 0x28
+- **Opcode**: 0x27
- **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]`.
@@ -1258,7 +1234,7 @@ Move a word (conditionally chosen) from one memory location to another (`d = con
[See in table.](#isa-table-cmov)
-- **Opcode**: 0x29
+- **Opcode**: 0x28
- **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]`.
@@ -1279,7 +1255,7 @@ Load a word from this contract's persistent public storage. Zero is loaded for u
[See in table.](#isa-table-sload)
-- **Opcode**: 0x2a
+- **Opcode**: 0x29
- **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]`.
@@ -1324,7 +1300,7 @@ Write a word to this contract's persistent public storage
[See in table.](#isa-table-sstore)
-- **Opcode**: 0x2b
+- **Opcode**: 0x2a
- **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]`.
@@ -1364,7 +1340,7 @@ Check whether a note hash exists in the note hash tree (as of the start of the c
[See in table.](#isa-table-notehashexists)
-- **Opcode**: 0x2c
+- **Opcode**: 0x2b
- **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]`.
@@ -1402,7 +1378,7 @@ Emit a new note hash to be inserted into the note hash tree
[See in table.](#isa-table-emitnotehash)
-- **Opcode**: 0x2d
+- **Opcode**: 0x2c
- **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]`.
@@ -1434,7 +1410,7 @@ Check whether a nullifier exists in the nullifier tree (including nullifiers fro
[See in table.](#isa-table-nullifierexists)
-- **Opcode**: 0x2e
+- **Opcode**: 0x2d
- **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]`.
@@ -1471,7 +1447,7 @@ Emit a new nullifier to be inserted into the nullifier tree
[See in table.](#isa-table-emitnullifier)
-- **Opcode**: 0x2f
+- **Opcode**: 0x2e
- **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]`.
@@ -1503,7 +1479,7 @@ Check if a message exists in the L1-to-L2 message tree
[See in table.](#isa-table-l1tol2msgexists)
-- **Opcode**: 0x30
+- **Opcode**: 0x2f
- **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]`.
@@ -1542,7 +1518,7 @@ Check if a header exists in the [archive tree](../state/archive) and retrieve th
[See in table.](#isa-table-headermember)
-- **Opcode**: 0x31
+- **Opcode**: 0x30
- **Category**: World State - Archive Tree & Headers
- **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]`.
@@ -1585,7 +1561,7 @@ Copies contract instance data to memory
[See in table.](#isa-table-getcontractinstance)
-- **Opcode**: 0x32
+- **Opcode**: 0x31
- **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]`.
@@ -1615,7 +1591,7 @@ Emit an unencrypted log
[See in table.](#isa-table-emitunencryptedlog)
-- **Opcode**: 0x33
+- **Opcode**: 0x32
- **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]`.
@@ -1642,7 +1618,7 @@ Send an L2-to-L1 message
[See in table.](#isa-table-sendl2tol1msg)
-- **Opcode**: 0x34
+- **Opcode**: 0x33
- **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]`.
@@ -1668,7 +1644,7 @@ Call into another contract
[See in table.](#isa-table-call)
-- **Opcode**: 0x35
+- **Opcode**: 0x34
- **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]`.
@@ -1716,7 +1692,7 @@ Call into another contract, disallowing World State and Accrued Substate modific
[See in table.](#isa-table-staticcall)
-- **Opcode**: 0x36
+- **Opcode**: 0x35
- **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]`.
@@ -1761,7 +1737,7 @@ Call into another contract, but keep the caller's `sender` and `storageAddress`
[See in table.](#isa-table-delegatecall)
-- **Opcode**: 0x37
+- **Opcode**: 0x36
- **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]`.
@@ -1806,7 +1782,7 @@ Halt execution within this context (without revert), optionally returning some d
[See in table.](#isa-table-return)
-- **Opcode**: 0x38
+- **Opcode**: 0x37
- **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]`.
@@ -1828,7 +1804,7 @@ Halt execution within this context as `reverted`, optionally returning some data
[See in table.](#isa-table-revert)
-- **Opcode**: 0x39
+- **Opcode**: 0x38
- **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]`.
diff --git a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr
index 1172b4e90130..86ce4f779393 100644
--- a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr
+++ b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr
@@ -100,11 +100,7 @@ contract TokenBridge {
// `mint_private` on token is public. So we call an internal public function
// which then calls the public method on the token contract.
// Since the secret_hash is passed, no secret is leaked.
- context.call_public_function(
- context.this_address(),
- FunctionSelector::from_signature("_call_mint_on_token(Field,Field)"),
- [amount, secret_hash_for_redeeming_minted_notes]
- );
+ TokenBridge::at(context.this_address())._call_mint_on_token(amount, secret_hash_for_redeeming_minted_notes).enqueue(&mut context);
}
// docs:end:claim_private
@@ -125,11 +121,7 @@ contract TokenBridge {
// docs:start:call_assert_token_is_same
// Assert that user provided token address is same as seen in storage.
- context.call_public_function(
- context.this_address(),
- FunctionSelector::from_signature("_assert_token_is_same((Field))"),
- [token.to_field()]
- );
+ TokenBridge::at(context.this_address())._assert_token_is_same(token).enqueue(&mut context);
// docs:end:call_assert_token_is_same
// Burn tokens
@@ -137,12 +129,12 @@ contract TokenBridge {
}
/// docs:end:exit_to_l1_private
- // View function that is callable by other contracts.
- // Unconstrained can't be called by others since it isn't safe.
+ // docs:start:get_token
#[aztec(public)]
fn get_token() -> AztecAddress {
storage.token.read()
}
+ // docs:end:get_token
// docs:start:call_mint_on_token
// This is a public call as we need to read from public storage.
|