Skip to content

Use sbf v3 and last few optimizations - #14

Merged
samkim-crypto merged 3 commits into
solana-program:mainfrom
samkim-crypto:use-sbf-v3
Sep 24, 2026
Merged

samkim-crypto merged 3 commits into
solana-program:mainfrom
samkim-crypto:use-sbf-v3

Conversation

@samkim-crypto

@samkim-crypto samkim-crypto commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

This is the final PR before we kick off the audits.

When I tested the crate with SBF v3, the CUs increased a bit, so I added two more optimizations:

  • Scalar reduction: I saw that we zeroed the limb array before filling it in a loop. The SBF v3 measurements showed that this setup and decoding were costly, so I changed it to initialize every limb directly, simplified carry propagation, and only apply the final correction when needed.
  • Point validation: I saw that strict verification made extra curve calls for small-order checks before the MSM. Those calls added CUs even though the verification operations already enforce curve validity, so I switched to checks on the compressed encodings and reused the MSM and fallback operations for validation.

@samkim-crypto
samkim-crypto force-pushed the use-sbf-v3 branch 2 times, most recently from 4b62ac0 to 9f405e6 Compare September 22, 2026 20:04
@samkim-crypto
samkim-crypto marked this pull request as ready for review September 22, 2026 20:22

@zz-sol zz-sol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@samkim-crypto
samkim-crypto merged commit 41c2006 into solana-program:main Sep 24, 2026
21 checks passed
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