add contenthash interpretation#2285
Conversation
🦋 Changeset detectedLatest commit: efee14f The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds complete support for interpreting and exposing ENSIP-7 contenthash data within ENS domain profiles. The implementation includes a new decoder-based interpreter that maps hex-encoded contenthash values to structured profile data (including protocol type, decoded payload, canonical URI, and optional HTTP gateway URLs), integrates the interpreter into the GraphQL schema, wires it into the resolution pipeline, and validates the functionality with integration tests. ChangesENS Domain Contenthash Profile Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the change is purely additive with no modifications to existing resolvers or data paths. All changed code is purely additive: a new interpreter module, a new GraphQL type, and generated schema files. The interpreter wraps the entire decode path in a try/catch and returns null for every failure mode (null raw, empty hex, unknown codec, malformed bytes), so it cannot break existing queries. The integration test covers the happy path with a real IPFS fixture. No existing behavior is altered. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GraphQL Query: profile.contenthash] --> B[buildProfileSelectionFromResolveContainerInfo]
B --> C{topLevelFields has contenthash?}
C -- yes --> D[merge ProfileContenthashInterpreter.selection]
C -- no --> E[skip]
D --> F[resolveRecords round-trip]
F --> G[ProfileContenthashInterpreter.interpret]
G --> H{raw == null or 0x?}
H -- yes --> I[return null]
H -- no --> J[strip 0x prefix]
J --> K[getCodec hex]
K -- null --> I
K -- Codec --> L[decode hex to CID string]
L --> M{protocolType in PROTOCOL_CONFIG?}
M -- yes --> N[use known uriPrefix + httpUrl builder]
M -- no --> O[fallback prefix, httpUrl = null]
N --> P[return ProfileContenthashModel]
O --> P
P --> Q[ProfileContenthash GraphQL type]
Reviews (2): Last reviewed commit: "fix AI comments" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/integration-test-env/src/devnet/fixtures.ts`:
- Around line 97-99: The inline comment for the contenthash value (the property
named contenthash in the fixture object) is inconsistent with the actual decoded
CID — decode the hex string "0xe30101..." assigned to contenthash (or re-derive
the correct hex for the expected CID) and update either the comment to reflect
the true CID (e.g., bafybei... if that decodes correctly) or replace the hex
value so it encodes the commented CID (QmRAQ...). Locate the contenthash
property in fixtures.ts, validate the multicodec/multihash decoding result, and
make the comment and assigned hex consistent with each other. Ensure the chosen
fix preserves test expectations that rely on the decoded CID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 94d69902-f372-4323-9abf-6fb60b9b98e8
⛔ Files ignored due to path filters (3)
packages/enssdk/src/omnigraph/generated/introspection.tsis excluded by!**/generated/**packages/enssdk/src/omnigraph/generated/schema.graphqlis excluded by!**/generated/**pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
.changeset/clean-insects-accept.mdapps/ensapi/package.jsonapps/ensapi/src/omnigraph-api/lib/resolution/profile/README.mdapps/ensapi/src/omnigraph-api/lib/resolution/profile/build-profile-selection.tsapps/ensapi/src/omnigraph-api/lib/resolution/profile/interpreters/contenthash.tsapps/ensapi/src/omnigraph-api/lib/resolution/profile/interpreters/index.tsapps/ensapi/src/omnigraph-api/lib/resolution/profile/profile-descriptions.tsapps/ensapi/src/omnigraph-api/schema/domain.integration.test.tsapps/ensapi/src/omnigraph-api/schema/profile.tspackages/ensskills/skills/omnigraph/SKILL.mdpackages/integration-test-env/src/devnet/fixtures.ts
| const config = PROTOCOL_CONFIG[protocolType]; | ||
| const prefix = config ? config.uriPrefix : `${protocolType}://`; | ||
| const uri = `${prefix}${decoded}`; | ||
| const httpUrl = config?.httpUrl ? config.httpUrl(decoded) : null; |
There was a problem hiding this comment.
const httpUrl = config?.httpUrl?.(decoded) ?? null is better
|
i could see a schema improvement with either: a) protocolType should become enum, or |
Summary
Domain.resolve.profile.contenthashinterpretationdecided to use simple structure for that:
Pre-Review Checklist (Blocking)