Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PVM] Add validator admin role, reduce root admin permissions #376

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 56 additions & 32 deletions vms/platformvm/addrstate/camino_address_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,74 @@ type (
const (
// Bits

AddressStateBitRoleAdmin AddressStateBit = 0 // super role

AddressStateBitRoleKYCAdmin AddressStateBit = 1 // allows to set KYCVerified and KYCExpired
AddressStateBitRoleOffersAdmin AddressStateBit = 2 // allows to set OffersCreator
AddressStateBitRoleConsortiumAdminProposer AddressStateBit = 3 // allows to create admin add/exclude member proposals

AddressStateBitKYCVerified AddressStateBit = 32
AddressStateBitKYCExpired AddressStateBit = 33
AddressStateBitConsortium AddressStateBit = 38
AddressStateBitNodeDeferred AddressStateBit = 39
AddressStateBitOffersCreator AddressStateBit = 50
AddressStateBitCaminoProposer AddressStateBit = 51
// Allow to set role bits
AddressStateBitRoleAdmin AddressStateBit = 0
// Allows to set KYC and KYB bits
AddressStateBitRoleKYCAdmin AddressStateBit = 1
// Allows to set OffersCreator bit
AddressStateBitRoleOffersAdmin AddressStateBit = 2
// Allows to create addMember and excludeMember admin-proposals
AddressStateBitRoleConsortiumSecretary AddressStateBit = 3
// Allows to set node deferred bit
AddressStateBitRoleValidatorAdmin AddressStateBit = 4

// Indicates that address passed KYC verification
AddressStateBitKYCVerified AddressStateBit = 32
// Indicates that address KYC verification is expired. (not yet implemented)
AddressStateBitKYCExpired AddressStateBit = 33
// Indicates that address is member of consortium
AddressStateBitConsortium AddressStateBit = 38
// Indicates that a node owned by this address (as consortium member) is deferred
AddressStateBitNodeDeferred AddressStateBit = 39
// Allows to create deposit offers
AddressStateBitOffersCreator AddressStateBit = 50
// Allows to create baseFee and feeDistribution proposals
AddressStateBitFoundationAdmin AddressStateBit = 51

AddressStateBitMax AddressStateBit = 63

// States

// 0b0000000000000000000000000000000000000000000000000000000000000000
AddressStateEmpty AddressState = 0

AddressStateRoleAdmin = AddressState(1) << AddressStateBitRoleAdmin // 0b1
AddressStateRoleKYCAdmin = AddressState(1) << AddressStateBitRoleKYCAdmin // 0b10
AddressStateRoleOffersAdmin = AddressState(1) << AddressStateBitRoleOffersAdmin // 0b100
AddressStateRoleConsortiumAdminProposer = AddressState(1) << AddressStateBitRoleConsortiumAdminProposer // 0b1000

AddressStateKYCVerified = AddressState(1) << AddressStateBitKYCVerified // 0b0100000000000000000000000000000000
AddressStateKYCExpired = AddressState(1) << AddressStateBitKYCExpired // 0b1000000000000000000000000000000000

AddressStateConsortium = AddressState(1) << AddressStateBitConsortium // 0b0100000000000000000000000000000000000000
AddressStateNodeDeferred = AddressState(1) << AddressStateBitNodeDeferred // 0b1000000000000000000000000000000000000000

AddressStateOffersCreator = AddressState(1) << AddressStateBitOffersCreator // 0b0100000000000000000000000000000000000000000000000000
AddressStateCaminoProposer = AddressState(1) << AddressStateBitCaminoProposer // 0b1000000000000000000000000000000000000000000000000000
// 0b0000000000000000000000000000000000000000000000000000000000000001
AddressStateRoleAdmin = AddressState(1) << AddressStateBitRoleAdmin
// 0b0000000000000000000000000000000000000000000000000000000000000010
AddressStateRoleKYCAdmin = AddressState(1) << AddressStateBitRoleKYCAdmin
// 0b0000000000000000000000000000000000000000000000000000000000000100
AddressStateRoleOffersAdmin = AddressState(1) << AddressStateBitRoleOffersAdmin
// 0b0000000000000000000000000000000000000000000000000000000000001000
AddressStateRoleConsortiumSecretary = AddressState(1) << AddressStateBitRoleConsortiumSecretary
// 0b0000000000000000000000000000000000000000000000000000000000010000
AddressStateRoleValidatorAdmin = AddressState(1) << AddressStateBitRoleValidatorAdmin

// 0b0000000000000000000000000000000100000000000000000000000000000000
AddressStateKYCVerified = AddressState(1) << AddressStateBitKYCVerified
// 0b0000000000000000000000000000001000000000000000000000000000000000
AddressStateKYCExpired = AddressState(1) << AddressStateBitKYCExpired
// 0b0000000000000000000000000100000000000000000000000000000000000000
AddressStateConsortium = AddressState(1) << AddressStateBitConsortium
// 0b0000000000000000000000001000000000000000000000000000000000000000
AddressStateNodeDeferred = AddressState(1) << AddressStateBitNodeDeferred
// 0b0000000000000100000000000000000000000000000000000000000000000000
AddressStateOffersCreator = AddressState(1) << AddressStateBitOffersCreator
// 0b0000000000001000000000000000000000000000000000000000000000000000
AddressStateFoundationAdmin = AddressState(1) << AddressStateBitFoundationAdmin

// Bit groups (as AddressState)

AddressStateSunrisePhaseBits = AddressStateRoleAdmin | AddressStateRoleKYCAdmin | // 0b1100001100000000000000000000000000000011
// 0b0000000000000000000000001100001100000000000000000000000000000011
AddressStateSunrisePhaseBits = AddressStateRoleAdmin | AddressStateRoleKYCAdmin |
AddressStateKYCVerified | AddressStateKYCExpired | AddressStateConsortium |
AddressStateNodeDeferred

AddressStateAthensPhaseBits = AddressStateRoleOffersAdmin | AddressStateOffersCreator // 0b0100000000000000000000000000000000000000000000000100

AddressStateBerlinPhaseBits = AddressStateCaminoProposer | AddressStateRoleConsortiumAdminProposer // 0b1000000000000000000000000000000000000000000000001000

AddressStateValidBits = AddressStateSunrisePhaseBits | // 0b1100000000001100001100000000000000000000000000001111
// 0b0000000000000100000000000000000000000000000000000000000000000100
AddressStateAthensPhaseBits = AddressStateRoleOffersAdmin | AddressStateOffersCreator
// 0b0000000000001000000000000000000000000000000000000000000000001000
AddressStateBerlinPhaseBits = AddressStateFoundationAdmin | AddressStateRoleConsortiumSecretary |
AddressStateRoleValidatorAdmin
// 0b0000000000001100000000001100001100000000000000000000000000011111
AddressStateValidBits = AddressStateSunrisePhaseBits |
AddressStateAthensPhaseBits |
AddressStateBerlinPhaseBits
)
Expand Down
Loading