Beamer contracts
Architecture
The following figure shows the Beamer contract architecture:
![digraph "Beamer contracts" {
graph[rankdir=TD, ranksep=6, splines=ortho, nodesep=1.2, pad=1]
node [shape=box, width=1.5, height=1, fontname="Liberation Mono"]
edge [fontname="Liberation Mono"]
subgraph L1 {
rank=same
nodesep = 1.0
l1dummy [style=invis]
Resolver [label="Resolver"]
L1Messenger [label="L1Messenger", color="purple"]
}
subgraph L2 {
graph[nodesep=1]
rank=same
l2dummy [style=invis]
RequestManager [label="RequestManager"]
FillManager [label="FillManager"]
L2Messenger [label="L2Messenger", color="purple"]
}
{
# restricted calls
edge [color=red]
FillManager -> L2Messenger [headlabel="sendMessage()"]
Resolver -> L1Messenger [xlabel="sendMessage()"]
}
{
# restricted calls crossing the L1/L2 boundary
edge [color=red, style=dashed]
L2Messenger -> Resolver [headlabel="resolve()"]
L1Messenger -> RequestManager [headlabel="resolveRequest()"]
}
{
# unrestricted calls
Resolver -> L1Messenger [headlabel="callAllowed()"]
RequestManager -> L2Messenger [headlabel="callAllowed()"]
}
l1dummy -> l2dummy [style=invis]
l1dummy -> Resolver [style=invis]
l2dummy -> RequestManager [style=invis]
}](_images/graphviz-78bc9430eaee026f0689f90ebba2dde649eabf41.png)
Beamer contracts
Contracts in purple rectangles are chain-dependent. Red lines indicate restricted calls. Dashed red lines indicate restricted calls that cross the L1-L2 boundary. Black lines represent ordinary, unrestricted calls.
Here, “a restricted call” means “a call that only a specific caller is allowed to make”.
For example, the L1Messenger
contract may only be called by the Resolver
contract.
In this way, a chain of trust is established to ensure that L1 resolution is safe.
The complete trusted call chain is:
FillManager -> L2Messenger -> Resolver -> L1Messenger -> RequestManager
The Resolver
contract is deployed on L1 and is used by all L2 chains.
Messenger contracts are specific to L2 chains and are responsible for
sending messages to the other side (an instance of
L1Messenger
is deployed on L1 and sends messages to the L2 chain it is related to; similarly, an instance ofL2Messenger
is deployed on its L2 chain and sends messages to L1)answering the question “where did this message really come from?” (this is because the
msg.sender
will be the rollup’s messenger contract that relayed the message, not the original message sender)
The following tables list Beamer contracts. It should be noted that the interfacing contracts are chain-dependent and are mostly used to facilitate message transfer between L1 and L2.
Contract |
Deployed on |
---|---|
|
L2 |
|
L2 |
|
L1 |
Contract |
Deployed on |
---|---|
|
L1 |
|
L2 |