oasisprotocol / oasis-core

Performant and Confidentiality-Preserving Smart Contracts + Blockchains
https://oasisprotocol.org
Apache License 2.0
337 stars 112 forks source link

it's possible to change coefficients but not in a way to increase the degree of a polynomial #5830

Open bennetyee opened 1 month ago

bennetyee commented 1 month ago

https://github.com/oasisprotocol/oasis-core/blob/18da8bc49d92a543795246b8bb7fb574df070eec/secret-sharing/src/poly/univariate.rs#L71

not a bug, but an oddity. the API allows callers to change the coefficients of a polynomial, but not to increase its degree. callers can decrease the degree of a polynomial by setting higher degree coefficients to zero.

peternose commented 1 month ago

callers can decrease the degree of a polynomial

True. This was intentional. The reason for this is that we want to have constant time operations on polynomials. Therefore, the function degree and its usage was removed and replaced with size. In general, the crate has no idea what a degree is.