Open JayWhite2357 opened 2 weeks ago
/bounty $100
/attempt #228
with your implementation plan. Note: we will only assign an issue if you include an implementation plan with a time estimate. Additionally, to be assigned an issue, you must have previously contributed to the project. You can still work on an issue and submit a PR without being assigned./claim #228
in the PR body to claim the bountyThank you for contributing to spaceandtimelabs/sxt-proof-of-sql!
Add a bounty • Share on socials
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟢 @b4s36t4 | Oct 9, 2024, 5:27:42 AM | WIP |
🟢 @varshith257 | Oct 13, 2024, 7:36:07 AM | WIP |
/attempt #228
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@varshith257 | 15 bounties from 7 projects | Go, TypeScript, Scala & more |
﹟232 |
Cancel attempt |
Background and Motivation
Currently, the
Scalar
trait requires various conversions using theFrom
andInto
traits. Some of these are confusing, while others are clear. In general, the rule should be that for types with a natural embedding into the associatedScalar
field,Scalar
should implementFrom
. In all other cases, the conversion should either be auto-implemented, or a trait method, where appropriate.NOTE: The following issue also necessitates changes to Scalar, so be aware of potential merge conflicts: https://github.com/spaceandtimelabs/sxt-proof-of-sql/issues/234
Changes Required
Each of these should be a separate PR.
Into<[u64; 4]>
,From<[u64; 4]>
, andRefInto<[u64; 4]>
bounds.fn from_limbs(val: [u64; 4]) -> Self
andfn to_limbs(&self) -> [u64; 4]
Scalar
is a field element (number mod some prime) with slightly less than 256 bits. Usually,Scalar
s are internally stored in Montgomery form, so these conversions are non-free. However, they are needed in some situations.From<&'a String>
,From<String>
, andFrom<&'a str>
bounds. These three implementations ultimately rely on the conversions to and from limbs. As a result, these should have blanket/default implementations.fn from_str_via_hash(val: &str) -> Self
and add a default implementation.impl<S: Scalar> From<String> for S
, this is not allowed by the Rust type system. Solutions other than the default implementation of a trait method are welcome.Scalar
itself. This is different from a parsing method.VarInt
bound and replace it with a blanketimpl<S: Scalar> VarInt for S
implementation. The existing (and requested) implementation relies on the limb conversions only.