-
Notifications
You must be signed in to change notification settings - Fork 7
Web3:// protocol engine split #12
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
Conversation
…into a separate package, to be published later.
… toml files : work in progress
…. Work in progress.
cmd/server/main.go
Outdated
| } | ||
|
|
||
| // Setup name address cache to 10 minutes, hardocded | ||
| web3pConfig.NameAddrCacheDurationInMinutes = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to hardcode the cache duration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not :) I just copy/pasted the existing hardcoded value from main.go:139
I will add an option to be loaded from the config file.
cmd/server/protocol.go
Outdated
| return "", false, fmt.Errorf("invalid subdomain") | ||
| } | ||
| full := strings.Join(pieces[0:2], ":") | ||
| name := pieces[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar logic shows multiple times, we may consider to wrap it as an internal function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll see if I can cleanup handleSubdomain() a bit
Seems no dApps are using the SimpleNameService right now. SimpleNameService was a simple name service used by chainId 3333. So I think we can remove that from the gateway. |
If what you mean is the old return way for "->" instead of "returns", there is only one dApp "W3Blog" which is using it. We can definitely change the code of W3Blog to deprecate this old calling version. |
Ok! And Qi Zhou is also voting on removing support for this old calling version, so I'll remove the commented tests. |
…d factorize a bit on hostChangeChainShortNameToId()
…y into 202309-engine-tests
|
Ok I have used the cacheDurationMinutes flag, removed some commented tests for the old format (e.g. It still remains for me to add support for the extra ERC |
|
Hi Nand, This is really a considerable amount of change with many details that must have taken a lot of effort, especially since you have to go over the test cases one by one. And I can see a lot of improvements have been made such as making chainId integers, upgrading go-ethereum dependency, and some deprecations, etc., which I believe are the right things to do. |
| // {100001, "0xc2f21F8F573Ab93477E23c4aBB363e66AE11Bac5.w3qkc.io", "/greet?returns=(string)", "[\"Hello QKC\"]", http.StatusOK}, | ||
| // {100001, "w3qkc.io", "/0xc2f21F8F573Ab93477E23c4aBB363e66AE11Bac5/greet?returns=(string)", "[\"Hello QKC\"]", http.StatusOK}, | ||
| // } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support the cases of subdomain like in line 267, 269, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I have commented them temporarily and forgot about them. I just made them work.
|
Hi! Thanks, yes sorry I guess I should have added more details!
What remains in web3url-gateway is the http server itself, the gateway URL to web3:// URL translation (mostly done via the Coming back to the engine (web3protocol-go), I have taken the code from the gateway, and reworked it so that the 3 main execution steps are separated, in a way that can be easily tested :
The tests at https://github.com/web3-protocol/web3protocol-tests have been put in toml files, and are made to be used by various implementations : this golang implementation, and very soon https://github.com/web3-protocol/web3protocol-js Other place using this golang engine : right now only the tests (https://github.com/web3-protocol/web3protocol-go/blob/main/web3protocol_test.go ), I'll add a curl-like app soon. The javascript engine is used by a curl-like app and the EVM browser My hope is that others apps wanting to read Changes of logic : there are very slight changes, it aims at supporting ERC-6860, the ERC that Qi Zhou and I are working on which clarifies and formalize ERC-4804 and make the following changes:
|
…se the default one from the golang http server.
…rns args is handled.
|
Ok I just made all tests pass by adding the ERC-7087 mime.type/mime.config support ; also corrected the way multiple ?returns args is supposed to be handled (the last one should be taken, instead of returning an error). |
|
Too much changes are involved, I think it will be great to setup a gateway in the server to test the existing websites to see if they are broken, @syntrust |
Yes before merging to the main branch, I may need some time to deploy the branch to a test server for a sanity test in case there are any broken links, especially for the web pages deployed in the early days. |
…of which being tuples support in ?return=)
|
The last commit bump the web3protocol-go to v0.1.0, which add tiny changes (one being support of tuples in ?return=). |
|
This PR has been deployed to a test server for a bunch of sanity tests. The tests cover ethstorage.io (https://eth-store.w3eth.io/#/) and all links and dApps on https://w3url.w3eth.io/ (w3link.io) . All works well except links like https://web3q.io/file.w3q/0x6d4a199f603b084a2f1761dc9f322f92e68bfd5e/demo.png where
We may need to make some changes to dApps (qrobot, w3box, etc. ) using this kind of link. |
Hi!
Ok here is a PR where I extracted the web3:// execution engine, put it on https://github.com/web3-protocol/web3protocol-go and then reuse it on the gateway project.
Here are some things:
Lastly, I haven't supported yet the
?mime.type=and.mime.content=flags, will do so soon after, will be quick.But first, do you have comments on the PR as it is now?
Regarding
/concat.w3q->(string)URLs, if you still want to support them, I can do a bit a code to translate them in proper web3:// URLs before feeding them to the new engine.