Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement visit_seq() for deserialization visitors #64

Merged
merged 3 commits into from
Sep 24, 2019

Conversation

djc
Copy link
Contributor

@djc djc commented Sep 5, 2019

This enables the use of non-self-describing encodings like bincode.

@omershlo
Copy link
Contributor

omershlo commented Sep 5, 2019

@kigawas does it solves #60 ?

Copy link
Contributor

@kigawas kigawas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @omershlo

@kigawas
Copy link
Contributor

kigawas commented Sep 5, 2019

I'll add bincode test in #61 after this gets merged

@djc
Copy link
Contributor Author

djc commented Sep 5, 2019

(This will also be effectively unusable for me until dependencies in rust-paillier and zk-paillier are updated.)

@omershlo
Copy link
Contributor

omershlo commented Sep 5, 2019

@djc how come ? what dependencies ?

@djc
Copy link
Contributor Author

djc commented Sep 5, 2019

Okay, for this one I have the option of taking on duplicate dependencies I guess, but that's not a great solution; my zk-paillier dependency will pull in old curv.

@omershlo
Copy link
Contributor

omershlo commented Sep 5, 2019

I will make do a proper update later today.

@djc
Copy link
Contributor Author

djc commented Sep 5, 2019

Thanks!

@djc
Copy link
Contributor Author

djc commented Sep 12, 2019

Ping?

@omershlo
Copy link
Contributor

Thanks @djc . Curv serdes is sensitive as other libraries are using them. Therefore it takes time

@djc
Copy link
Contributor Author

djc commented Sep 12, 2019

What are you afraid of? As far as I can tell this does not touch the existing deserialization path, it only adds another one (as used by bincode and potentially other non-self-describing formats) -- seems like a very low-risk fix to me.

@omershlo
Copy link
Contributor

I did not get it. I thought this pr changes the serialization not supports another type.

@djc
Copy link
Contributor Author

djc commented Sep 12, 2019

As you can see in the code, it does NOT change anything pertaining to serialization. On the other hand, it adds support for deserializing the point types from a different types of structure (seq vs map).

@omershlo
Copy link
Contributor

Sorry, mixed it with another PR.
Can you add a test per EC to show that point before equals point after ?

@kigawas
Copy link
Contributor

kigawas commented Sep 13, 2019

@omershlo
Copy link
Contributor

@kigawas this is only a test for secp256k1. I think it's best to have as part of this PR a test per curve.

@kigawas
Copy link
Contributor

kigawas commented Sep 13, 2019

@omershlo
No problem, just want to say it'll be easier for me to sync with master by adding tests for other curves first

.ok_or_else(|| panic!("deserialization failed"))?;
let bytes_bn = BigInt::from_hex(bytes_str);
let bytes = BigInt::to_vec(&bytes_bn);
Ok(Ed25519Point::from_bytes(&bytes[..]).expect("error deserializing point"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better map_err instead of panicking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This merely exhibits the same behavior as visit_map(), so this seems like an improvement that is orthogonal to this PR.

@djc
Copy link
Contributor Author

djc commented Sep 24, 2019

This now includes tests for public key bincode round trips with each curve. Please review!

djc added 2 commits September 24, 2019 14:46
This enables the use of non-self-describing encodings like bincode.
@djc
Copy link
Contributor Author

djc commented Sep 24, 2019

(Test failure is one of the intermittent ones.)

@omershlo omershlo self-requested a review September 24, 2019 13:19
@omershlo
Copy link
Contributor

If you don't mind - can you update the tag in cargo.toml to v0.2.2? (after merge I will actually tag it)

@djc
Copy link
Contributor Author

djc commented Sep 24, 2019

Done!

@omershlo omershlo merged commit 4d9f495 into ZenGo-X:master Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants