Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

CCIP-Read + Wildcard resolution - #4759

Closed
LeonmanRolls wants to merge 32 commits into
web3:1.xfrom
LeonmanRolls:ccip-read
Closed

CCIP-Read + Wildcard resolution#4759
LeonmanRolls wants to merge 32 commits into
web3:1.xfrom
LeonmanRolls:ccip-read

Conversation

@LeonmanRolls

@LeonmanRolls LeonmanRolls commented Feb 7, 2022

Copy link
Copy Markdown

Description

The intention of this PR is to add CCIP-read support to web3.js.

CCIP-read TLDR: A contract that needs off-chain data can revert with a special error, which will point web3js to a web server where the info can be gathered. The error will also specify which contract function to subsequently call with this off-chain data.

Changes have been made in three main places:

web3-core-method: In order to hook into transaction errors and check for CCIP-read errors.
web3-ccip-read: Functions that implement the CCIP-read protocol
web3-http: Module for making simple http requests

This is a draft to check I'm going in the right direction.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@lgtm-com

lgtm-com Bot commented Feb 7, 2022

Copy link
Copy Markdown

This pull request fixes 1 alert when merging 20a0485 into 2a10e24 - view on LGTM.com

fixed alerts:

  • 1 for Prototype-polluting assignment

Comment thread packages/web3-ccip-read/README.md Outdated
Comment thread packages/web3-ccip-read/README.md Outdated
Comment thread packages/web3-http/README.md Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
@LeonmanRolls

Copy link
Copy Markdown
Author

@nazarhussain Thanks very much for your feedback, will tighten up the code, address your comments and move this out of WIP/Draft shortly.

Comment thread packages/web3-http/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/src/index.js Outdated
Comment thread packages/web3-ccip-read/README.md Outdated
Comment thread packages/web3-ccip-read/package.json Outdated
Comment thread packages/web3-core-method/package.json Outdated
Comment thread packages/web3-http/package.json Outdated
@@ -0,0 +1,21 @@
{
"name": "web3-http",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you should use existing http provider package in web3.js and modify/add new functionality in that instead of creating new package here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hey are you suggesting modifying/adding functionality to the provider itself or adding a separate class to the provider package? Also I think that a provider as an abstraction is quite different to general http requests, and most of the other packages seem to have a single purpose. Happy to add the functionality to the provider package if you still think it should go there.

@jdevcs jdevcs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @LeonmanRolls Thanks for your contributions in web3.js , could you remove package lock files from this PR:

  • package-lock.json
  • packages/web3-ccip-read/package-lock.json
  • packages/web3-http/package-lock.json

Also currently following are not passing:

Build / lint (pull_request)
Build / e2e (unit_and_e2e_clients) (pull_request)
Build / e2e (e2e_browsers) (pull_request) 
Build / e2e (e2e_ganache) (pull_request)
Build / e2e_windows (pull_request) 

could you check and fix failing tests on your local system.

@jdevcs

jdevcs commented Mar 16, 2022

Copy link
Copy Markdown
Contributor

Hi, @LeonmanRolls , will you have time for discussion or addressing feedback of this PR? Thanks

@LeonmanRolls

Copy link
Copy Markdown
Author

Hi, @LeonmanRolls , will you have time for discussion or addressing feedback of this PR? Thanks

Hi yes sure I will address your feedback sorry for the delay, i did also respond to one of your comments but I think you missed it so will post here:

I think you should use existing http provider package in web3.js and modify/add new functionality in that instead of creating new package here.

Hey are you suggesting modifying/adding functionality to the provider itself or adding a separate class to the provider package? Also I think that a provider as an abstraction is quite different to general http requests, and most of the other packages seem to have a single purpose. Happy to add the functionality to the provider package if you still think it should go there.

@lgtm-com

lgtm-com Bot commented May 16, 2022

Copy link
Copy Markdown

This pull request introduces 6 alerts when merging 48c3ce0 into 38295dc - view on LGTM.com

new alerts:

  • 4 for Unused variable, import, function or class
  • 2 for Expression has no effect

@LeonmanRolls
LeonmanRolls force-pushed the ccip-read branch 6 times, most recently from 3b4bb31 to 838816f Compare May 18, 2022 04:36
@LeonmanRolls

Copy link
Copy Markdown
Author

Hi @jdevcs @nazarhussain

I have moved the network request code to be part of the provider now.

I have also added in wildcard resolution as described here: https://docs.ens.domains/ens-improvement-proposals/ensip-10-wildcard-resolution. They work together to facilitate fetching off-chain ENS data so thought it would make sense to merge them as one PR.

I've gone through the checklist as best I can. A fresh pull of 1.x branch has 19 failing tests for me, so this branch has the same number of failing tests, none of the tests i've added have introduced new failing tests locally. I haven't checked the test:unit and test:cov boxes for this reason.

@nazarhussain
nazarhussain self-requested a review May 18, 2022 16:06
@LeonmanRolls LeonmanRolls changed the title CCIP-Read + Wildcard resolution [WIP/Draft] CCIP-Read + Wildcard resolution May 19, 2022
@Arachnid

Arachnid commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

@jdevcs @nazarhussain would it be possible to take another look at this?

@makoto

makoto commented Jun 17, 2022

Copy link
Copy Markdown

hi @nazarhussain Did you have time to review the PR?

@GregTheGreek

GregTheGreek commented Jun 20, 2022

Copy link
Copy Markdown
Contributor

deleted because my comment didn't make sense

@GregTheGreek

GregTheGreek commented Jun 20, 2022

Copy link
Copy Markdown
Contributor

@Arachnid @makoto @LeonmanRolls

This PR is looking to add a specific EIP as a new core package to web3.js. Unless this EIP is being widely used (mass adoption) in the community I do not think this is something we want to be including within web3.js, at least as its own package. If this is something that is crucial for ENS to work, please consider including it directly in the web3-ens package so it can be consumed by your users that way.

We do not want to set a precedent that any single EIP can be implemented into web3.js prior to adoption, with caveats for changes such as the wallet provider API.

@Arachnid

Copy link
Copy Markdown
Contributor

I'm sorry to hear that. This change is crucial to ENS, so we're happy to implement it in the ENS package if that's your preference. Because it's a general-purpose standard for fetching offchain data, we figured it would be useful to web3 users to have it available outside ENS; it seems a shame to implement the functionality for ENS only.

Can you clarify what you mean by "prior to adoption"? ethers.js already supports EIP 3668, and it seems like a bit of a catch 22 to require that it be already used before you support it.

@LeonmanRolls

LeonmanRolls commented Jun 30, 2022

Copy link
Copy Markdown
Author

Hi @GregTheGreek , I've moved the logic for CCIP-Read into the web3-core-method package (as a separate file) as that's the only place it's used at the moment, and including it in web3-eth-ens causes circular dependency issues.

@ghost

ghost commented Jul 11, 2022

Copy link
Copy Markdown

@LeonmanRolls Could you rebase your branch and make sure it works with the new fetch API? We no longer use the buggy xhr2-cookies lib to make HTTP requests anymore.

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions Bot added the Stale Has not received enough activity label Sep 27, 2022
@LeonmanRolls

Copy link
Copy Markdown
Author

Will submit a corresponding PR for v4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.x 1.0 related issues Feature Request Review Needed Maintainer(s) need to review Stale Has not received enough activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants