Added ER.svg and database_schema.md to document the logical data model. Refactored and extended transaction validation in blockchain/abci.go to enforce ID prefix rules, entity existence, and uniqueness for promises, commitments, commiters, and beneficiaries. Updated lbc_sdk dependency version in go.mod and go.sum.
1 line
No EOL
11 KiB
XML
1 line
No EOL
11 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="CLASS" height="490px" preserveAspectRatio="none" style="width:436px;height:490px;background:#FFFFFF;" version="1.1" viewBox="0 0 436 490" width="436px" zoomAndPan="magnify"><defs/><g><!--class Promise--><g class="entity" data-entity="Promise" data-source-line="1" data-uid="ent0002" id="entity_Promise"><rect fill="#F1F1F1" height="129.4844" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="182.5498" x="7" y="197"/><ellipse cx="65.9258" cy="213" fill="#ADD1B2" rx="11" ry="11" style="stroke:#181818;stroke-width:1;"/><path d="M70.0352,219 L62.3164,219 L62.3164,206.6094 L70.0352,206.6094 L70.0352,208.7656 L64.7695,208.7656 L64.7695,211.4375 L69.5352,211.4375 L69.5352,213.5938 L64.7695,213.5938 L64.7695,216.8438 L70.0352,216.8438 L70.0352,219 Z " fill="#000000"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="56.1982" x="86.4258" y="217.8467">Promise</text><line style="stroke:#181818;stroke-width:0.5;" x1="8" x2="188.5498" y1="229" y2="229"/><ellipse cx="18" cy="242.6484" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="54.5986" x="27" y="245.9951">ID: uuid</text><line style="stroke:#181818;stroke-width:1;" x1="8" x2="188.5498" y1="253.2969" y2="253.2969"/><ellipse cx="18" cy="266.9453" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="64.9209" x="27" y="270.292">text: text</text><ellipse cx="18" cy="283.2422" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="98.7383" x="27" y="286.5889">due: datetime</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="133.3281" x="27" y="302.8857">BeneficiaryID: uuid</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="156.5498" x="27" y="319.1826">ParentPromiseID: uuid</text></g><!--class Beneficiary--><g class="entity" data-entity="Beneficiary" data-source-line="10" data-uid="ent0003" id="entity_Beneficiary"><rect fill="#F1F1F1" height="80.5938" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="115.0586" x="41" y="403"/><ellipse cx="57.9481" cy="419" fill="#ADD1B2" rx="11" ry="11" style="stroke:#181818;stroke-width:1;"/><path d="M62.0575,425 L54.3387,425 L54.3387,412.6094 L62.0575,412.6094 L62.0575,414.7656 L56.7918,414.7656 L56.7918,417.4375 L61.5575,417.4375 L61.5575,419.5938 L56.7918,419.5938 L56.7918,422.8438 L62.0575,422.8438 L62.0575,425 Z " fill="#000000"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="78.7295" x="72.381" y="423.8467">Beneficiary</text><line style="stroke:#181818;stroke-width:0.5;" x1="42" x2="155.0586" y1="435" y2="435"/><ellipse cx="52" cy="448.6484" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="54.5986" x="61" y="451.9951">ID: uuid</text><line style="stroke:#181818;stroke-width:1;" x1="42" x2="155.0586" y1="459.2969" y2="459.2969"/><ellipse cx="52" cy="472.9453" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="89.0586" x="61" y="476.292">name: string</text></g><!--class Commitment--><g class="entity" data-entity="Commitment" data-source-line="16" data-uid="ent0004" id="entity_Commitment"><rect fill="#F1F1F1" height="113.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="123.6924" x="213.5" y="7"/><ellipse cx="228.5378" cy="23" fill="#ADD1B2" rx="11" ry="11" style="stroke:#181818;stroke-width:1;"/><path d="M232.6472,29 L224.9284,29 L224.9284,16.6094 L232.6472,16.6094 L232.6472,18.7656 L227.3815,18.7656 L227.3815,21.4375 L232.1472,21.4375 L232.1472,23.5938 L227.3815,23.5938 L227.3815,26.8438 L232.6472,26.8438 L232.6472,29 Z " fill="#000000"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="91.6084" x="242.5462" y="27.8467">Commitment</text><line style="stroke:#181818;stroke-width:0.5;" x1="214.5" x2="336.1924" y1="39" y2="39"/><ellipse cx="224.5" cy="52.6484" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="54.5986" x="233.5" y="55.9951">ID: uuid</text><line style="stroke:#181818;stroke-width:1;" x1="214.5" x2="336.1924" y1="63.2969" y2="63.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="98.5264" x="219.5" y="80.292">PromiseID: int</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="111.6924" x="219.5" y="96.5889">CommiterID: int</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="98.7383" x="219.5" y="112.8857">due: datetime</text></g><!--class Commiter--><g class="entity" data-entity="Commiter" data-source-line="24" data-uid="ent0005" id="entity_Commiter"><rect fill="#F1F1F1" height="80.5938" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="115.0586" x="314" y="221"/><ellipse cx="335.1625" cy="237" fill="#ADD1B2" rx="11" ry="11" style="stroke:#181818;stroke-width:1;"/><path d="M339.2718,243 L331.5531,243 L331.5531,230.6094 L339.2718,230.6094 L339.2718,232.7656 L334.0062,232.7656 L334.0062,235.4375 L338.7718,235.4375 L338.7718,237.5938 L334.0062,237.5938 L334.0062,240.8438 L339.2718,240.8438 L339.2718,243 Z " fill="#000000"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="69.3643" x="350.5319" y="241.8467">Commiter</text><line style="stroke:#181818;stroke-width:0.5;" x1="315" x2="428.0586" y1="253" y2="253"/><ellipse cx="325" cy="266.6484" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="42.3281" x="334" y="269.9951">ID: int</text><line style="stroke:#181818;stroke-width:1;" x1="315" x2="428.0586" y1="277.2969" y2="277.2969"/><ellipse cx="325" cy="290.9453" fill="#000000" rx="3" ry="3" style="stroke:#000000;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="89.0586" x="334" y="294.292">name: string</text></g><!--link Commitment to Promise--><g class="link" data-entity-1="Commitment" data-entity-2="Promise" data-source-line="30" data-uid="lnk6" id="link_Commitment_Promise"><path codeLine="30" d="M219.8889,126.0779 C198.3289,149.9579 183.7325,166.1233 161.4125,190.8333" fill="none" id="Commitment-Promise" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="219.8889" x2="220.7965" y1="126.0779" y2="116.1192"/><line style="stroke:#181818;stroke-width:1;" x1="219.8889" x2="229.7035" y1="126.0779" y2="124.1608"/><line style="stroke:#181818;stroke-width:1;" x1="219.8889" x2="225.25" y1="126.0779" y2="120.14"/><line style="stroke:#181818;stroke-width:1;" x1="215.5797" x2="221.5177" y1="124.8819" y2="130.2429"/><line style="stroke:#181818;stroke-width:1;" x1="161.6996" x2="155.7629" y1="196.4829" y2="191.1204"/><line style="stroke:#181818;stroke-width:1;" x1="163.7105" x2="157.7738" y1="194.2566" y2="188.8942"/><line style="stroke:#181818;stroke-width:1;" x1="161.4125" x2="156.05" y1="190.8333" y2="196.77"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="68.2627" x="199.5" y="163.0669">belongs to</text></g><!--link Commitment to Commiter--><g class="link" data-entity-1="Commitment" data-entity-2="Commiter" data-source-line="31" data-uid="lnk7" id="link_Commitment_Commiter"><path codeLine="31" d="M306.2704,127.3238 C322.0204,159.4638 334.412,184.7651 348.592,213.7251" fill="none" id="Commitment-Commiter" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="306.2704" x2="297.3622" y1="127.3238" y2="122.7803"/><line style="stroke:#181818;stroke-width:1;" x1="306.2704" x2="308.1378" y1="127.3238" y2="117.4997"/><line style="stroke:#181818;stroke-width:1;" x1="306.2704" x2="302.75" y1="127.3238" y2="120.14"/><line style="stroke:#181818;stroke-width:1;" x1="303.5586" x2="310.7424" y1="130.8799" y2="127.3596"/><line style="stroke:#181818;stroke-width:1;" x1="353.9435" x2="346.7585" y1="215.5585" y2="219.0765"/><line style="stroke:#181818;stroke-width:1;" x1="352.6242" x2="345.4392" y1="212.8642" y2="216.3822"/><line style="stroke:#181818;stroke-width:1;" x1="348.592" x2="352.11" y1="213.7251" y2="220.91"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="56.9575" x="324.5" y="163.0669">made by</text></g><!--link Promise to Beneficiary--><g class="link" data-entity-1="Promise" data-entity-2="Beneficiary" data-source-line="32" data-uid="lnk8" id="link_Promise_Beneficiary"><path codeLine="32" d="M98.5,344.21 C98.5,369.8 98.5,372.5 98.5,394.98" fill="none" id="Promise-Beneficiary" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="98.5" x2="92.5" y1="334.21" y2="326.21"/><line style="stroke:#181818;stroke-width:1;" x1="98.5" x2="104.5" y1="334.21" y2="326.21"/><line style="stroke:#181818;stroke-width:1;" x1="98.5" x2="98.5" y1="334.21" y2="326.21"/><ellipse cx="98.5" cy="340.21" fill="none" rx="4" ry="4" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="102.5" x2="94.5" y1="398.98" y2="398.98"/><line style="stroke:#181818;stroke-width:1;" x1="102.5" x2="94.5" y1="395.98" y2="395.98"/><line style="stroke:#181818;stroke-width:1;" x1="98.5" x2="98.5" y1="394.98" y2="402.98"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="22.9785" x="99.5" y="369.0669">has</text></g><!--link Promise to Promise--><g class="link" data-entity-1="Promise" data-entity-2="Promise" data-source-line="33" data-uid="lnk9" id="link_Promise_Promise"><path codeLine="33" d="M198.0102,243.5795 C218.2402,245.3295 225,250.84 225,261.5 C225,272.16 222.2254,277.3258 201.9954,279.0758" fill="none" id="Promise-Promise" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="198.0102" x2="190.04" y1="243.5795" y2="250.8602"/><line style="stroke:#181818;stroke-width:1;" x1="198.0102" x2="190.04" y1="243.5795" y2="234.9198"/><line style="stroke:#181818;stroke-width:1;" x1="198.0102" x2="190.04" y1="243.5795" y2="242.89"/><polygon fill="none" points="190.04,280.11,196.3624,283.578,201.9954,279.0758,195.6729,275.6078,190.04,280.11" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="59.5601" x="231" y="266.0669">parent of</text></g><!--SRC=[TP0n3i8m34Ntdi8pKYwG4LZOUeMKkCKIIL3YIbIqToUaq1f4bqZ-yll_n-YPU80w1aS9uL41xE1qrD3tPFEWL54OxwpBMqRRemPh69aSPcMF7biwauc3O6iJqVFRUj6dgi8vL52RmTwu79Kuaky4UWZE4RiyRP0YbVohz4nWN9NlJ_nwOnJECx1HINIPHgN6SRccXWQlmNS9EFnPMu8qE6CHcg7wa5Ce6_926YuchGjA1P5pAwU6q3u1]--></g></svg> |