Skip to content

Conversation

@kumaryash90
Copy link
Member

@kumaryash90 kumaryash90 commented Nov 13, 2025


PR-Codex overview

This PR focuses on improving the resolveImplementation function in the thirdweb package by enhancing the way implementation addresses are resolved from both storage slots and contract calls, ensuring more robust handling of proxy types.

Detailed summary

  • Refactored the implementation resolution logic to use Promise.all for concurrent fetching of implementation addresses.
  • Removed the conditional check for beacon and streamlined implementation address retrieval.
  • Updated the return structure to reflect the resolved implementation address and its bytecode.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of implementation resolution across proxy and beacon contract setups, with concurrent detection and optimized fallbacks for more consistent and faster results.

@kumaryash90 kumaryash90 requested review from a team as code owners November 13, 2025 21:42
@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: 6cd681c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp Patch

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

@vercel
Copy link

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Nov 14, 2025 3:37pm
nebula Ready Ready Preview Comment Nov 14, 2025 3:37pm
thirdweb_playground Ready Ready Preview Comment Nov 14, 2025 3:37pm
thirdweb-www Ready Ready Preview Comment Nov 14, 2025 3:37pm
wallet-ui Ready Ready Preview Comment Nov 14, 2025 3:37pm

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 13, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Nov 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete—it lacks the required title format, issue tag, and structured sections (Notes for reviewer, How to test) specified in the template. Add PR title in required format '[SDK/Dashboard/Portal] Feature/Fix: ...' and include Linear issue tag, structured Notes for reviewer, and How to test sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix resolve implementation' is directly related to the main change, which refactors the resolveImplementation function to improve proxy contract handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yash/resolve-implementation-fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c20c38a and 6cd681c.

📒 Files selected for processing (2)
  • .changeset/afraid-regions-push.md (1 hunks)
  • packages/thirdweb/src/utils/bytecode/resolveImplementation.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/thirdweb/src/utils/bytecode/resolveImplementation.ts
  • .changeset/afraid-regions-push.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/thirdweb/src/utils/bytecode/resolveImplementation.ts (1)

59-62: LGTM! Concurrent resolution improves performance.

Fetching both implementation sources in parallel is a good optimization. However, note that this introduces an implicit priority: storage-slot implementations are checked before contract-call implementations since they appear first in the array.

Consider adding a comment documenting this priority order:

+ // Fetch implementations from both sources concurrently
+ // Storage slot implementations are checked first, then contract call implementations
  const implementations = await Promise.all([
    getImplementationFromStorageSlot(contract),
    getImplementationFromContractCall(contract),
  ]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 144bb33 and c20c38a.

📒 Files selected for processing (2)
  • .changeset/afraid-regions-push.md (1 hunks)
  • packages/thirdweb/src/utils/bytecode/resolveImplementation.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-13T13:03:41.732Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.

Applied to files:

  • .changeset/afraid-regions-push.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
.changeset/afraid-regions-push.md (1)

1-5: LGTM!

The changeset follows the standard format and appropriately documents this fix as a patch-level change.

packages/thirdweb/src/utils/bytecode/resolveImplementation.ts (1)

89-89: LGTM! Appropriate fallback behavior.

Returning the original contract address and bytecode when no valid implementation is found is the correct fallback behavior.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 104.88 KB (0%)
@thirdweb-dev/nexus (cjs) 316.6 KB (0%)

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.84%. Comparing base (144bb33) to head (6cd681c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...irdweb/src/utils/bytecode/resolveImplementation.ts 72.72% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8413      +/-   ##
==========================================
+ Coverage   54.83%   54.84%   +0.01%     
==========================================
  Files         919      919              
  Lines       60844    60846       +2     
  Branches     4134     4141       +7     
==========================================
+ Hits        33364    33372       +8     
+ Misses      27378    27372       -6     
  Partials      102      102              
Flag Coverage Δ
packages 54.84% <72.72%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
...irdweb/src/utils/bytecode/resolveImplementation.ts 87.94% <72.72%> (+7.36%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 14, 2025

Merge activity

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the `resolveImplementation` function in the `thirdweb` package by enhancing the implementation resolution process for proxy contracts.

### Detailed summary
- Replaced the existing implementation resolution logic with a more robust approach using `Promise.all` to fetch implementations from both storage and contract calls.
- Introduced a loop to handle multiple implementations, ensuring that valid addresses are checked before proceeding.
- Updated the return logic to ensure correct addresses and bytecode are returned based on the resolved implementation.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Improved the reliability of contract implementation resolution to handle edge cases more robustly when detecting implementations across proxy contracts and various contract architecture types. Processing is now more efficient through concurrent implementation detection and optimized fallback handling, ensuring more consistent and faster results in complex contract scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants