Skip to content

chore: getChecksumAddress memoized and faster - #246

Merged
Mrtenz merged 2 commits into
MetaMask:mainfrom
Nodonisko:chore/memoized-checksum-address
Jun 30, 2025
Merged

chore: getChecksumAddress memoized and faster#246
Mrtenz merged 2 commits into
MetaMask:mainfrom
Nodonisko:chore/memoized-checksum-address

Conversation

@Nodonisko

Copy link
Copy Markdown
Contributor

What is the current state of things and why does it need to change?

Mobile app and some controllers is using toChecksumAddress from ethereumjs-util package but this function is quite slow because of crypto operations happening inside. I plan to replace it with function from this package which is doing crypto operations too but it's memoized at least.

Memoization should help quite a lot because address pool is usually quite limited. I also made implementation in this package 4x faster and added few more addresses to test file.

Screenshot 2025-06-26 at 21 06 11

@socket-security

socket-securityBot commented Jun 26, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Added@​types/​lodash.memoize@​4.1.91001005476100
Added@​types/​lodash@​4.17.191001007892100

View full report

Comment threadpackage.json Outdated
Comment threadpackage.json Outdated
Comment threadsrc/hex.ts Outdated
Comment threadsrc/index.test.ts Outdated
Comment threadsrc/hex.ts
@Nodonisko
Nodoniskoforce-pushed the chore/memoized-checksum-address branch from adcfef6 to a520d22CompareJune 27, 2025 12:04
Comment threadsrc/hex.ts Outdated
@Nodonisko
Nodoniskoforce-pushed the chore/memoized-checksum-address branch from a520d22 to ac8cf00CompareJune 27, 2025 12:08
@Nodonisko
Nodoniskoforce-pushed the chore/memoized-checksum-address branch from ac8cf00 to 4a6b68bCompareJune 27, 2025 12:10
Mrtenz
Mrtenz previously approved these changes Jun 27, 2025

@MrtenzMrtenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

Sign up for freeto 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

@Nodonisko@Mrtenz@Prithpal-Sooriya