Skip to content

Conversation

hazyone
Copy link
Contributor

@hazyone hazyone commented May 22, 2025

Issue

Closes #3138.

Now, if the filename is longer than 255 characters (including the extension), it will truncate part of the contract name in the filename and use the following format: contractnametruncated_contractnamehash(0,8).ext
I've checked, all the files for the same contract would have same hash

Checklist

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases

@hazyone hazyone requested a review from a team as a code owner May 22, 2025 22:21
@hazyone hazyone marked this pull request as draft May 22, 2025 22:38
@hazyone hazyone marked this pull request as ready for review May 23, 2025 09:40
@anton-trunov anton-trunov requested a review from verytactical May 23, 2025 19:48
return full;
}

const hash = sha256_sync(Buffer.from(name)).toString("hex").slice(0, 8);
Copy link
Contributor

@verytactical verytactical May 23, 2025

Choose a reason for hiding this comment

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

2^32 hashes are still possible to mine, possibly creating a name clash

I think it would rather be better to just err whenever len(projectName) + len(contractName) + 1 >= 255, or even len(projectName) > 100 || len(contractName) > 100.

These are not the kind of situations that might happen in non-malicious code, and emitting an error would be completely fine.

@hazyone hazyone marked this pull request as draft May 23, 2025 21:01
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.

Compiler crashes when contract name exceeds filesystem limits
2 participants