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

110 lines
22 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="989px" preserveAspectRatio="none" style="width:1429px;height:989px;" version="1.1" viewBox="0 0 1429 989" width="1429px" zoomAndPan="magnify"><defs><filter height="300%" id="f1harfv0wr5n65" 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="105" x="660.25" y="28.708">Undelegate</text><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="640.5" x="20" y="190.5156"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="551.3438" style="stroke:#000000;stroke-width:2.0;" width="1405.5" x="10" y="250.7813"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="640.5" x="20" y="317.0469"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="640.5" x="20" y="377.3125"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="82.6797" style="stroke:#000000;stroke-width:2.0;" width="619" x="304" y="437.5781"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="132.3359" style="stroke:#000000;stroke-width:2.0;" width="455" x="570.5" y="534.2578"/><rect fill="#FFFFFF" height="86.0703" style="stroke:none;stroke-width:1.0;" width="455" x="570.5" y="580.5234"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="56.2656" style="stroke:#000000;stroke-width:2.0;" width="835" x="570.5" y="738.8594"/><rect fill="#FFFFFF" filter="url(#f1harfv0wr5n65)" height="46.2656" style="stroke:#000000;stroke-width:2.0;" width="572" x="570.5" y="816.125"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="77" x2="77" y1="102.25" y2="921.5234"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="615.5" x2="615.5" y1="102.25" y2="921.5234"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="993.5" x2="993.5" y1="102.25" y2="921.5234"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="1078.5" x2="1078.5" y1="102.25" y2="921.5234"/><rect fill="#FEFECE" filter="url(#f1harfv0wr5n65)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="91" x="30" y="66.9531"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="77" x="37" y="86.9482">msgServer</text><rect fill="#FEFECE" filter="url(#f1harfv0wr5n65)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="91" x="30" y="920.5234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="77" x="37" y="940.5186">msgServer</text><rect fill="#FEFECE" filter="url(#f1harfv0wr5n65)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="66" x="580.5" y="66.9531"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="52" x="587.5" y="86.9482">keeper</text><rect fill="#FEFECE" filter="url(#f1harfv0wr5n65)" height="30.2969" style="stroke:#A80036;stroke-width:1.5;" width="66" x="580.5" y="920.5234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="52" x="587.5" y="940.5186">keeper</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="38" x="971.5" y="98.9482">store</text><path d="M975.5,49.9531 C975.5,39.9531 993.5,39.9531 993.5,39.9531 C993.5,39.9531 1011.5,39.9531 1011.5,49.9531 L1011.5,75.9531 C1011.5,85.9531 993.5,85.9531 993.5,85.9531 C993.5,85.9531 975.5,85.9531 975.5,75.9531 L975.5,49.953
@startuml
'https://plantuml.com/sequence-diagram
title: Undelegate
msgServer -> keeper : Undelegate(delAddr, valAddr, tokenAmount)
keeper -> keeper : calculate number of shares the tokenAmount represents
alt wrong denom
msgServer <- - keeper : error
end
group Unbond(delAddr, valAddr, shares)
keeper -> keeper: BeforeDelegationSharesModified hook
alt no such delegation
keeper - -> msgServer : error
end
alt not enough shares
keeper - -> msgServer : error
end
alt delegator is the operator of the validator\nand validator is not already jailed\nand unbonding would put self-delegation under min threshold
keeper -> keeper : jail the validator, but proceed with unbonding
note left : Default min delegation threshold : 1 share
end
database store
alt complete unbonding, all shares removed
keeper -> store : remove delegation object
else there are still shares delegated (not a complete undbonding)
keeper -> store : update delegation object
keeper -> keeper : AfterDelegationModified hook
end
keeper -> store : update validator power index
keeper -> store : update validator information (including token amount)
alt validator status is "unbonded" and it has no more tokens
keeper -> store : delete the validator
note right : otherwise, do this in EndBlock once validator is unbonded
end
end
alt validator is bonded
keeper -> bankKeeper : send tokens from bonded pool to not bonded pool
end
msgServer -> msgServer : emit event : EventTypeUnbond(delAddr, valAddr, tokenAmount, completion time)
@enduml
@startuml
title: Undelegate
msgServer -> keeper : Undelegate(delAddr, valAddr, tokenAmount)
keeper -> keeper : calculate number of shares the tokenAmount represents
alt wrong denom
msgServer <- - keeper : error
end
group Unbond(delAddr, valAddr, shares)
keeper -> keeper: BeforeDelegationSharesModified hook
alt no such delegation
keeper - -> msgServer : error
end
alt not enough shares
keeper - -> msgServer : error
end
alt delegator is the operator of the validator\nand validator is not already jailed\nand unbonding would put self-delegation under min threshold
keeper -> keeper : jail the validator, but proceed with unbonding
note left : Default min delegation threshold : 1 share
end
database store
alt complete unbonding, all shares removed
keeper -> store : remove delegation object
else there are still shares delegated (not a complete undbonding)
keeper -> store : update delegation object
keeper -> keeper : AfterDelegationModified hook
end
keeper -> store : update validator power index
keeper -> store : update validator information (including token amount)
alt validator status is "unbonded" and it has no more tokens
keeper -> store : delete the validator
note right : otherwise, do this in EndBlock once validator is unbonded
end
end
alt validator is bonded
keeper -> bankKeeper : send tokens from bonded pool to not bonded pool
end
msgServer -> msgServer : emit event : EventTypeUnbond(delAddr, valAddr, tokenAmount, completion time)
@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>