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

Fix Serialisation of BIP32 Keystore #278

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

podkovyrin
Copy link
Contributor

Be aware that this change breaks backward compatibility.

fixes #257

@skywinder
Copy link
Collaborator

skywinder commented Oct 5, 2020

About the compatibility I will bump a major version. Thank you for mentioning this.

@skywinder
Copy link
Collaborator

@podkovyrin is there any idea, how we can make internal migration from the old address-path storage version?
I would love to increase this bounty or create new for this feature 👍

Copy link
Collaborator

@skywinder skywinder left a comment

Choose a reason for hiding this comment

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

Thanks, that's how it should looks like. Just want to porpose to make smooth experience for existing users and add migration function at init + deprecated flag for old parameter.

I apreciate quality and amount of your work. And if you will done thins migrations I would be glad in increase at least 2 times this bounty. 👍


import Foundation

public struct PathAddressStorage {
Copy link
Collaborator

@skywinder skywinder Oct 5, 2020

Choose a reason for hiding this comment

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

This struct works much better. great design 👍

@@ -44,8 +41,10 @@ public class BIP32Keystore: AbstractKeystore {
// --------------

public var keystoreParams: KeystoreParamsBIP32?
public var paths: [String:EthereumAddress] = [String:EthereumAddress]()
Copy link
Collaborator

Choose a reason for hiding this comment

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

My idea to set this variable as deprecated:

@available(*, deprecated, message: "Please use addressStorage instead")

@podkovyrin
Copy link
Contributor Author

podkovyrin commented Oct 5, 2020

About the compatibility I will bump a major version. Thank you for mentioning this.

Another important thing worth mentioning that v3 is compatible with Eth Keystore Format used across multiple wallets. In my case, I didn't care about that compatibility but for some, it might be a serious issue. As a workaround, an importer/exporter can be introduced which would solve the migration problem at the same time. Also, it's probably a good idea to name this version like 3-web3swift or anything which wouldn't conflict with future versions of Eth Keystore Format.
Regarding conversion to the new format, it's impossible to decide which address should come first on the lib side unless we sync the blockchain headers. I would say this requires input from the library user or the end-user itself otherwise, we end up with another issue. So there should be an explicit migration strategy of dealing with sort order.

@skywinder
Copy link
Collaborator

@podkovyrin well, your’re right, it's impossible to predict order from old version.

But it would be possible and good practive to migrate them in any order, so developers can update the version without refactoring (and writing migration in their own code).

@skywinder
Copy link
Collaborator

so, there are 2 options on your choose @podkovyrin:

  1. since it's develop branch, we are able to make another bounty for that and I will merge this one
  2. made migration in this PR, and I will double bounty for you

@podkovyrin
Copy link
Contributor Author

Whatever :) This migration is quite time-consuming and I would make it in a week or two.

@skywinder
Copy link
Collaborator

Agree. Well, I like your style and agree that it takes time.
I will increase bounty x3, but prefer to reserve it for you in one single PR for consistency. 👍
And thank you again for the help!

@skywinder skywinder added 💸 gitcoin-bounty Earn money by helping with this issue! and removed hacktoberfest labels Jul 31, 2021
@BaldyAsh BaldyAsh merged commit 45439ec into web3swift-team:develop Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💸 gitcoin-bounty Earn money by helping with this issue!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialisation of BIP32 misplaced address postition
3 participants