ergoplatform / sigma-rust

Rust implementation of ErgoTree interpreter and wallet-related features
Creative Commons Zero v1.0 Universal
70 stars 47 forks source link

[800 SigmaUSD] Arithmetic operations and polynomial interpolation over Galois fields GF(2^192) #473

Closed greenhat closed 2 years ago

greenhat commented 2 years ago

Implementation details

Extract https://github.com/ergoplatform/sigma-rust/blob/develop/ergotree-interpreter/src/sigma_protocol/gf2_192.rs and https://github.com/ergoplatform/sigma-rust/blob/develop/ergotree-interpreter/src/sigma_protocol/gf2_192poly.rs into a separate crate gf2_192 and implement according to existing implementation in Scala https://github.com/ScorexFoundation/sigmastate-interpreter/blob/prepare-v5.0-evaluator/sigmastate/src/main/java/gf2t/GF2_192.java , https://github.com/ScorexFoundation/sigmastate-interpreter/blob/prepare-v5.0-evaluator/sigmastate/src/main/java/gf2t/GF2_192_Poly.java

Testing

Implement tests according to the tests in Scala version in https://github.com/ScorexFoundation/sigmastate-interpreter/blob/prepare-v5.0-evaluator/sigmastate/src/test/java/gf2t/GF2_192Test.java

References

https://github.com/reyzin/GF2t

Existing Rust implementation for Galois fields GF(2^256): https://github.com/djsweet/galois_2p8 https://github.com/geky/gf256

kettlebell commented 2 years ago

Starting this one!

kettlebell commented 2 years ago

@greenhat Rust allows us to define operators like + and * for custom types. Would you like to have such syntactic sugar for the gf2_192 types?

greenhat commented 2 years ago

@greenhat Rust allows us to define operators like + and * for custom types. Would you like to have such syntactic sugar for the gf2_192 types?

Sounds nice! Yes, please.

greenhat commented 2 years ago

The bounty is sent. Thank you!