Skip to content

feat:! Allow outgoing messages to any address #4488

Description

@LHerskind

Problem

We want to support sending messages to any address from an aztec contract.

Background

Currently, an aztec contract specify a portal_address at time of deployment.

The use of this address is rather simple:

  • for incoming messages it can be used to constrain L1 sender (app-circuit can chose to do this)
  • for outgoing messages it must be used as the recipient (kernel always enforces this)

The reasoning behind this is the same issue as discussed in #4130 - having a value that anyone can use to constrain against (without having race-conditions) is quite painful in the private domain.

By having the immutable value portal_address we have an easily accessible value in private that you can still constraint against.

However, hence we are currently forcing it in the kernel, we have this issue where applications that would want to send messages to different address, in private or public, simple cannot do that currently.

This means that applications such as upgradable bridges need to have a somewhat awkward design since it might be desirable to change the portal address sending messages to.

Solution

Since we have alternatives (even if not perfect) to stable values in private and public could always just used shared storage, we can allow sending messages to any address intended by adding another argument to the message_portal() function while still keeping the portal_address immutable.

By keeping the portal_address we can always use the "easy" solution for the communication, but allow more flexibility to developers that need it.

### Tasks
- [x] Add a `recipient` argument to `message_portal` functions on context
- [x] Extend the `new_l2_to_l1_msgs` to be tuples of `(msg, recipient)`
- [x] Use the `recipient` instead of the the `portal_address`
- [x] Update existing implementations with portals to use new api
- [ ] Add new test using one aztec contract to send

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions