Skip to content

Conversation

@cameel
Copy link
Collaborator

@cameel cameel commented Jul 20, 2020

Currently solc-js is not using solc-bin.ethereum.org domain to get soljson.js binaries from solc-bin repository. Instead it fetches the files from raw.githubusercontent.com URLs. This prevents us from freely reorganizing the structure of solc-bin since, unlike Github Pages, it does not provide the original file content when you access it via a symlink. Instead you get a text file with a path and sojc-js can't handle that currently (argotorg/solc-bin#43, argotorg/solc-bin#44).

Not using a domain under our control is also an obstacle to transparently moving files to a different hosting and this is exactly what we're facing now (see argotorg/solidity#9258). We can fix it in newer versions of solc-js but the old ones will keep trying to get them from the old location.

This PR fixes the immediate issue by switching the URLs to solc-bin.ethereum.org. I originally assumed this to be just an oversight but after browsing through issues and PRs in this repo I see that the switch to raw.githubusercontent.com was actually intentional (#446, #445). It seems that the reason was that GH pages are rate-limited. This means that switching to the official domain would bring the problem back as it's currently pointing at GH pages too. I'm in the process of preparing an Amazon S3 bucket to mirror solc-bin content and I think I'll have to keep this PR as a draft until that's ready and the official domain is pointing at it.

cameel added 2 commits July 20, 2020 19:13
- NOTE: This is only for curl. https.get() used in three other places won't follow redirects.
@cameel cameel requested review from axic and chriseth July 20, 2020 18:07
@cameel cameel self-assigned this Jul 20, 2020

var mem = new MemoryStream(null, { readable: false });
https.get('https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/list.json', function (response) {
https.get('https://solc-bin.ethereum.org/bin/list.json', function (response) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https.get() won't handle HTTP redirects as far as I know. Unfortunately it looks like you need an external library for that. Any suggestions? Is it ok to add a new dependency just for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh really? Yeah, please either add the most lightweight library or write a simple function that follows at most 3 redirect or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll do it in a separate PR not to block this one. Right now we don't have any redirects in solc-bin anyway.

@chriseth
Copy link
Contributor

Oh this is really annoying. Can we maybe find a solution where we first try one url and then fall back to the other if it fails? We could even handle the "non-working symlinks" in such a way.

@cameel
Copy link
Collaborator Author

cameel commented Jul 22, 2020

@chriseth I just tried to reproduce the rate limiting issue to be able to test the fallback and manged to make a ton of requests without actually running into the limit.

I did 1k requests to solc-bin.ethereum.org, 1k to ethereum.github.io and later again 1.6k to solc-bin.ethereum.org. It was in total about 1.5 GB worth of list.json which is a non-negligible fraction of the monthly bandwidth cap for GH pages (100 GB) and I still wasn't blocked. When I was working with github API earlier I was running into HTTP 403 errors after something like 50-100 requests so even if there's any rate limiting, it seems pretty reasonable.

So I'm not sure if the fallback is really needed given that we're switching to S3 anyway. I think that using the solc-bin.ethereum.org URL will not affect individual users and heavy usage in CI will just go back to being flaky for a short time until S3 is ready.

@cameel cameel marked this pull request as ready for review July 22, 2020 16:17
@cameel
Copy link
Collaborator Author

cameel commented Jul 22, 2020

I just noticed that it was still a draft. I'm marking it as ready now.

@chriseth chriseth merged commit a689085 into master Jul 22, 2020
@chriseth chriseth deleted the replace-github-solc-bin-links-with-ethereum-org branch July 22, 2020 16:43
@cameel cameel mentioned this pull request Jul 23, 2020
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