-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* doc: write gateway.md * docs: address reviews (fix wording)
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Gateway | ||
|
||
The name `gateway` used in this documentation refers to those entities which reside | ||
on axelar chain, which can also be called internal gateways. On the other hand we have | ||
external gateways, which are gateways deployed on external chains connected to Axelar. | ||
|
||
The gateway contract is how messages enter the amplifier protocol. | ||
Here are the steps taken throughout the lifecycle of | ||
a message: | ||
1. User sends a message to the external gateway. We call this incoming message. | ||
2. Incoming messages are sent to the gateway via `VerifyMessages`. | ||
3. The gateway calls `VerifyMessages` on the verifier, which submits the messages for verification (or just returns true if already verified). | ||
4. The messages are verified asynchronously, and the verification status is stored in the verifier. | ||
5. Once the messages are verified, `RouteMessages` is called at the gateway, which forwards the verified messages to the router. | ||
6. The router forwards each message to the gateway registered to the destination chain specified in the message. | ||
7. The prover retrieves the messages from the gateway, organizes them into a batch and submits the batch for signing. | ||
8. The relayer sends the signed batch to the external gateway. | ||
|
||
|
||
## Gateway graph | ||
```mermaid | ||
flowchart TD | ||
subgraph Axelar | ||
Sg{"Source Gateway"} | ||
Dg{"Destination Gateway"} | ||
Rt{"Router"} | ||
end | ||
Rl{"Relayer"} | ||
Eg{"External Gateway"} | ||
Rl -- "Listen for Message:M1 Event" --> Eg | ||
Rl -- "M1" --> Sg | ||
Sg -- "M1" --> Rt | ||
Rt -- "M1" --> Dg | ||
``` | ||
|
||
|
||
## Interface | ||
|
||
```Rust | ||
pub struct InstantiateMsg { | ||
pub verifier_address: String, | ||
pub router_address: String, | ||
} | ||
``` | ||
|
||
As you can see, the gateway only needs to know the address of the two contracts it | ||
works with, which are voting verifier and router. |