Skip to content

Commit

Permalink
chore: remove DuplicatedCertBug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Apr 11, 2024
1 parent bd07e99 commit ed6a907
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const extractPendingCsrs = async (payload: { csrs: string[]; certificates
pendingCsrs.push(csr)
}
}
logger('DuplicatedCertBug', { parsedUniqueCsrs, pendingNames, certNames })
return pendingCsrs
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class RegistrationService extends EventEmitter implements OnModuleInit {
certificates: (await this.storageService?.loadAllCertificates()) as string[],
})

this.logger('Finished issuing certificates')
// Event processing finished
this.registrationEventInProgress = false

Expand Down Expand Up @@ -90,14 +89,13 @@ export class RegistrationService extends EventEmitter implements OnModuleInit {
return
}

this.logger('DuplicatedCertBug', { payload })
const pendingCsrs = await extractPendingCsrs(payload)
this.logger('DuplicatedCertBug', { pendingCsrs })
await Promise.all(
pendingCsrs.map(async csr => {
await this.registerUserCertificate(csr)
})
)
this.logger('Finished issuing certificates')
}

// TODO: This doesn't save the owner's certificate in OrbitDB, so perhaps we
Expand All @@ -121,7 +119,6 @@ export class RegistrationService extends EventEmitter implements OnModuleInit {

public async registerUserCertificate(csr: string): Promise<void> {
const result = await issueCertificate(csr, this.permsData)
this.logger('DuplicatedCertBug', { result })
if (result?.cert) {
// Save certificate (awaited) so that we are sure that the certs
// are saved before processing the next round of CSRs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,11 @@ export class CertificatesRequestsStore extends EventEmitter {
return e.payload.value
})

this.logger('DuplicatedCertBug', { allEntries })
const allCsrsUnique = [...new Set(allEntries)]
this.logger('DuplicatedCertBug', { allCsrsUnique })
await Promise.all(
allCsrsUnique
.filter(async csr => {
const validation = await CertificatesRequestsStore.validateUserCsr(csr)
this.logger('DuplicatedCertBug', { validation, csr })
if (validation) return true
return false
})
Expand All @@ -121,7 +118,6 @@ export class CertificatesRequestsStore extends EventEmitter {
filteredCsrsMap.set(pubKey, csr)
})
)
this.logger('DuplicatedCertBug', '[...filteredCsrsMap.values()]', [...filteredCsrsMap.values()])
return [...filteredCsrsMap.values()]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export class CertificatesStore extends EventEmitter {
}

const validation = await this.validateCertificate(certificate)
this.logger('DuplicatedCertBug', { validation, certificate })
if (validation) {
const parsedCertificate = parseCertificate(certificate)
const pubkey = keyFromCertificate(parsedCertificate)
Expand Down
7 changes: 3 additions & 4 deletions packages/backend/src/nest/storage/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ export class StorageService extends EventEmitter {

private async startReplicate() {
const dbs = []

if (this.communityMetadataStore?.getAddress()) {
dbs.push(this.communityMetadataStore.getAddress())
}
if (this.channels?.address) {
dbs.push(this.channels.address)
}
Expand All @@ -163,9 +165,6 @@ export class StorageService extends EventEmitter {
if (this.certificatesRequestsStore.getAddress()) {
dbs.push(this.certificatesRequestsStore.getAddress())
}
if (this.communityMetadataStore?.getAddress()) {
dbs.push(this.communityMetadataStore.getAddress())
}
if (this.userProfileStore.getAddress()) {
dbs.push(this.userProfileStore.getAddress())
}
Expand Down

0 comments on commit ed6a907

Please sign in to comment.