refactor(core): make address, crypto crates #1799
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Breaks out
astria_core::crypto
to crateastria-core-crypto
and address related logic inastria_core::primitive::v1
toastria-core-address
Background
One needs to import the entire kitchensink that is
astria-core
even if one only wants to use a fraction of its types. That leads to extremely long compilation times because all of its dependencies need to be compiled.This patch is the start to breaking out parts of
astria-core
into their own free standing crates, whichastria-core
then reexports.A useful sideeffect of this change is that the coupling between the different parts of astria-core is reduced (for example, by removing the rarely used utility method
SigningKey::try_address
, allowing to decouple address and crypto logic).Changes
astria_core::crypto
into new createastria-core-crypto
and reexport under theastria_core::crypto
alias (not breaking to consumers)astria_core::primitive::v1
intoastria-core-address
, reexport commonly used types from the old module aastria-core-address
asastria_core::primitive::v1::address
(partially breaking to consumers because publicly accessible types are moved into a new submodule)Serialize
andDeserialize
impls on the domain typeAddress
(breaking because one needs to explicitly construct protobuf/wire typeAddress
; not breaking on the wire, json format stays the same)Protobuf
("domain type") trait forAddress
, removing its inherent constructors and methods to move from/to raw protobuf types ("wire types"). Requireds to uncoupleastria-core-address
fromastria-core
(specifically, the generated protobuf types) (breaking for consumers because they now need to import theProtobuf
trait)astria-core-consts
that only contains the constADDRESS_LENGTH
to allow decoupling of address and crypto logic.SigningKey::try_address
utility method that was only ever used in tests to remove all coupling between cryptography primitives and addresses (breaking for users of this method)Testing
Tests were shuffled around but not removed. Snapshot tests stay in place in astria core for now (because they are specifically demanded for wire/protobuf types).
Changelogs
Ensure all relevant changelog files are updated as necessary. See
keepachangelog for change
categories. Replace this text with e.g. "Changelogs updated." or "No updates
required." to acknowledge changelogs have been considered.
Breaking Changelist
astria-core
, but we don't provide any stability guarantees for it.Related Issues
Part of #1798