-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Move the wallet into linera-core
#5080
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
base: main
Are you sure you want to change the base?
Conversation
| @@ -1,1008 +1,800 @@ | |||
| // Copyright (c) Zefchain Labs, Inc. | |||
| // SPDX-License-Identifier: Apache-2.0 | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the PR need to refactor this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have to, but I got frustrated making a bunch of changes to it every time I called ClientContext::new, so I refactored it to speed up my development.
(It could probably be done in a separate PR — but I'd already changed the APIs it calls and it was 3am 😅)
Motivation
In #2194 I tried to abstract over the wallet by introducing a trait for values that could be persisted. However, this still exposed too much information about the wallet: the wallet data structure used by
linera-client(thenlinera-service) contains additional information that is not useful to the core client. This made incremental porting hard, as to move the wallet intolinera-coreimplied moving all that data (which includes TCP/gRPC-specific address information) intolinera-coreas well, where it does not belong. Much of this information (signing keys) has been separated out into thekeystore.jsonin #3696, but some still remains (the default chain and the genesis config).Now, in order to support wallet autosigning, we would like to support implementing wallets for more complicated JavaScript structures as well, which may not map neatly to the CLI
wallet.jsonfile structure.Proposal
Add a
Wallettrait tolinera-core(as a component ofEnvironment) that only exposes the part of the interface related to managing chains, as trait methods. Currently the trait expects shared-ref&selfmethods as the client will duplicate the wallet all over the place; after future client refactorings we can probably simplify it to support&mutmethods.Generalize
linera-serviceto maintain theEnvironmentabstraction a little better, though there are still places that fix various component types.Test Plan
CI should be sufficient.
Release Plan
testnetbranch, thenLinks