Intercoin / CommunityContract

Smart contract for managing community membership and roles
https://intercoin.org
GNU Affero General Public License v3.0
1 stars 2 forks source link

Invalid roles ID in a list #33

Closed artman325 closed 1 year ago

artman325 commented 1 year ago

How to reproduce: try to produce any community instance. And call getRoles()

Actual:

[ getRoles method Response ]
uint8[] :  0,1,2,3,4,5
string[] :  relayers,owners,admins,members,alumni,visitors
string[] :  ,,,,,

Expected:

[ getRoles method Response ]
uint8[] :  1,2,3,4,5,6
string[] :  relayers,owners,admins,members,alumni,visitors
string[] :  ,,,,,

Comments: it's just mistyping here. Confused between index of uitn8 and real role id. There are no zero index role in the contract. https://github.com/Intercoin/CommunityContract/blob/288b09786be440654117a5a9f4150ac75fda1e68/contracts/CommunityView.sol#L260 should be like indexes[i-1] = i; instead of indexes[i-1] = i-1;

artman325 commented 1 year ago

need to update unittests. Seems it's wrong too

EGreg commented 1 year ago

Has this been fixed? @artman325 update the unit tests

artman325 commented 1 year ago

updated unittests in https://github.com/Intercoin/CommunityContract/commit/64a11372756cce3c998752cb5c45aff2897c10e8