Skip to content

Update bn254 typenames and add mapping#1645

Merged
jayz22 merged 2 commits intostellar:release/v25-previewfrom
sisuresh:bn254-contracttype
Dec 18, 2025
Merged

Update bn254 typenames and add mapping#1645
jayz22 merged 2 commits intostellar:release/v25-previewfrom
sisuresh:bn254-contracttype

Conversation

@sisuresh
Copy link
Copy Markdown
Contributor

What

Update typenames and add the contracttype mapping.

Copilot AI review requested due to automatic review settings December 16, 2025 00:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR renames BN254 cryptographic types to include a consistent Bn254 prefix and adds contract type mappings for the new type names. The changes improve naming consistency across the SDK by ensuring all BN254-related types follow the same naming convention.

Key Changes:

  • Renamed G1Affine, G2Affine, and Fp to Bn254G1Affine, Bn254G2Affine, and Bn254Fp respectively
  • Updated constant names from G1_SERIALIZED_SIZE to BN254_G1_SERIALIZED_SIZE pattern
  • Added contract type mappings for the new type names in the macro system

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
soroban-sdk/src/crypto/bn254.rs Core type renaming: G1AffineBn254G1Affine, G2AffineBn254G2Affine, FpBn254Fp, and constant updates
soroban-sdk-macros/src/map_type.rs Added contract type mappings for Bn254Fp, Bn254G1Affine, and Bn254G2Affine types
soroban-sdk/src/testutils/arbitrary.rs Updated imports to use new type names with cleaner aliasing
tests/bn254/src/lib.rs Updated test contract to use new type names throughout

@leighmcculloch
Copy link
Copy Markdown
Member

I think the errors that you're seeing in the expand-test-wasms is because of bugs that have been fixed on the main branch. So I think if we merge the main branch into the release/v25-prev, that issue should go away once you regen locally after that's been merged in.

@sisuresh
Copy link
Copy Markdown
Contributor Author

I think the errors that you're seeing in the expand-test-wasms is because of bugs that have been fixed on the main branch. So I think if we merge the main branch into the release/v25-prev, that issue should go away once you regen locally after that's been merged in.

Thanks for the info. I'm updating #1644 with the main branch. Once that's merged, I update this PR.

Copy link
Copy Markdown
Contributor

@jayz22 jayz22 left a comment

Choose a reason for hiding this comment

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

Please also add SorobanArbitrary support for the new types, these supports contract prop-testing/fuzzing, and I believe was also required for spec-compatible types.
Also please make sure to do a Wasm compilation of the test contract and make sure it compiles and works. Feel free to use what I had here

@sisuresh
Copy link
Copy Markdown
Contributor Author

Please also add SorobanArbitrary support for the new types, these supports contract prop-testing/fuzzing, and I believe was also required for spec-compatible types. Also please make sure to do a Wasm compilation of the test contract and make sure it compiles and works. Feel free to use what I had here

Arbitrary support was added in when we merged in the initial bn254 change. I also built the contract and inspected the wasm.

@jayz22 jayz22 merged commit 184c1e3 into stellar:release/v25-preview Dec 18, 2025
95 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Jan 12, 2026
### What

* Add bn254 support (#1615, #1628)
- A new module `crypto/bn254.rs` with Bn254 point and field types, and
expose related host operations.
  - Implement `Neg` trait for `G1Affine` (#1630)
- Update bn254 typenames and add mapping (#1645), also updated bls12-381
type names for consistency
* Add raw Poseidon, Poseidon2 support in `CryptoHazmat`, gated by
"hazmat-crypto" feature


### Why

Expose new crypto functions for protocol 25

### Known limitations

Only the raw host function exposure for Poseidon/Poseidon2 has been
added in this PR. The more elaborate setup for sponge, parameters, hash
function wrappers will be done in a separate repo
[here](https://github.com/stellar/rs-soroban-poseidon)

---------

Co-authored-by: Jay Geng <jay@stellar.org>
Co-authored-by: Siddharth Suresh <siddharth@stellar.org>
Co-authored-by: Leigh <351529+leighmcculloch@users.noreply.github.com>
Co-authored-by: Matteo Lisotto <matteo.lisotto@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Nando Vieira <me@fnando.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.

4 participants