github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/docs/architecture/adr-007-specialization-groups.md (about) 1 # ADR 007: Specialization Groups 2 3 ## Changelog 4 5 - 2019 Jul 31: Initial Draft 6 7 ## Context 8 9 This idea was first conceived of in order to fulfill the use case of the 10 creation of a decentralized Computer Emergency Response Team (dCERT), whose 11 members would be elected by a governing community and would fulfill the role of 12 coordinating the community under emergency situations. This thinking 13 can be further abstracted into the conception of "blockchain specialization 14 groups". 15 16 The creation of these groups are the beginning of specialization capabilities 17 within a wider blockchain community which could be used to enable a certain 18 level of delegated responsibilities. Examples of specialization which could be 19 beneficial to a blockchain community include: code auditing, emergency response, 20 code development etc. This type of community organization paves the way for 21 individual stakeholders to delegate votes by issue type, if in the future 22 governance proposals include a field for issue type. 23 24 25 ## Decision 26 27 A specialization group can be broadly broken down into the following functions 28 (herein containing examples): 29 30 - Membership Admittance 31 - Membership Acceptance 32 - Membership Revocation 33 - (probably) Without Penalty 34 - member steps down (self-Revocation) 35 - replaced by new member from governance 36 - (probably) With Penalty 37 - due to breach of soft-agreement (determined through governance) 38 - due to breach of hard-agreement (determined by code) 39 - Execution of Duties 40 - Special transactions which only execute for members of a specialization 41 group (for example, dCERT members voting to turn off transaction routes in 42 an emergency scenario) 43 - Compensation 44 - Group compensation (further distribution decided by the specialization group) 45 - Individual compensation for all constituents of a group from the 46 greater community 47 48 Membership admittance to a specialization group could take place over a wide 49 variety of mechanisms. The most obvious example is through a general vote among 50 the entire community, however in certain systems a community may want to allow 51 the members already in a specialization group to internally elect new members, 52 or maybe the community may assign a permission to a particular specialization 53 group to appoint members to other 3rd party groups. The sky is really the limit 54 as to how membership admittance can be structured. We attempt to capture 55 some of these possiblities in a common interface dubbed the `Electionator`. For 56 its initial implementation as a part of this ADR we recommend that the general 57 election abstraction (`Electionator`) is provided as well as a basic 58 implementation of that abstraction which allows for a continuous election of 59 members of a specialization group. 60 61 ``` golang 62 // The Electionator abstraction covers the concept space for 63 // a wide variety of election kinds. 64 type Electionator interface { 65 66 // is the election object accepting votes. 67 Active() bool 68 69 // functionality to execute for when a vote is cast in this election, here 70 // the vote field is anticipated to be marshalled into a vote type used 71 // by an election. 72 // 73 // NOTE There are no explicit ids here. Just votes which pertain specifically 74 // to one electionator. Anyone can create and send a vote to the electionator item 75 // which will presumably attempt to marshal those bytes into a particular struct 76 // and apply the vote information in some arbitrary way. There can be multiple 77 // Electionators within the Cosmos-Hub for multiple specialization groups, votes 78 // would need to be routed to the Electionator upstream of here. 79 Vote(addr sdk.AccAddress, vote []byte) 80 81 // here lies all functionality to authenticate and execute changes for 82 // when a member accepts being elected 83 AcceptElection(sdk.AccAddress) 84 85 // Register a revoker object 86 RegisterRevoker(Revoker) 87 88 // No more revokers may be registered after this function is called 89 SealRevokers() 90 91 // register hooks to call when an election actions occur 92 RegisterHooks(ElectionatorHooks) 93 94 // query for the current winner(s) of this election based on arbitrary 95 // election ruleset 96 QueryElected() []sdk.AccAddress 97 98 // query metadata for an address in the election this 99 // could include for example position that an address 100 // is being elected for within a group 101 // 102 // this metadata may be directly related to 103 // voting information and/or privileges enabled 104 // to members within a group. 105 QueryMetadata(sdk.AccAddress) []byte 106 } 107 108 // ElectionatorHooks, once registered with an Electionator, 109 // trigger execution of relevant interface functions when 110 // Electionator events occur. 111 type ElectionatorHooks interface { 112 AfterVoteCast(addr sdk.AccAddress, vote []byte) 113 AfterMemberAccepted(addr sdk.AccAddress) 114 AfterMemberRevoked(addr sdk.AccAddress, cause []byte) 115 } 116 117 // Revoker defines the function required for a membership revocation rule-set 118 // used by a specialization group. This could be used to create self revoking, 119 // and evidence based revoking, etc. Revokers types may be created and 120 // reused for different election types. 121 // 122 // When revoking the "cause" bytes may be arbitrarily marshalled into evidence, 123 // memos, etc. 124 type Revoker interface { 125 RevokeName() string // identifier for this revoker type 126 RevokeMember(addr sdk.AccAddress, cause []byte) error 127 } 128 ``` 129 130 Certain level of commonality likely exists between the existing code within 131 `x/governance` and required functionality of elections. This common 132 functionality should be abstracted during implementation. Similarly for each 133 vote implementation client CLI/REST functionality should be abstracted 134 to be reused for multiple elections. 135 136 The specialization group abstraction firstly extends the `Electionator` 137 but also further defines traits of the group. 138 139 ``` golang 140 type SpecializationGroup interface { 141 Electionator 142 GetName() string 143 GetDescription() string 144 145 // general soft contract the group is expected 146 // to fulfill with the greater community 147 GetContract() string 148 149 // messages which can be executed by the members of the group 150 Handler(ctx sdk.Context, msg sdk.Msg) sdk.Result 151 152 // logic to be executed at endblock, this may for instance 153 // include payment of a stipend to the group members 154 // for participation in the security group. 155 EndBlocker(ctx sdk.Context) 156 } 157 ``` 158 159 ## Status 160 161 > Proposed 162 163 ## Consequences 164 165 ### Positive 166 167 - increases specialization capabilities of a blockchain 168 - improve abstractions in `x/gov/` such that they can be used with specialization groups 169 170 ### Negative 171 172 - could be used to increase centralization within a community 173 174 ### Neutral 175 176 ## References 177 178 - (dCERT ADR)[./adr-008-dCERT-group.md] 179