Query node: Remove the need for bootstrapping values
Memberships
-
defaultInviteCount(initial value: 5) - this value is used to populateMembership.inviteCountduring member creation. Once updated in the runtime, the update is reflected inMembershipSystemSnapshot.defaultInviteCount. Alternative solution: Include the value inMembershipBoughtandMemberInvitedevents on the runtime side and removeMembershipSystemSnapshotentity. -
membershipPrice(initial value: 100) - only used inMembershipSystemSnapshotentity for consistency. Alternative solution: RemoveMembershipSystemSnapshotentity, Pioneer should fetch the price directly from the chain api (api.query.members.membershipPrice) -
referralCut(initial value: 0) - only used inMembershipSystemSnapshotentity for consistency. Alternative solution: RemoveMembershipSystemSnapshotentity, Pioneer should fetch the value directly from the chain api if needed (api.query.members.referralCut) -
invitedInitialBalance(initial value: 100) - only used inMembershipSystemSnapshotentity for consistency. Alternative solution: RemoveMembershipSystemSnapshotentity, Pioneer should fetch the value directly from the chain api if needed (api.query.members.initialInvitationBalance)
Storage system
-
blacklist(initial value: []) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.blacklistdirectly if needed. -
storageBucketsPerBagLimit(initial value: 0) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.storageBucketsPerBagLimitdirectly if needed. -
distributionBucketsPerBagLimit(initial value: 0) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.distributionBucketsPerBagLimitdirectly if needed. -
uploadingBlocked(initial value: false) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.uploadingBlockeddirectly if needed. -
dataObjectFeePerMb(initial value: 0) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.dataObjectPerMegabyteFeedirectly if needed. -
storageBucketMaxObjectsCountLimit(initial value: 0) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.voucherMaxObjectsNumberLimitdirectly if needed. -
storageBucketMaxObjectsSizeLimit(initial value: 0) - only used inStorageSystemParametersentity. Alternative solution: RemoveStorageSystemParametersentity, apps should useapi.query.storage.voucherMaxObjectsSizeLimitdirectly if needed. -
nextDataObjectId(initial value: 0) - used to connect created channel/video assets duringChannelCreatedandVideoCreatedevents. Alternative solution: Don't initialize any value,0should just be assumed in case if missing. This should be no longer needed after https://github.com/Joystream/joystream/issues/3084
Working groups
-
name-WorkingGroupentities are bootstrapped with a name that matches the api module name in order for the QN to be able to connectWorkingGroupentity to an event that is beeing processed. -
budget(initial value: 0) - each group can have an initial budget set in the runtime. Currently this is0.
Alternative solution:
Change the schema so that there is no WorkingGroup entity, but a WorkingGroup enum instead. There is a map of working group module name to WorkingGroup enum variant. WorkingGroup has no properties of its own. The budget can be retrieved either by directly querying the chain (api.query[group].budget) or fetching the last BudgetSetEvent. The group metadata can be retrieved by fetching the last WorkingGroupMetadata. The leader can be fetched with a query like workers(where: group_eq: $group, isLead_eq: true }). All references to WorkingGroup entity should be changed to simple WorkingGroup enum values.
Council
For council mappings we're creating the initial election / stage / council entities mostly for the purpose of allowing to create relationships between subsequent stage updates, candidacies etc. and current election / council.
Alternative solution:
- Modify the mappings so that they don't need an initial empty council entity (make relationships to it optional where needed)
- Remove
ElectionRoundentity, replace references to it withElectionRoundnumber istead. Make election round (cycleId) part ofAnnouncingPeriodStartedEventand query the last such event to retrievecycleIdin the mappings (assume0in case there are no events yet) - Remove the need for initial
CouncilStageUpdate. The initial stage should be assumed to beAnnouncingby Pioneer and other apps. Candidate count can be retrieved with a query likecandidatesConnection(where: { cycleId_eq: $currentCycleNumber }) { totalCount }, it doesn't need to be part ofCouncilStageUpdateentity.
┆Issue is synchronized with this Asana task by Unito
Phenomenal work, just amazing 🤯 .