Skip to content
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

Add constant padding to random hexes, hashes and addresses #494

Merged

Conversation

barrutko
Copy link
Contributor

No description provided.

@barrutko barrutko requested a review from krzkaczor December 16, 2024 16:04
@barrutko barrutko self-assigned this Dec 16, 2024
Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 2:06pm
spark-app-production ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 2:06pm
spark-app-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 2:06pm

Copy link

github-actions bot commented Dec 16, 2024

📦 Size Report

Path Size Diff
JS 1.3 MB 46 B (+0.01% 🔺)
CSS 23.29 KB 0 B (0%)

@@ -19,10 +19,11 @@ export function CheckedAddress(value: string): CheckedAddress {
* Generates a random address. Tries to represent desired ascii prefix as hex value. Helps to identify transactions in the logs.
*/
CheckedAddress.random = (asciiPrefix = ''): CheckedAddress => {
const constantAddressPrefix = '0000'
Copy link
Contributor

@krzkaczor krzkaczor Dec 16, 2024

Choose a reason for hiding this comment

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

i thought about this more: i think a good prefix is deadbeef as it's obviously not random. Or simply make the prefix longer - for example: 8 chars instead of 4.

Copy link
Contributor Author

@barrutko barrutko Dec 16, 2024

Choose a reason for hiding this comment

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

changed to deadbeef

@@ -19,10 +19,11 @@ export function CheckedAddress(value: string): CheckedAddress {
* Generates a random address. Tries to represent desired ascii prefix as hex value. Helps to identify transactions in the logs.
*/
CheckedAddress.random = (asciiPrefix = ''): CheckedAddress => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it will be infix now, since it's not first part of the address anymore.

I'm curious, why this change was needed in the first place?

Copy link
Contributor Author

@barrutko barrutko Dec 17, 2024

Choose a reason for hiding this comment

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

I don't know if we need to be that precise to rename that to infix - both of these parts are still prerandomPart 😛

@barrutko barrutko enabled auto-merge (squash) December 17, 2024 14:02
@barrutko barrutko merged commit 64f561d into main Dec 17, 2024
13 checks passed
@barrutko barrutko deleted the sc-885-random-hashes-and-addresses-should-have-a-common-prefix branch December 17, 2024 14:17
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.

4 participants