Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Fix: official repo to list Solidity's releases #5008

Merged
merged 7 commits into from
Aug 26, 2022

Conversation

Neurone
Copy link
Contributor

@Neurone Neurone commented Apr 8, 2022

Added the official repo for Solidity's Compiler releases, before the Truffle custom one.
Added a note for the last two deprecated repo.

@Neurone
Copy link
Contributor Author

Neurone commented Apr 8, 2022

This PR fixes problems you can encounter if the truffle relay node is down for some reason. See this StackExchange question: https://ethereum.stackexchange.com/questions/125523/truffle-compile-list-not-showing-latest-versions-of-compiler

@gnidan
Copy link
Contributor

gnidan commented Apr 8, 2022

Looks like our relay was pointing to the deprecated URLs. Fixing that now!

I think for this PR, though, we want to keep relay.trufflesuite.com as the primary source, since that will allow us to fix issues without requiring a Truffle release.

@gnidan
Copy link
Contributor

gnidan commented Apr 8, 2022

Thanks for bringing this to our attention! Will discuss with the team to confirm the behavior we want moving forward.

@haltman-at
Copy link
Contributor

Note: This is related to issue #4425.

@Neurone
Copy link
Contributor Author

Neurone commented Apr 8, 2022

@gnidan I set that as the first repo because I found this note in the comment: this relay address exists so that we have a backup option in case more official distribution mechanisms fail, but I see your point :)

@cds-amal
Copy link
Member

This precedence and motivation, should probably be documented

@eggplantzzz
Copy link
Contributor

@cameel can you let us know which urls that Truffle should use when obtaining the solc compiler? Is https://binaries.soliditylang.org/bin/ correct or should we be using a different one?

@cameel
Copy link

cameel commented May 9, 2022

My recommendation would be https://binaries.soliditylang.org/emscripten-wasm32/ with a fallback to https://binaries.soliditylang.org/emscripten-asmjs/.

Overall, this should be clear from Static Binaries section in the docs. Let me know if you think it still leaves something out.

@eggplantzzz
Copy link
Contributor

Thanks @cameel! We'll make sure this gets updated in Truffle!

@eggplantzzz
Copy link
Contributor

@Neurone are you interested in making these changes? First, should be our relay url followed by the two that @cameel recommends. If you don't want to do this work I'll be happy to take it from here, just let me know!

@Neurone
Copy link
Contributor Author

Neurone commented May 10, 2022

@eggplantzzz sure, no problem, I will send an update to the PR soon.

@MicaiahReid
Copy link
Contributor

Hi @Neurone, is this PR ready for review? I see that you've made some commits, but it isn't currently passing CI. Let us know if you are able to look into what's causing this to fail.

@davidmurdoch
Copy link
Member

Should we keep https://solc-bin.ethereum.org/bin/ and https://ethereum.github.io/solc-bin/bin/ as backups for the backups?

@Neurone
Copy link
Contributor Author

Neurone commented May 12, 2022

Hi, yes, it's ready.

I didn't change anything aside from the URLs in the arrays. The error is related to the content of the loaded list: the CI tries to find a nightly build in the list (0.4.16-nightly.2017.8.9+commit.81887bc7), but new URLs contain the release one only (0.4.16+commit.d7661dd9).

If you agree, I can change the test here

version: "0.4.16-nightly.2017.8.9+commit.81887bc7",
to use version 0.4.16+commit.d7661dd9

@cameel
Copy link

cameel commented May 12, 2022

Should we keep https://solc-bin.ethereum.org/bin/ and https://ethereum.github.io/solc-bin/bin/ as backups for the backups?

It would not hurt. At least for https://ethereum.github.io. It no longer receives new versions but it's a completely different host so in case S3 goes down, you might still be able to get binaries for some older versions from there. https://solc-bin.ethereum.org on the other hand is pointing at the same S3 bucket as https://binaries.soliditylang.org and I don't expect that to change ever so that one's probably pointless. At most it might help if there's an issue with DNS or certificates so that one resolves and the other does not.

@cameel
Copy link

cameel commented May 12, 2022

The error is related to the content of the loaded list: the CI tries to find a nightly build in the list (0.4.16-nightly.2017.8.9+commit.81887bc7),

