Skip to content

ed25519::GE fails in serialization and deserialization  #156

Open
@HRezaei

Description

@HRezaei

There seems to be an error in encoding/decoding of a GE (Ed25519Point) in version 0.7.0. In the example below, the base_point is serialized to JSON, and a new point is recreated from it. I expect the new point to contain the same x, y coordinates, but it isn't the case:

    let base_point: GE = GE::generator();
    println!("base_point.x:{:?}", base_point.x_coor().unwrap().to_hex());
    println!("base_point.y:{:?}", base_point.y_coor().unwrap().to_hex());
    //Prints:
    //base_point.x:"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"
    //base_point.y:"6666666666666666666666666666666666666666666666666666666666666658"

    let base_point_json = serde_json::to_string(&base_point).unwrap();
    let new_point = serde_json::from_str::<GE>(&base_point_json).unwrap();

    println!("new_point.x:{:?}", new_point.x_coor().unwrap().to_hex());
    println!("new_point.y:{:?}", new_point.y_coor().unwrap().to_hex());
    //Prints:
    //new_point.x:"6742e15f97d771b642862d5cf84ecf93eb3ac67b80698b993b87fdbc08a584c8"
    //new_point.y:"21d30600c9e573796ead6f09668af38f81783cfc621ee4931e2f5ba9fc37b9b4"

    assert_eq!(base_point, new_point);//assertion failed

This causes the EdDSA thresholdsig to always fail with "invalid key" error in the stage: phase1_verify_com_phase2_distribute() because the y_vec: &Vec<GE> has to be collected from different parties, and this needs serialize/deserializing the GE's.

You have said that improving the v0.7 is no longer a priority(unless critical issues) so it would be great if you please consider this as a critical issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions