Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/uml_sequence_diagrams #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions uml/BatchRequesterLoop.puml
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions uml/EthOracleMainLoop.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@startuml
'https://plantuml.com/sequence-diagram

participant PeggyOrchestrator as peggo
participant InjectiveNetwork as injective
participant ethOracleLoop
participant EthereumNetwork as ethereum

peggo -> peggo ++: EthOracleMainLoop
peggo -> peggo ++ : getLastConfirmedEthHeightOnInjective
peggo -> peggo ++ : getLastClaimBlockHeight
peggo -> injective ++ : PeggyParams
return params
return
return
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
ethOracleLoop <-- injective

return

peggo <-- ethOracleLoop
deactivate peggo


@enduml
36 changes: 36 additions & 0 deletions uml/EthSignerMainLoop.puml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions uml/RelayerMainLoop.puml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions uml/orchestratorStart.puml
Original file line number Diff line number Diff line change
@@ -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