Skip to content

Finish refactoring Root so the create methods can take a conversion method #18041

@cjjdespres

Description

@cjjdespres

Most of the necessary work for this was done in #17996.

Goal: the Root.create* methods in mina_ledger/root need to be able to accept an optional account conversion method. Or rather, the configured backing type must be either Stable_db (with no further config) or Converting_db with a mandatory account conversion method of some kind. This could even just be the planned genesis slot of the upcoming hard fork, but an entire Account.t -> Account.Hardfork.t method is fine too.

Why? The vesting parameter update method can only be determined at runtime based on the stop slots, so the components that initialize root ledgers will need to be able to set the update methods (in some way) themselves. As for it being optional, we may not have a hard fork planned, in which case there will be no account conversion method available to us at all!

So:

  1. Create a wrapper concrete Root implementation over Ledger.Db, perhaps, that exposes a Root interface over a plain Ledger.Db. The make_converting method is the only potentially weird one here: I think we should simply have it throw an exception for this concrete Root. There isn't much else it could do.
  2. Add a parameter to the Root.Config type (probably the backing type) for a mandatory account conversion method
  3. Use the existing incomplete Account.Hardfork.of_stable method as a temporary measure when create-ing roots.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions