From e62e038ecb866194ff66d348e616149eb168ef47 Mon Sep 17 00:00:00 2001 From: John Wooten Date: Thu, 6 Aug 2026 07:22:19 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Correct=20CAP-0075=20interface?= =?UTF-8?q?=20errata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align field selectors with the shipped Symbol ABI and correct protocol availability. Co-authored-by: Codex --- core/cap-0075.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/cap-0075.md b/core/cap-0075.md index 433423c5a..9b5182c6d 100644 --- a/core/cap-0075.md +++ b/core/cap-0075.md @@ -49,7 +49,7 @@ Two new functions with export names `p` and `q` in the crypto module (`c`) are a "name": "poseidon_permutation", "args": [ { "name": "input", "type": "VecObject" }, - { "name": "field", "type": "U32Val" }, + { "name": "field", "type": "Symbol" }, { "name": "t", "type": "U32Val" }, { "name": "d", "type": "U32Val" }, { "name": "rounds_f", "type": "U32Val" }, @@ -58,7 +58,7 @@ Two new functions with export names `p` and `q` in the crypto module (`c`) are a { "name": "round_constants", "type": "VecObject" } ], "return": "VecObject", - "docs": "Performs Poseidon permutation on input vector. input: vector of field elements (length t). field: 0=BLS12-381 Fr, 1=BN254 Fr. t: state size. d: S-box degree (5 for BLS12-381/BN254). rounds_f: number of full rounds (must be even). rounds_p: number of partial rounds. mds: t-by-t MDS matrix as Vec>. round_constants: (rounds_f+rounds_p)-by-t round constants matrix as Vec>. Returns output vector after permutation.", + "docs": "Performs Poseidon permutation on input vector. `input`: vector of field elements (length `t`). `field`: `BLS12_381` or `BN254`. `t`: state size. `d`: S-box degree (5 for `BLS12_381`/`BN254`). `rounds_f`: number of full rounds (must be even). `rounds_p`: number of partial rounds. `mds`: `t`-by-`t` MDS matrix as `Vec>`. `round_constants`: (`rounds_f` + `rounds_p`)-by-`t` round constants matrix as `Vec>`. Returns output vector after permutation.", "min_supported_protocol": 25 }, { @@ -66,7 +66,7 @@ Two new functions with export names `p` and `q` in the crypto module (`c`) are a "name": "poseidon2_permutation", "args": [ { "name": "input", "type": "VecObject" }, - { "name": "field", "type": "U32Val" }, + { "name": "field", "type": "Symbol" }, { "name": "t", "type": "U32Val" }, { "name": "d", "type": "U32Val" }, { "name": "rounds_f", "type": "U32Val" }, @@ -75,7 +75,7 @@ Two new functions with export names `p` and `q` in the crypto module (`c`) are a { "name": "round_constants", "type": "VecObject" } ], "return": "VecObject", - "docs": "Performs Poseidon2 permutation on input vector. input: vector of field elements (length t). field: 0=BLS12-381 Fr, 1=BN254 Fr. t: state size. d: S-box degree (3, 5, 7, or 11). rounds_f: number of full rounds (must be even). rounds_p: number of partial rounds. mat_internal_diag_m_1: internal matrix diagonal minus 1 as Vec (length t). round_constants: (rounds_f+rounds_p)-by-t round constants matrix as Vec>. Returns output vector after permutation.", + "docs": "Performs Poseidon2 permutation on input vector. `input`: vector of field elements (length `t`). `field`: `BLS12_381` or `BN254`. `t`: state size. `d`: S-box degree (3, 5, 7, or 11). `rounds_f`: number of full rounds (must be even). `rounds_p`: number of partial rounds. `mat_internal_diag_m_1`: internal matrix diagonal minus 1 as `Vec` (length `t`). `round_constants`: (`rounds_f` + `rounds_p`)-by-`t` round constants matrix as `Vec>`. Returns output vector after permutation.", "min_supported_protocol": 25 } ``` @@ -109,9 +109,9 @@ diff --git a/Stellar-contract-config-setting.x b/Stellar-contract-config-setting #### Field Selection -The `field` parameter specifies the scalar field: -- `0`: BLS12-381 Fr (scalar field order r = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001) -- `1`: BN254 Fr (scalar field order r = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001) +The `field` parameter is a `Symbol` that selects the scalar field: +- `BLS12_381`: BLS12-381 Fr (scalar field order `r` = `0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001`) +- `BN254`: BN254 Fr (scalar field order `r` = `0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001`) Scalar field elements are represented as `U256Val` objects as specified in CAP-0059. @@ -156,7 +156,7 @@ The host function will trap if: - `mds` matrix is not `t` by `t` (Poseidon only) - `mat_internal_diag_m_1` vector length does not equal `t` (Poseidon2 only) - `round_constants` matrix dimensions are not `(rounds_f + rounds_p)` by `t` -- `field` parameter is not 0 or 1 +- `field` is neither `BLS12_381` nor `BN254` #### Cost Metering @@ -223,7 +223,7 @@ Common parameter sets have been published by the Poseidon authors and adopted by ### Backwards Incompatibilities -This CAP does not introduce backward incompatibilities. The new host functions are only available in protocol version 24 and later. +This CAP does not introduce backward incompatibilities. The new host functions are only available in Protocol 25 and later. ## Security Concerns