diff --git a/uml/BatchRequesterLoop.puml b/uml/BatchRequesterLoop.puml new file mode 100644 index 00000000..5aae4b22 --- /dev/null +++ b/uml/BatchRequesterLoop.puml @@ -0,0 +1,32 @@ +@startuml +'https://plantuml.com/sequence-diagram + +participant PeggyOrchestrator as peggo +participant batchRequestLoop +participant InjectiveNetwork as injective +entity PeggyChainModule as peggyModule + +peggo -> peggo ++ : BatchRequesterLoop + peggo -> batchRequestLoop ** + peggo -> batchRequestLoop ++ : Run + batchRequestLoop -> batchRequestLoop ++ : requestBatches + batchRequestLoop -> batchRequestLoop ++ : getUnbatchedTokenFees + batchRequestLoop -> injective ++ : UnbatchedTokensWithFees + injective -> peggyModule : BatchFees + return unbatched tokens with fees + return unbatched token with fees + loop fees + batchRequestLoop -> batchRequestLoop ++ : requestBatch + batchRequestLoop -> batchRequestLoop : tokenDenom + batchRequestLoop -> batchRequestLoop : checkFeeThreshold + batchRequestLoop -> injective : SendRequestBatch + return + end + + return + + return + +return + +@enduml \ No newline at end of file diff --git a/uml/EthOracleMainLoop.puml b/uml/EthOracleMainLoop.puml new file mode 100644 index 00000000..18de1cd5 --- /dev/null +++ b/uml/EthOracleMainLoop.puml @@ -0,0 +1,60 @@ +@startuml +'https://plantuml.com/sequence-diagram + +participant PeggyOrchestrator as peggo +participant ethOracleLoop +participant InjectiveNetwork as injective +participant EthereumNetwork as ethereum + +peggo -> peggo ++: EthOracleMainLoop + peggo -> peggo ++ : getLastConfirmedEthHeightOnInjective + peggo -> peggo ++ : getLastClaimBlockHeight + peggo -> injective ++ : PeggyParams + return params + return + return + peggo -> ethOracleLoop ** + peggo -> ethOracleLoop ++ : Run + ethOracleLoop -> ethOracleLoop ++ : observeEthEvents + ethOracleLoop -> ethOracleLoop ++ : relayEvents + ethOracleLoop -> ethereum : HeaderByNumber + ethOracleLoop <-- ethereum : header + ethOracleLoop -> ethereum : GetSendToCosmosEvents + ethOracleLoop <-- ethereum : events + ethOracleLoop -> ethereum : GetSendToInjectiveEvents + ethOracleLoop <-- ethereum : events + ethOracleLoop -> ethereum : GetTransactionBatchExecutedEvents + ethOracleLoop <-- ethereum : events + ethOracleLoop -> ethereum : GetPeggyERC20DeployedEvents + ethOracleLoop <-- ethereum : events + ethOracleLoop -> ethereum : GetValsetUpdatedEvents + ethOracleLoop <-- ethereum : events + + ethOracleLoop -> injective : LastClaimEvent + ethOracleLoop <-- injective : event + + note left ethOracleLoop: Filter events\nby nonce + + ethOracleLoop -> injective ++ : SendEthereumClaims + loop + injective -> injective : sendOldDepositClaims + end + loop + injective -> injective : sendDepositClaims + end + loop + injective -> injective : sendWithdrawClaims + end + loop + injective -> injective : sendValsetUpdateClaims + end + loop + injective -> injective : sendErc20DeployedClaims + end + return + return + return + return +return + +@enduml \ No newline at end of file diff --git a/uml/EthSignerMainLoop.puml b/uml/EthSignerMainLoop.puml new file mode 100644 index 00000000..0963b023 --- /dev/null +++ b/uml/EthSignerMainLoop.puml @@ -0,0 +1,36 @@ +@startuml +'https://plantuml.com/sequence-diagram + +participant PeggyOrchestrator as peggo +participant ethSignerLoop +participant InjectiveNetwork as injective +entity PeggyChainModule as peggyModule +entity InjectiveNode as chainNode + +peggo -> peggo ++ : BatchRequesterLoop + peggo -> ethSignerLoop ** + peggo -> ethSignerLoop ++ : Run + ethSignerLoop -> ethSignerLoop ++ : signNewValsetUpdates + ethSignerLoop -> ethSignerLoop ++ : getUnsignedValsets + ethSignerLoop -> injective ++ : OldestUnsignedValsets + injective -> peggyModule : LastPendingValsetRequestByAddr + injective <-- peggyModule : unsigned valsets + return unsigned valsets + return unsigned valsets + loop unsigned valsets + ethSignerLoop -> ethSignerLoop ++ : signValset + ethSignerLoop -> injective ++ : SendValsetConfirm + injective -> chainNode : QueueBroadcastMsg(MsgValsetConfirm) + return + return + end + return + ethSignerLoop -> ethSignerLoop ++ : signNewBatch + + return + + return + +return + +@enduml \ No newline at end of file diff --git a/uml/RelayerMainLoop.puml b/uml/RelayerMainLoop.puml new file mode 100644 index 00000000..b1b4c884 --- /dev/null +++ b/uml/RelayerMainLoop.puml @@ -0,0 +1,52 @@ +@startuml +'https://plantuml.com/sequence-diagram + +participant PeggyOrchestrator as peggo +participant relayerLoop +participant InjectiveNetwork as injective +participant EthereumNetwork as ethereum +entity PeggyChainModule as peggyModule +entity InjectiveNode as chainNode + +peggo -> peggo ++ : RelayerMainLoop + peggo -> relayerLoop ** + peggo -> relayerLoop ++ : Run + relayerLoop -> relayerLoop ++ : relayValsetsAndBatches + relayerLoop -> relayerLoop ++ : relayValset + relayerLoop -> injective ++ : LatestValsets + injective -> peggyModule : LastValsetRequests + injective <-- peggyModule : valsets + return valsets + loop valsets + relayerLoop -> injective ++ : AllValsetConfirms + injective -> peggyModule : ValsetConfirmsByNonce + injective <-- peggyModule : confirms + return confirms + end + relayerLoop -> relayerLoop ++ : findLatestValsetOnEth + relayerLoop -> ethereum : HeaderByNumber + relayerLoop -> ethereum : GetValsetNonce + relayerLoop <-- ethereum : latest Ethereum valset nonce + relayerLoop -> injective ++ : ValsetAt + injective -> peggyModule : ValsetRequest + injective <-- peggyModule : valset + return valset + loop blocks to search + relayerLoop -> ethereum : GetValsetUpdatedEvents + end + return valset + relayerLoop -> ethereum : GetValsetNonce + relayerLoop -> injective ++ : GetBlockCreationTime + injective -> chainNode : GetBlock + injective <-- chainNode : block + return block time + relayerLoop -> ethereum : SendEthValsetUpdate + return + relayerLoop -> relayerLoop ++ : relayBatch + + return + return + return + +return +@enduml \ No newline at end of file diff --git a/uml/orchestratorStart.puml b/uml/orchestratorStart.puml new file mode 100644 index 00000000..0f5ddde9 --- /dev/null +++ b/uml/orchestratorStart.puml @@ -0,0 +1,31 @@ +@startuml +'https://plantuml.com/sequence-diagram + +participant PeggyOrchestrator as peggo +participant InjectiveNetwork as injective + +[-> peggo : Run +peggo -> peggo : hasRegisteredETHAddress + +alt Has ETH address + peggo <-- injective : True + peggo -> peggo : startValidatorMode + activate peggo + peggo -> peggo : EthOracleMainLoop + peggo -> peggo : BatchRequesterLoop + peggo -> peggo : EthSignerMainLoop + peggo -> peggo : RelayerMainLoop + [<-- peggo : Return + deactivate peggo + +else No ETH address + peggo <-- injective : False + peggo -> peggo : startRelayerMode + activate peggo + peggo -> peggo : BatchRequesterLoop + peggo -> peggo : RelayerMainLoop + [<-- peggo : Return + deactivate peggo +end + +@enduml \ No newline at end of file