Skip to content

Commit

Permalink
docs: write gateway.md (#283)
Browse files Browse the repository at this point in the history
* doc: write gateway.md

* docs: address reviews (fix wording)
  • Loading branch information
maancham authored Feb 29, 2024
1 parent 155f87f commit 2557b81
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions doc/src/contracts/gateway.md
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.

0 comments on commit 2557b81

Please sign in to comment.