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

HTML return patching, 6 domain part support, sepolia ENS #27

Merged
merged 3 commits into from
Apr 20, 2024

Conversation

nand2
Copy link
Contributor

@nand2 nand2 commented Apr 12, 2024

Hi!

This adds:

  • Processing of the return of content-type HTML :
    • patching the fetch() JS function so that it works with web3:// URLs
    • Handling links to absolute web3:// URLs
    • -> This is not 100% perfect, will fail if the content is compressed and spread over several chunks (should be rare)
  • Add support for 6 parts domains, so that ENS subdomains in testnet works, e.g. dblog.dblog.eth.11155111.w3link.io
  • Add sample ENS config for sepolia in config.toml.sample

Thanks!

@qzhodl qzhodl requested a review from syntrust April 12, 2024 08:51
@syntrust
Copy link
Collaborator

Hi @nand2, it seems like an interesting feature, can you describe a little about the background and motivation?

@nand2
Copy link
Contributor Author

nand2 commented Apr 19, 2024

Hi!

Sure! It's about contracts interacting with other contracts.

When a smart contract website A only interact with itself with javascript fetch() and tags, we can make it work both on native web3:// browsers and on the gateway by using relative URLs (e.g. fetch("/path/to/resource") <a href="/path">.

But when a smart contract A wants to interact with smart contract B, then it has to use absolute URLs : fetch("web3://contractB/path/to/resource") <a href="web3://contractB/path">, and while this work on native web3:// browsers, it break on the gateway.

Until now, for small contracts, when we reached this issue, we kind of managed by modifying the architecture of the website, but as websites go bigger, it has to be the other way around.

The proposed patch is injecting javascript that look for these absolute web3:// URLs and replace them by their gateway HTTP URLs.

Thanks!

@syntrust syntrust merged commit 907445e into ethstorage:main Apr 20, 2024
@syntrust
Copy link
Collaborator

syntrust commented Apr 20, 2024

The PR merged and deployed to w3link.io.
Also added new A record *.dblog.eth.11155111.w3link.io and updated certificate.

When accessing https://dblog.eth.11155111.w3link.io/ I got
unsupported chain short name from name service: w3q-t:0xa56d9016b9484dd0707535a378bdeef2cc602ccf

@qzhodl
Copy link

qzhodl commented Apr 20, 2024

Do you also deploy the ENS support in the config file?

@nand2
Copy link
Contributor Author

nand2 commented Apr 20, 2024

For this, you need :

[name2chain]
"w3q-t" = 3333

in the config.
And it should be all good!

@nand2
Copy link
Contributor Author

nand2 commented Apr 20, 2024

Ok saw the short name change from w3q-t to es-t, will deploy a version using this new short name for chain 3333.

@syntrust
Copy link
Collaborator

[name2chain]
"es-t" = 3333

This one works, would you like to make the change in this PR? @nand2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants