Skip to content

Compute addresses with ref contracts #5699

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

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

kumaryash90
Copy link
Member

@kumaryash90 kumaryash90 commented Dec 11, 2024

TOOL-2796 (XPROT-934)

Problem solved

This was an issue when installing modules published with ref contracts. Module installation goes through infra deployment functions which use computed addresses.

SDK should process ref contracts when computing published contract addresses.


PR-Codex overview

This PR focuses on enhancing the handling of published contract references within the thirdweb library by modifying how contract addresses are computed and processed in deployment options.

Detailed summary

  • Updated processRefDeployments to handle empty salt values.
  • Introduced computeRefDeployments to compute addresses for contract references.
  • Adjusted computeDeploymentInfoFromMetadata to use processed constructor parameters.
  • Updated test cases to reflect changes in salt values and contract versions.
  • Added a new test for computing addresses for deployed contracts with references.

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

Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: 1273cc7

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter 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

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 0:58am
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 0:58am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 0:58am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 0:58am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 0:58am

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Dec 11, 2024
Copy link
Contributor

graphite-app bot commented Dec 11, 2024

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.

Copy link
Contributor

github-actions bot commented Dec 11, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 46.76 KB (0%) 936 ms (0%) 194 ms (+88.41% 🔺) 1.2 s
thirdweb (cjs) 127.15 KB (0%) 2.6 s (0%) 378 ms (+19.96% 🔺) 3 s
thirdweb (minimal + tree-shaking) 5.6 KB (0%) 112 ms (0%) 97 ms (+736.53% 🔺) 209 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 123 ms (+3775.95% 🔺) 133 ms
thirdweb/react (minimal + tree-shaking) 19.34 KB (0%) 387 ms (0%) 108 ms (+402% 🔺) 495 ms

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 18 lines in your changes missing coverage. Please review.

Project coverage is 54.81%. Comparing base (6911102) to head (1273cc7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rc/extensions/prebuilts/compute-ref-deployments.ts 86.50% 17 Missing ⚠️
...rc/extensions/prebuilts/process-ref-deployments.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5699      +/-   ##
==========================================
+ Coverage   54.73%   54.81%   +0.07%     
==========================================
  Files         874      875       +1     
  Lines       54710    54851     +141     
  Branches     3712     3736      +24     
==========================================
+ Hits        29946    30066     +120     
- Misses      24669    24690      +21     
  Partials       95       95              
Flag Coverage Δ
packages 54.81% <87.50%> (+0.07%) ⬆️
Files with missing lines Coverage Δ
.../any-evm/compute-published-contract-deploy-info.ts 100.00% <100.00%> (ø)
...rc/extensions/prebuilts/process-ref-deployments.ts 86.92% <50.00%> (-2.31%) ⬇️
...rc/extensions/prebuilts/compute-ref-deployments.ts 86.50% <86.50%> (ø)

... and 1 file 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.

Copy link
Member Author

kumaryash90 commented Mar 11, 2025

Merge activity

  • Mar 10, 8:50 PM EDT: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 10, 8:50 PM EDT: A user added this pull request to the Graphite merge queue.
  • Mar 10, 8:59 PM EDT: A user merged this pull request with the Graphite merge queue.

TOOL-2796 (XPROT-934)

## Problem solved

This was an issue when installing modules published with ref contracts. Module installation goes through infra deployment functions which use computed addresses.

SDK should process ref contracts when computing published contract addresses.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the handling of published contract references in the `thirdweb` library, particularly in the deployment process. It introduces a new function to compute addresses for these references and updates existing functions and tests accordingly.

### Detailed summary
- Added `processRefDeployments` function to process contract references in constructor params.
- Introduced `computeRefDeployments` function for computing addresses of published contract references.
- Updated the handling of `salt` values to default to an empty string instead of `"thirdweb"`.
- Modified `computeDeploymentInfoFromMetadata` to use processed constructor parameters.
- Adjusted tests to reflect changes in contract deployment parameters and added new tests for address computation of deployed contracts with references.

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

<!-- end pr-codex -->
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 Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants