Skip to content

perf: Migrate to new crypto libraries using dalek's math#402

Open
sparx7783 wants to merge 3 commits intosolana-foundation:mainfrom
sparx7783:ed25519-+-curve25519
Open

perf: Migrate to new crypto libraries using dalek's math#402
sparx7783 wants to merge 3 commits intosolana-foundation:mainfrom
sparx7783:ed25519-+-curve25519

Conversation

@sparx7783
Copy link
Copy Markdown

Problem

Go's std lib crypto/ed25519 is not using the optimized ed25519 math used in Dalek's rust lib, which offers significant performance improvements, we can switch to github.com/oasisprotocol/curve25519-voi to get these improvements.

Summary of Changes

Migrate from crypto/ed25519 and filippo.io/edwards25519 to new oasisprotocol/curve25519-voi, with slightly rewriting the isOnCurve verification function for slight api differences. Uses VerifyWithOptions(..., verifyOptionsStdLib) to keep verification 1:1 with the previous stdlib implementation.

Benchmarks

Operation main (stdlib + filippo) voi Speedup
Sign 19,650 ns, 1 alloc 11,420 ns, 1 alloc 1.72×
Verify 37,548 ns, 0 allocs 23,491 ns, 0 allocs 1.60×
IsOnCurve 2,786 ns, 0 allocs 2,519 ns, 0 allocs 1.11×
FindAssociatedTokenAddress (wSOL) 25,157 ns, 58 allocs 23,086 ns, 58 allocs 1.09×

Copy link
Copy Markdown
Contributor

@sonicfromnewyoke sonicfromnewyoke left a comment

Choose a reason for hiding this comment

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

awesome MR, thanks 🙏

Comment thread keys.go Outdated
sparx7783 and others added 2 commits April 16, 2026 20:53
Co-authored-by: Sonic <sonic.from.new.yoke@gmail.com>
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.

2 participants