-
Notifications
You must be signed in to change notification settings - Fork 214
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
Restrict Checkpoints
to be constructible from genesis only
#3048
Conversation
d6b8b31
to
941980f
Compare
78b88ca
to
e2d8e6c
Compare
e2d8e6c
to
c54becd
Compare
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.
LGTM! Left several suggestions. Maybe you will find defining new sum error in putCheckpoint method of DBLayer interface reasonable. I feel we should not differentiate no wallet and no genesis from each other in a sense they are both very serious/critical and if so why not to treat them on the same level ;-)
The function `fromGenesis` replaces the `singleton` function.
163c67a
to
d68b1e5
Compare
bors merge |
3048: Restrict `Checkpoints` to be constructible from genesis only r=HeinrichApfelmus a=HeinrichApfelmus ### Issue number ADP-1043 ### Overview Previous work in epic ADP-1043 introduced delta encodings, DBVars, and an embedding of the wallet state and its delta encodings into a database table. It's time to integrate these tools with the wallet code. To facilitate code review, the integration proceeds in a sequence of refactorings that do not change functionality and pass all unit tests. In this step, we implement a suggestion that came up during review where we remove the `singleton` function in favor of `fromGenesis`, making sure that the `Checkpoints` structure always contains a checkpoint for the genesis block. ### Details * The `initializeWallet` function will now throw an exception if it is incorrectly called with a checkpoint that is not at the genesis block. * Many unit tests are adapted to use the `InitialCheckpoint` generator in order to comply with the above restriction. ### Comments Merge PR #3046 before this one, because this pull request is based on the branch of the former. Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed:
|
bors retry |
Build succeeded: |
3056: Introduce `Prologue` and `Discoveries` of an address book r=HeinrichApfelmus a=HeinrichApfelmus ### Issue number ADP-1043 ### Overview Previous work in epic ADP-1043 introduced delta encodings, DBVars, and an embedding of the wallet state and its delta encodings into a database table. It's time to integrate these tools with the wallet code. To facilitate code review, the integration proceeds in a sequence of refactorings that do not change functionality and pass all unit tests. In this step, we begin refactoring the address discovery state (the `s` in `Wallet s`). First, I would like to update our nomenclature and call this state an *address book*. Second, we introduce two new data families `Prologue s` and `Discoveries s`, with the intention that any address book is isomorphic to a pair of these two types, that is `s ~ (Prologue s, Discoveries s)`. The idea is that the Prologue of the address book contains "static" information such as public keys or the address gap (default 20), while the Discoveries of the address book contains information that was gathered during on-chain address discovery. ### Details * We introduce a type class `AddressBookIso` which provides the isomorphism `s ~ (Prologue s, Discoveries s)`. * For this pull request, we avoid making any changes to the `AddressDiscovery.*` hierarchy. Instead, the isomorphisms are implemented using newly defined data families whose representation is close to the types in the database. * The implementation for the sequential states uses `liftPaymentAddress` to convert the payment part to and from the `Address` type. This is ok when convering to/from the database layer, but does not make sense for in-memory data structures. Therefore, further work in this epic will introduce changes in the `AddressDiscovery.*` hierarchy. ### Comments * The overall goal is that, in a future PR, we can represent the wallet state along the lines of `WalletState s ~ (Prologue s, Checkpoints (BlockHeader, UTxO, Discoveries s) `. * Merge PR #3048 before this one, because this pull request is based on the branch of the former. Co-authored-by: Heinrich Apfelmus <[email protected]>
Issue number
ADP-1043
Overview
Previous work in epic ADP-1043 introduced delta encodings, DBVars, and an embedding of the wallet state and its delta encodings into a database table. It's time to integrate these tools with the wallet code. To facilitate code review, the integration proceeds in a sequence of refactorings that do not change functionality and pass all unit tests.
In this step, we implement a suggestion that came up during review where we remove the
singleton
function in favor offromGenesis
, making sure that theCheckpoints
structure always contains a checkpoint for the genesis block.Details
initializeWallet
function will now throw an exception if it is incorrectly called with a checkpoint that is not at the genesis block.InitialCheckpoint
generator in order to comply with the above restriction.Comments
Merge PR #3046 before this one, because this pull request is based on the branch of the former.