cosmos-sdk/docs/uml/svg/begin_redelegation_sequence...

106 lines
21 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="958px" preserveAspectRatio="none" style="width:1599px;height:958px;" version="1.1" viewBox="0 0 1599 958" width="1599px" zoomAndPan="magnify"><defs><filter height="300%" id="f1w2okko18ktw4" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><text fill="#000000" font-family="sans-serif" font-size="18" lengthAdjust="spacing" textLength="120" x="737.75" y="28.708">Redelegation</text><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="562.5" x="467" y="244.7813"/><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="562.5" x="467" y="305.0469"/><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="71.3984" style="stroke:#000000;stroke-width:2.0;" width="1020.5" x="9" y="365.3125"/><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="562.5" x="467" y="520.8438"/><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="562.5" x="467" y="651.2422"/><rect fill="#FFFFFF" filter="url(#f1w2okko18ktw4)" height="75.3984" style="stroke:#000000;stroke-width:2.0;" width="646" x="939.5" y="711.5078"/><line style="stroke:#A80036;stroke-width:1.0;" x1="524" x2="524" y1="102.25" y2="485.8438"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="524" x2="524" y1="485.8438" y2="513.8438"/><line style="stroke:#A80036;stroke-width:1.0;" x1="524" x2="524" y1="513.8438" y2="616.2422"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="524" x2="524" y1="616.2422" y2="644.2422"/><line style="stroke:#A80036;stroke-width:1.0;" x1="524" x2="524" y1="644.2422" y2="890.3047"/><line style="stroke:#A80036;stroke-width:1.0;" x1="984.5" x2="984.5" y1="102.25" y2="485.8438"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="984.5" x2="984.5" y1="485.8438" y2="513.8438"/><line style="stroke:#A80036;stroke-width:1.0;" x1="984.5" x2="984.5" y1="513.8438" y2="616.2422"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="984.5" x2="984.5" y1="616.2422" y2="644.2422"/><line style="stroke:#A80036;stroke-width:1.0;" x1="984.5" x2="984.5" y1="644.2422" y2="890.3047"/><line style="stroke:#A80036;stroke-width:1.0;" x1="1553.5" x2="1553.5" y1="102.25" y2="485.8438"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="1553.5" x2="1553.5" y1="485.8438" y2="513.8438"/><line style="stroke:#A80036;stroke-width:1.0;" x1="1553.5" x2="1553.5" y1="513.8438" y2="616.2422"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:1.0,4.0;" x1="1553.5" x2="1553.5" y1="616.2422" y2="644.2422"/><line style="stroke:#A80036;stroke-width:1.0;" x1="1553.5" x2="1553.5" y1="644.2422" y2="890.3047"/><rect fill="#FEFECE" filter="url(#f1w2okko18ktw4)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="91" x="477" y="66.9531"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="77" x="484" y="86.9482">msgServer</text><rect fill="#FEFECE" filter="url(#f1w2okko18ktw4)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="91" x="477" y="889.3047"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="77" x="484" y="909.2998">msgServer</text><rect fill="#FEFECE" filter="url(#f1w2okko18ktw4)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="66" x="949.5" y="66.9531"/><text fill="#000000" font-family="sans-serif"
@startuml
'https://plantuml.com/sequence-diagram
title: Redelegation
msgServer -> keeper : BeginRedelegation(delAddr, valSrcAddr, valDstAddr, sharesAmount)
participant "keeper (staking)" as keeper
keeper -> keeper : get number of sharew
note left: If the delegator has more shares than the total shares in the validator\n(due to rounding errors), then just withdraw the max number of shares.
keeper -> keeper : check the redelegation uses correct denom
alt valSrcAddr == valDstAddr
keeper - -> msgServer : error
end
alt transitive redelegation
keeper - -> msgServer : error
end
alt already has max redelegations
keeper - -> msgServer : error
note left : this is the number of redelegations for a specific (del, valSrc, valDst) triple\ndefault : 7
end
keeper -> keeper : Unbond(del, valSrc) returns returnAmount
...
note left : See unbonding diagram
alt returnAmount is zero
keeper -> msgServer : error
end
keeper -> keeper : Delegate(del, returnAmount, status := valSrc.status, valDst, subtractAccount := false)
note left : See delegation diagram
...
alt validator is unbonded
keeper -> msgServer : current time
end
alt unbonding not complete, or just started
database store
keeper -> store : create redelegation object
keeper -> store : insert redelegation in queue, to be processed at the appropriate time
end
msgServer <- - keeper : completion time of the redelegation
msgServer -> msgServer : emit event: delegator, valSrc, valSrc,\nsharesAmount, completionTime
@enduml
@startuml
title: Redelegation
msgServer -> keeper : BeginRedelegation(delAddr, valSrcAddr, valDstAddr, sharesAmount)
participant "keeper (staking)" as keeper
keeper -> keeper : get number of sharew
note left: If the delegator has more shares than the total shares in the validator\n(due to rounding errors), then just withdraw the max number of shares.
keeper -> keeper : check the redelegation uses correct denom
alt valSrcAddr == valDstAddr
keeper - -> msgServer : error
end
alt transitive redelegation
keeper - -> msgServer : error
end
alt already has max redelegations
keeper - -> msgServer : error
note left : this is the number of redelegations for a specific (del, valSrc, valDst) triple\ndefault : 7
end
keeper -> keeper : Unbond(del, valSrc) returns returnAmount
...
note left : See unbonding diagram
alt returnAmount is zero
keeper -> msgServer : error
end
keeper -> keeper : Delegate(del, returnAmount, status := valSrc.status, valDst, subtractAccount := false)
note left : See delegation diagram
...
alt validator is unbonded
keeper -> msgServer : current time
end
alt unbonding not complete, or just started
database store
keeper -> store : create redelegation object
keeper -> store : insert redelegation in queue, to be processed at the appropriate time
end
msgServer <- - keeper : completion time of the redelegation
msgServer -> msgServer : emit event: delegator, valSrc, valSrc,\nsharesAmount, completionTime
@enduml
PlantUML version 1.2021.5beta3(Unknown compile time)
(GPL source distribution)
Java Runtime: Java(TM) SE Runtime Environment
JVM: Java HotSpot(TM) 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>