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

Break out all astria-core submodules into self-standing crates #1798

Open
SuperFluffy opened this issue Nov 11, 2024 · 0 comments
Open

Break out all astria-core submodules into self-standing crates #1798

SuperFluffy opened this issue Nov 11, 2024 · 0 comments

Comments

@SuperFluffy
Copy link
Member

SuperFluffy commented Nov 11, 2024

We want to try and break out as many of astria-core submodules into free standing crates as possible.

This is a tracking issue to gather all PRs to that effect.

Goals:

  1. reduce compile times for services and binaries that only need a subset of astria core types.
  2. Better separation and decoupling between astria core items
  3. Better maintainability

┆Issue Number: ENG-1003

github-merge-queue bot pushed a commit that referenced this issue Nov 20, 2024
## Summary
Breaks out `astria_core::crypto` to crate `astria-core-crypto`.

## 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, which `astria-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
- Move the module `astria_core::crypto` into new create
`astria-core-crypto` and reexport under the `astria_core::crypto` alias
(not breaking to consumers)
- Remove the tight coupling between the crypto and address parts of the
stack by removing the `SigningKey::try_address` (rarely used and only
inside a few tests) method and moving `ADDRESS_LENGTH` to a thin
`astria-core-consts` crate (this is a breaking change for users of
`SigningKey::try_address`).

## Testing
Tests for astria core's crypto refinement types were moved to
`astria-core-crypto` and left unchanged. Sequencer tests were updated to
use `Address::builder` instead of `SigningKey::try_address` and
otherwise also left unchanged.

## Changelogs
Changelogs updated.

## Breaking Changelist
- These changes leave all services untouched.
- These changes would be breaking the public API of `astria-core` due to
the removal fo `SigningKey::try_address` but we don't provide any
stability guarantees for it.
 
## Related Issues
Part of #1798
github-merge-queue bot pushed a commit that referenced this issue Nov 20, 2024
## Summary
Breaks out address related logic in `astria_core::primitive::v1` to
`astria-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, which `astria-core` then reexports.


## Changes
- Move address related types out of `astria_core::primitive::v1` into
`astria-core-address`
- Reexport all moved types under the same module (aliasing, where
necessary)
- Remove the serde `Serialize` and `Deserialize` impls on the domain
type `Address` (breaking because one needs to explicitly construct
protobuf/wire type `Address`; not breaking on the wire, json format
stays the same)
- Implement the `Protobuf` ("domain type") trait for `Address`, removing
its inherent constructors and methods to move from/to raw protobuf types
("wire types"); decouples `astria-core-address` from `astria-core`
(specifically, the generated protobuf types) (breaking for consumers
because they now need to import the `Protobuf` trait)
- Create a thin crate `astria-core-consts` that only contains the const
`ADDRESS_LENGTH` to allow decoupling of address and crypto logic
(addressed in a separate patch)
- Removed `AddressBuilder::with_iter` from the public interface (only
used inside the crate and not outside) (breaking for consumers of that
method)

## Testing
Tests were shuffled around but not removed. Snapshot tests stay in place
in astria core for now (because they are required for wire/protobuf
types).

## Changelogs
Changelogs updated.

## Breaking Changelist
- These changes leave all services untouched.
- If astria-core gave stability guarantees, this would be a breaking
change for consumers of `astria-core` because some inherent methods were
removed from its public API.
 
## Related Issues
Part of #1798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant