-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat x/bridge: added module docs (#7854)
* feat x/bridge: added module docs * typo fix * docs linter fix
- Loading branch information
Showing
13 changed files
with
730 additions
and
64 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
File renamed without changes
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,43 @@ | ||
@startuml | ||
|
||
participant "Alice BTC addr" as alice_btc | ||
participant "BTC vault" as btc_vault | ||
participant "Valset" as valset | ||
participant "x/bridge" as bridge | ||
participant "x/tokenfactory" as tokenfactory | ||
participant "Alice OSMO addr" as alice_osmo | ||
|
||
== BTC to OSMO == | ||
|
||
alice_btc --> btc_vault : Send tx with the osmo\naddress in memo | ||
valset --> btc_vault : Observe the tx | ||
valset --> bridge : **MsgInboundTransfer** | ||
bridge --> tokenfactory : Mint tokens to\nthe osmo address | ||
note over tokenfactory | ||
x/bridge is the admin | ||
end note | ||
tokenfactory --> alice_osmo : Update Alice balance | ||
|
||
alt failure | ||
bridge --> alice_btc : Refund | ||
end | ||
|
||
== OSMO to BTC == | ||
|
||
alice_osmo --> bridge : **MsgOutboundTransfer** | ||
bridge --> tokenfactory : Burn tokens from\nthe osmo address | ||
note over tokenfactory | ||
x/bridge is the admin | ||
end note | ||
tokenfactory --> alice_osmo : Update Alice balance | ||
|
||
valset --> bridge : Observe x/bridge event | ||
|
||
valset --> btc_vault : Release BTC for Alice | ||
valset --> alice_btc : Send BTC | ||
|
||
alt failure | ||
bridge --> alice_osmo : Refund | ||
end | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,47 @@ | ||
@startuml | ||
|
||
left to right direction | ||
|
||
legend right | ||
|= Color |= Transfer | | ||
|<#green> | Outbound | | ||
|<#blue> | Inbound | | ||
endlegend | ||
|
||
node "Bitcoin" as bitcoin | ||
node "Osmosis" as osmosis | ||
node "Ethereum" as eth | ||
|
||
folder "Observer" as observer { | ||
folder "Bitcoin" as bitcoin_observer { | ||
component "Client" as bitcoin_chain_client | ||
component "Observer" as bitcoin_observer_1 | ||
} | ||
|
||
folder "Ethereum" as eth_observer { | ||
component "Client" as eth_chain_client | ||
component "Observer" as eth_observer_1 | ||
} | ||
|
||
folder "Osmosis" as osmosis_observer { | ||
component "Client" as osmosis_chain_client | ||
component "Observer" as osmosis_observer_1 | ||
} | ||
} | ||
|
||
bitcoin -d-> bitcoin_observer_1 #blue : inbound transfer | ||
bitcoin_observer_1 --d-> osmosis_chain_client #blue | ||
|
||
osmosis_observer_1 --u-> bitcoin_chain_client #green | ||
bitcoin_chain_client -u-> bitcoin #green : release coins | ||
|
||
eth -d-> eth_observer_1 #blue : inbound transfer | ||
eth_observer_1 --d-> osmosis_chain_client #blue | ||
|
||
osmosis_observer_1 --u-> eth_chain_client #green | ||
eth_chain_client -u-> eth #green : release coins | ||
|
||
osmosis_chain_client -d-> osmosis #blue : **MsgInboundTransfer** | ||
osmosis -u-> osmosis_observer_1 #green : **EventOutboundTransfer** | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,113 @@ | ||
@startuml | ||
|
||
skinparam package<<Hidden>> { | ||
borderColor Transparent | ||
backgroundColor Transparent | ||
fontColor Transparent | ||
stereotypeFontColor Transparent | ||
} | ||
|
||
actor "Client" as client | ||
|
||
folder "Valset" as valset1 { | ||
cloud "Validator 1" as val1 #lightgreen | ||
cloud "Validator 2" as val2 | ||
cloud "Validator 3" as val3 #lightgreen | ||
cloud "Validator 4" as val4 | ||
cloud "Validator 5" as val5 #lightgreen | ||
} | ||
|
||
val1 -> val2 #white | ||
val2 -> val3 #white | ||
val3 -> val4 #white | ||
val4 -> val5 #white | ||
|
||
note bottom of valset1 | ||
Green validators are | ||
running x/bridge observers. | ||
|
||
Let's say that we need **three** | ||
votes to process the transfer. | ||
end note | ||
|
||
client --> val2 : **MsgOutboundTransfer** to the selected node | ||
client --> val4 #white | ||
|
||
node "x/bridge" as bridge | ||
|
||
val2 --> bridge : **InboundTransfer** | ||
val4 --> bridge #white | ||
|
||
node "x/tokenfactory" as tokenfactory | ||
|
||
bridge <-left-> tokenfactory : **Burn** from\nthe source addr | ||
|
||
artifact "**EventOutboundTransfer**" as event | ||
|
||
bridge --> event : Produce the event | ||
|
||
folder "Valset" as valset2 { | ||
cloud "Validator 1" as val1_2 #lightgreen | ||
cloud "Validator 2" as val2_2 | ||
cloud "Validator 3" as val3_2 #lightgreen | ||
cloud "Validator 4" as val4_2 | ||
cloud "Validator 5" as val5_2 #lightgreen | ||
} | ||
|
||
val1_2 -> val2_2 #white | ||
val2_2 -> val3_2 #white | ||
val3_2 -> val4_2 #white | ||
val4_2 -> val5_2 #white | ||
|
||
val1_2 -u-> event: observe | ||
val3_2 -u-> event: observe | ||
val5_2 -u-> event: observe | ||
|
||
|
||
component " TSS Server " as tss | ||
|
||
val1_2 -d-> tss : sign | ||
val3_2 -d-> tss : sign | ||
val5_2 -d-> tss : sign | ||
|
||
action "Collect signatures x3" as signatures | ||
|
||
tss --> signatures | ||
|
||
action "Leader election" as leader | ||
|
||
note left of leader | ||
Leader is the one who | ||
broadcasts the transfer | ||
to the external chain | ||
end note | ||
|
||
signatures --> leader | ||
|
||
folder "Valset" as valset3 { | ||
cloud "Validator 1" as val1_3 #lightgreen | ||
cloud "Validator 2" as val2_3 | ||
cloud "Validator 3" as val3_3 #lightgreen | ||
cloud "Validator 4" as val4_3 | ||
cloud "Validator 5" as val5_3 #lightgreen | ||
|
||
val1_3 -> val2_3 #white | ||
val2_3 -> val3_3 #white | ||
val3_3 -> val4_3 #white | ||
val4_3 -> val5_3 #white | ||
} | ||
|
||
leader -d-> val1_3 #white | ||
leader -d-> val3_3 #white | ||
leader -d-> val5_3 : choose leader | ||
|
||
node "BTC vault" as vault | ||
|
||
val1_3 --> vault #white | ||
val5_3 --> vault : release coins | ||
|
||
actor "Happy client" as client1 #lightgreen;line:green;line.bold;text:green | ||
|
||
vault --> client1 : coins are transferred to the destination addr | ||
|
||
@enduml |