Right. That's actually one difference between the new and old URLs - the nightlies are only available in bin/. Do you think we should add them to the new dirs too? I'd expect tools to be handing nightlies separately anyway.

@Neurone
Copy link
Contributor Author

Neurone commented May 12, 2022

The error is related to the content of the loaded list: the CI tries to find a nightly build in the list (0.4.16-nightly.2017.8.9+commit.81887bc7),

Right. That's actually one difference between the new and old URLs - the nightlies are only available in bin/. Do you think we should add them to the new dirs too? I'd expect tools to be handing nightlies separately anyway.

I think it's the cleanest path to follow. But currently, both relays redirect to https://binaries.soliditylang.org, so if this is the way to go, we should convince the Solidity team to update their files.

@cameel
Copy link

cameel commented May 12, 2022

Personally, I really don't like the fact that nightlies sit in the same dir as releases since there are tons of them. If you go to the github repo backing the S3 bucket, github won't even show you all the releases because it hits the limit of 1000 files.

But if you think that it's still better to have them in the new dirs, this is something we can definitely change. Could you submit an issue in the Solidity repo?

@Neurone
Copy link
Contributor Author

Neurone commented May 12, 2022

Personally, I really don't like the fact that nightlies sit in the same dir as releases since there are tons of them. If you go to the github repo backing the S3 bucket, github won't even show you all the releases because it hits the limit of 1000 files.

But if you think that it's still better to have them in the new dirs, this is something we can definitely change. Could you submit an issue in the Solidity repo?

Sure, no problem. Another solution is to add a separate file filled only with release versions. This way, we have a clean list (list-releases.json) and a complete one (list.json). I'll prepare an issue for the Solidity repo soon.

@cameel
Copy link

cameel commented May 12, 2022

For me it's only really an issue when browsing the dir manually so I don't think splitting the list would be a solution. When I do that I don't even look at the list :)

@Neurone
Copy link
Contributor Author

Neurone commented May 13, 2022

I see :) I cannot list dir contents from the outside, so I didn't notice that behavior.

If you don't mind having duplicated files, another option is to use the main folders for release versions only and a specific subfolder for all versions, i.e. /emscripten-wasm32/ only releases, /emscripten-wasm32/full-list/ all releases.

@Neurone
Copy link
Contributor Author

Neurone commented May 13, 2022

@cameel
Copy link

cameel commented May 13, 2022

I see :) I cannot list dir contents from the outside, so I didn't notice that behavior.

See https://github.com/ethereum/solc-bin/tree/gh-pages/bin. It's the repo backing the S3 bucket. The fact that there are so many files in there makes it kinda hard to browse that dir.

I cannot open issues on https://github.com/ethereum/solc-bin, so I opened it on https://github.com/ethereum/solidity

That's fine. solc-bin does not have issues exactly because we want to have them all in one place - in the main repo, Maybe we should just put that in the README.

@kevinweaver
Copy link
Contributor

@Neurone it looks like this still isn't passing CI, we'll restart it to see if it's flaky. Otherwise, let us know if we can help resolve the issue.

@Neurone
Copy link
Contributor Author

Neurone commented May 19, 2022

@kevinweaver we need to keep this PR pending until the Solidity team reaches an agreement about how to update the management of release and nightly builds (see here). When that thread is closed, I can update this PR accordingly.

@cds-amal
Copy link
Member

Maintenance note: leaving this in waiting for more visibility

@eggplantzzz
Copy link
Contributor

So it looks like axios throws an error and we retry the next url in the case that the server response is something other than 2xx. See handling errors. This is relevant because it seems like not all urls formats will have all versions of the Solidity compiler.

However a trickier thing is that in order to build the urls we need the version commit suffix to add to the base urls we have. We get those by querying the url to see what versions are available. We need to make sure, when this gets implemented, we have a source to query for all available versions of the Solidity compiler.

@eggplantzzz
Copy link
Contributor

So additionally I found the following interesting things about these links:

  • the solc-bin.ethereum link seems to have the complete list of compiler versions with the newest one being up-to-date as of the time of writing this (note that Truffle probably cannot handle versions of the compiler before a certain point - probably around 0.4.x for some x)
  • the ethereum.github.io link only has versions of the compiler up to 0.7.1
  • the wasm links have versions starting with 0.3.6
  • the asmjs links only go up to version 0.6.1

