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

fix(cheqd): cheqd revocationRegistryDefinition resource name #2139

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion packages/cheqd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test": "jest"
},
"dependencies": {
"@cheqd/sdk": "^2.5.1",
"@cheqd/sdk": "^2.6.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should properly test this in RN. We have to pin everything to a very specific version or the SDK breaks. Even with the current version it throws an unhandled promise rejection on startup (due to wasm errors) but it somehow still works for resolving.

We haven't had the time to properly look into it, but before we can merge this we should first test it in react native (actually we should pin the version to 2.5.1 for now, instead of using ^2.5.1 until it's fixed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting it! It would be very helpful if you can create an issue on our sdk with context-rich logs or reproduction steps. Thanks

Copy link
Contributor Author

@DaevMithran DaevMithran Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimoGlastra after our mainnet upgrade we got some feedback that Cheqd transactions from credo are failing, and you can also see that some of the integration tests are failing in 2.5.1. This must be due to insufficient gas after introducing our fee market module, In our latest sdk we have fixed the default gas fees. We have not made any major dependency changes from 2.5.1 to 2.6.0

"@cheqd/ts-proto": "~2.3.2",
"@cosmjs/crypto": "~0.30.0",
"@cosmjs/proto-signing": "~0.30.0",
Expand Down
24 changes: 14 additions & 10 deletions packages/cheqd/src/anoncreds/services/CheqdAnonCredsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import type { AgentContext } from '@credo-ts/core'
import { CredoError, Hasher, JsonTransformer, TypedArrayEncoder, utils } from '@credo-ts/core'

import { CheqdDidResolver, CheqdDidRegistrar } from '../../dids'
import { cheqdSdkAnonCredsRegistryIdentifierRegex, parseCheqdDid } from '../utils/identifiers'
import {
cheqdAnonCredsResourceTypes,
cheqdSdkAnonCredsRegistryIdentifierRegex,
parseCheqdDid,
} from '../utils/identifiers'
import {
CheqdCredentialDefinition,
CheqdRevocationRegistryDefinition,
Expand Down Expand Up @@ -87,7 +91,7 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {
const schemaResource = {
id: utils.uuid(),
name: `${schema.name}-Schema`,
resourceType: 'anonCredsSchema',
resourceType: cheqdAnonCredsResourceTypes.schema,
data: {
name: schema.name,
version: schema.version,
Expand Down Expand Up @@ -145,7 +149,7 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {
const credDefResource = {
id: utils.uuid(),
name: TypedArrayEncoder.toHex(credDefNameHashBuffer),
resourceType: 'anonCredsCredDef',
resourceType: cheqdAnonCredsResourceTypes.credentialDefinition,
data: {
type: credentialDefinition.type,
tag: credentialDefinition.tag,
Expand Down Expand Up @@ -250,9 +254,9 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {

const searchDid = parsedDid.path
? revocationRegistryDefinitionId
: `${revocationRegistryDefinitionId}${
revocationRegistryDefinitionId.includes('?') ? '&' : '?'
}resourceType=anonCredsRevocRegDef`
: `${revocationRegistryDefinitionId}${revocationRegistryDefinitionId.includes('?') ? '&' : '?'}resourceType=${
cheqdAnonCredsResourceTypes.revocationRegistryDefinition
}`

const response = await cheqdDidResolver.resolveResource(agentContext, searchDid)
const revocationRegistryDefinition = JsonTransformer.fromJSON(
Expand Down Expand Up @@ -308,8 +312,8 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {

const revocationRegistryDefinitionResource = {
id: utils.uuid(),
name: credentialDefinitionName as string,
resourceType: 'anonCredsRevocRegDef',
name: `${credentialDefinitionName}-${revocationRegistryDefinition.tag}`,
DaevMithran marked this conversation as resolved.
Show resolved Hide resolved
resourceType: cheqdAnonCredsResourceTypes.revocationRegistryDefinition,
data: {
credDefId: revocationRegistryDefinition.credDefId,
revocDefType: revocationRegistryDefinition.revocDefType,
Expand Down Expand Up @@ -385,7 +389,7 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {

const response = await cheqdDidResolver.resolveResource(
agentContext,
`${parsedDid.did}?resourceType=anonCredsStatusList&resourceVersionTime=${timestamp}&resourceName=${revocationRegistryDefinitionName}`
`${parsedDid.did}?resourceType=${cheqdAnonCredsResourceTypes.revocationStatusList}&resourceVersionTime=${timestamp}&resourceName=${revocationRegistryDefinitionName}`
)

const revocationStatusList = JsonTransformer.fromJSON(response.resource, CheqdRevocationStatusList)
Expand Down Expand Up @@ -444,7 +448,7 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {
const revocationStatusListResource = {
id: utils.uuid(),
name: revocationRegistryDefinitionName as string,
resourceType: 'anonCredsStatusList',
resourceType: cheqdAnonCredsResourceTypes.revocationStatusList,
data: {
currentAccumulator: revocationStatusList.currentAccumulator,
revRegDefId: revocationStatusList.revRegDefId,
Expand Down
7 changes: 7 additions & 0 deletions packages/cheqd/src/anoncreds/utils/identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ export function parseCheqdDid(didUrl: string): ParsedCheqdDid | null {
}
return null
}

export const cheqdAnonCredsResourceTypes = {
schema: 'anonCredsSchema',
credentialDefinition: 'anonCredsCredDef',
revocationRegistryDefinition: 'anonCredsRevocRegDef',
revocationStatusList: 'anonCredsStatusList',
}
27 changes: 21 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading