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

Add hex serialization functions #2436

Merged
merged 7 commits into from
Jan 24, 2019

Conversation

svechinsky
Copy link
Contributor

Addressing #2134
Comments about everything are welcome.

@jaspervdm
Copy link
Contributor

Note that this will break sending/receiving transactions between upgraded and non-upgraded wallets

@svechinsky
Copy link
Contributor Author

hmmm overlooked this, will hopefully add checks tomorrow

@yeastplume
Copy link
Member

Yes, this looks like the right approach, but we're going to have to carefully think about when and how we deploy this. I don't think it's trivial (or at least, it's messy) to be able to support both serialisation formats at once.

@svechinsky
Copy link
Contributor Author

Maybe we can have some separate utility for converting old to new serialization format and vice versa?

The best way I can think of to support both formats is to add a flag for send/receive txs to serialize the output in the old format.

@yeastplume
Copy link
Member

Just looking through this in some more detail, as I think I'd like this in place before merging #2441 since I'd like to use the same serialization features there as well.

Can I suggest moving all of the serialization methods into their own separate module rather than spreading them around, perhaps in core/src/libtx for now (until we decide the best place to put it). I think it will be useful to have all these methods to sanely serialise libsecp primitives somewhere common. We may even want to split this PR into 2, with one to add the serialisation module and another to turn them on in a backwards compatible way. That would also help me move on with #2441

@svechinsky
Copy link
Contributor Author

Ok, so:

  1. Reorganize the serialization modules into a separate module.
  2. Comment out the serde directives for activation at a later date

@yeastplume
Copy link
Member

Yes, sounds like a good plan, thanks!

@svechinsky
Copy link
Contributor Author

svechinsky commented Jan 22, 2019

@yeastplume Just in case you missed it, pinging for a review

@antiochp
Copy link
Member

antiochp commented Jan 23, 2019

I'm not too enthusiastic about merging in commented out code like this.

We should either agree to keep this PR open and track it against master (not a huge fan of this either) or push forward on getting this done in a way that preserves backward compatibility.

@svechinsky
Copy link
Contributor Author

What are your thoughts about a separate utility for converting between the different serializations (a lot cleaner than having to pass a flag from the command line)?
That way those who upgrade to a new client but must temporarily support unupgraded clients (probably applies to businesses only) could use it for the amount of time it takes everyone to upgrade

@ignopeverell
Copy link
Contributor

You already have custom serializers now, why not make them revert to the old representation on hex errors?

@svechinsky
Copy link
Contributor Author

The problem is not with deserializing binary/hex but rather with serializing it so that old clients can accept them.

@yeastplume
Copy link
Member

@svechinsky Right, we're going to have to take a decision at some point as to what to do about older wallets, obviously they won't be able to handle the new format and will choke rather gracelessly. Also, we should probably take the opportunity here to add a version ID to the slate to help us mitigate future problems, and ensure the wallet takes it into consideration (and keep a minimum version it can handle).

Unfortunately this has gone a little bit worm-canny. Can I suggest the following:

  1. Remove the commented out directives, and just commit the serialization lib in this PR. (This will let me get on with Save slate participant messages in database #2441 as well)
  2. Another PR for an optional Slate ID (and have to consider how this remains backwards compatible, given it would adds a field that doesn't exist in older clients)
  3. Another PR to handle the integration of new slate + backwards compatibility concerns there

@svechinsky
Copy link
Contributor Author

Ok, will sort out today/tomorrow, will def do 1 today so it won't block #2441

@yeastplume yeastplume changed the title Feature: add hex serialization to slate Add hex serialization functions Jan 24, 2019
@yeastplume
Copy link
Member

Okay, great thank you. Lib functions looks good as they are, so I'll merge.

@yeastplume yeastplume merged commit a523f82 into mimblewimble:master Jan 24, 2019
@svechinsky svechinsky deleted the feature/serializing-slate branch January 24, 2019 14:55
bitgrin pushed a commit to bitgrin/bitgrin that referenced this pull request Mar 2, 2019
* Change slate seralization to hex

* rustfmt

* Comment out serde directives
Move serialization functions into a seperate module

* Remove commented code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants