Update bn254 typenames and add mapping#1645
Update bn254 typenames and add mapping#1645jayz22 merged 2 commits intostellar:release/v25-previewfrom
Conversation
There was a problem hiding this comment.
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, andFptoBn254G1Affine,Bn254G2Affine, andBn254Fprespectively - Updated constant names from
G1_SERIALIZED_SIZEtoBN254_G1_SERIALIZED_SIZEpattern - 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: G1Affine → Bn254G1Affine, G2Affine → Bn254G2Affine, Fp → Bn254Fp, 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 |
|
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. |
jayz22
left a comment
There was a problem hiding this comment.
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
955f363 to
24f4ca0
Compare
Arbitrary support was added in when we merged in the initial bn254 change. I also built the contract and inspected the wasm. |
### 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>
What
Update typenames and add the contracttype mapping.