Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Older nightlies with leading zeros in version string crash soljson #562

Open
cameel opened this issue Nov 10, 2021 · 3 comments · May be fixed by #563
Open

Older nightlies with leading zeros in version string crash soljson #562

cameel opened this issue Nov 10, 2021 · 3 comments · May be fixed by #563

Comments

@cameel
Copy link
Member

cameel commented Nov 10, 2021

Originally reported in ethereum/solc-bin#21 (comment).

soljson-v0.4.1-nightly.2016.9.9+commit.79867f49.js crashes solc-js because the version it reports apparently does not conform to semver. solc-js should be able to handle that more gracefully.

This happens for --version and --bin. Probably in other cases too.

Repro

npm install solc
curl https://binaries.soliditylang.org/bin/soljson-v0.4.1-nightly.2016.9.9+commit.79867f49.js --location --output node_modules/solc
npx solcjs --version

Running the above produces the following exception:

TypeError: Invalid Version: 0.4.1-nightly.2016.09.09+commit.79867f49.Emscripten.clang
    at new SemVer (/tmp/s/node_modules/semver/semver.js:323:11)
    at compare (/tmp/s/node_modules/semver/semver.js:614:10)
    at Function.gt (/tmp/s/node_modules/semver/semver.js:643:10)
    at setupMethods (/tmp/s/node_modules/solc/wrapper.js:20:27)
    at Object.<anonymous> (/tmp/s/node_modules/solc/index.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
@axic
Copy link
Member

axic commented Nov 10, 2021

It must added to translate.js. Let me give this a look.

@axic
Copy link
Member

axic commented Nov 10, 2021

It seems based on semver rules a dot cannot be followed by a leading zero. As @cameel has observed.

@cameel
Copy link
Member Author

cameel commented Nov 10, 2021

By the way, I checked that nightly in Remix and it just fails silently - the compile button keeps spinning but on the console there is Uncaught TypeError: Invalid Version: 0.4.1-nightly.2016.09.09+commit.79867f49.Emscripten.clang.

@axic axic linked a pull request Nov 10, 2021 that will close this issue
@cameel cameel added this to solc-js Jun 10, 2022
@cameel cameel moved this to 👀 Needs review in solc-js Jun 10, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
No open projects
Status: Review
Development

Successfully merging a pull request may close this issue.

2 participants