forked from paritytech/parity-bridges-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhigh-level.html
55 lines (55 loc) · 2.52 KB
/
high-level.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>High Level Bridge Components</title>
</head>
<body>
<h1>Header Sync</h1>
<p>Header pallet on the target chain, keeps track of the forks, but requires finality for blocks that perform authority set changes. That means, it won't sync a fork with authority set change unless that change finalized.</p>
<div class="mermaid">
sequenceDiagram
participant Source Chain
participant Relayer
participant Target Chain
Note right of Target Chain: Best: 0, Finalized: 0
Source Chain ->> Source Chain: Import Block 1
Source Chain ->> Source Chain: Import Block 2
Relayer ->> Target Chain: Submit Block 1
Note right of Target Chain: Best: 1, Finalized: 0
Relayer ->> Target Chain: Submit Block 2
Note right of Target Chain: Best: 2, Finalized: 0
Source Chain ->> Source Chain: Import Block 2'
Relayer ->> Target Chain: Submit Block 2'
Note right of Target Chain: Best: 2 or 2', Finalized: 0
Source Chain ->> Source Chain: Finalize Block 2'
Relayer ->> Target Chain: Submit Finality of Block 2'
Note right of Target Chain: Best: 2', Finalized: 2'
</div>
<h1>Message Delivery (single lane)</h1>
<p>Pending messages are stored on-chain (source) so the relayer code is completely stateless - it can read all the details from the chain.</p>
<p>Delivering pending messages requires finality first.</p>
<div class="mermaid">
sequenceDiagram
participant Source Chain
participant Relayer
participant Target Chain
Source Chain ->> Source Chain: Queue Message 1
Source Chain ->> Source Chain: Queue Message 2
Source Chain ->> Source Chain: Queue Message 3
Note left of Source Chain: Queued Messages: [1, 2, 3, ]
Note left of Source Chain: Reward for [1, 2, 3, ] reserved
Relayer ->> Target Chain: Deliver Messages 1..2
Note right of Target Chain: Target chain dispatches the messages.<br> To Confirm: {1..2 => relayer_1}
Relayer ->> Source Chain: Delivery Confirmation of 1..2
Note left of Source Chain: Queued Messages: [3, ]
Note left of Source Chain: Reward payout for [1, 2, ]
Relayer -->> Target Chain: Confirmed Messages 1..2
Note right of Target Chain: To Confirm: {}
Note over Relayer, Target Chain: (this is not a separate transaction, <br >it's bundled with the "Deliver Messages" proof)
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad: true})</script>
</body>
</html>