@haltman-at
Copy link
Contributor

Oh, looks like you're right. My mistake! Yes, that means that we have to be careful about the order of things, unless we go changing the way this works...

@haltman-at
Copy link
Contributor

Oh, wow, it looks like the reality is even worse than we realized -- instead of going down the list of sources to find a working source, and then using that source for both the version list and the compiler itself, it goes down the list of sources to find a working source for the version list, uses that to get the filename for the compiler, and then goes down the list again to find the compiler, even though filenames may differ between sources! Yikes! This whole process needs to be reworked to be actually sensible...

@eggplantzzz
Copy link
Contributor

You can find work in progress to fix Truffle's retry mechanism for downloading the Soldity compiler lists and the compiler itself here.

@eggplantzzz eggplantzzz self-assigned this Aug 9, 2022
Added the official repo for Solidity's Compiler releases, before the Truffle custom one.
Added a note for the last two deprecated repo.
@eggplantzzz
Copy link
Contributor

Hey @Neurone, that PR mentioned in my previous comment has been merged and released so I believe we are ready to try and get this PR through. It will require a little bit more work, however. Can you give me permission to your repo so that I can rebase it and perform the final work? If you would rather do this then let me know and we can work on getting this through. Thanks!

@Neurone
Copy link
Contributor Author

Neurone commented Aug 18, 2022

@eggplantzzz sure! This would be very helpful also because I forgot almost everything about this PR, and you can do a better job for sure :D I just sent you an invitation.

@eggplantzzz
Copy link
Contributor

Thanks @Neurone for doing this work!

Copy link
Contributor

@haltman-at haltman-at left a comment

Choose a reason for hiding this comment

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

OK, seems good on functionality! I have a few minor comments on style.


// Delete if it's already there.
if (await fse.exists(expectedCache)) await fse.unlink(expectedCache);
if (await fse.exists(compilerCacheDirectory))
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor note here: fs.exists is deprecated. You should probably use fs.existsSync instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll go ahead and address these concerns in #5445 as it moves the compile-solidity tests to a new package. It should make dealing with merge conflict stuff easier.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh actually I will need to address these here I think since some of these are related to necessary test suite changes for this particular PR.


// Delete if it's already there.
if (await fse.exists(expectedCache)) await fse.unlink(expectedCache);
if (await fse.exists(compilerCacheDirectory))
await fse.removeSync(compilerCacheDirectory);
Copy link
Contributor

Choose a reason for hiding this comment

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

Style note: You should probably put braces around the body of this block, indented blocks without braces can be a source of confusion for later editors.

Also, since you're using removeSync, the await is redundant.

assert(await fse.exists(expectedCache), "Should have cached compiler");
const cachedCompilerFilenames = fse.readdirSync(compilerCacheDirectory);
const compilerFilename = cachedCompilerFilenames.find(filename => {
return filename.includes("v0.4.21+commit.dfe3193c");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is truly nitpicking and you don't need to change this, but filename => { return foo; } could instead just be filename => foo.

return filename.includes("v0.4.21+commit.dfe3193c");
});

assert(
Copy link
Contributor

Choose a reason for hiding this comment

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

Another style note -- it's better to use assert.somethingMoreSpecific when it exists; in this case, that could be assert.notEqual or assert.notStrictEqual.

const cachedCompilersFilenames = fse.readdirSync(compilersCacheDirectory);

assert(
cachedCompilersFilenames.some(filename => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same note here as earlier about filename => { return foo; }.

return filename.includes("v0.4.21+commit.dfe3193c");
});

assert.equal(
Copy link
Contributor

Choose a reason for hiding this comment

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

(Hey @eggplantzzz looks like you inverted this one)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I did this algorithmically and didn't think about the value - isUndefined should be used

Copy link
Contributor

Choose a reason for hiding this comment

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

oh no that's also wrong, it should be defined :P

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, you're just using assert and not chai here, right? Node's builtin assert doesn't have isDefined, that's a chai thing...

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I thought it was using chai...easily remedied

Copy link
Contributor

@haltman-at haltman-at left a comment

Choose a reason for hiding this comment

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

Woohoo!

@eggplantzzz
Copy link
Contributor

Thanks again @Neurone!

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

Successfully merging this pull request may close these issues.

9 participants