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

refactor(core): make address, crypto crates #1799

Closed
wants to merge 1 commit into from

Conversation

SuperFluffy
Copy link
Member

Summary

Breaks out astria_core::crypto to crate astria-core-crypto and 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.

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)
  • Move address related types out of astria_core::primitive::v1 into astria-core-address, reexport commonly used types from the old module a astria-core-address as astria_core::primitive::v1::address (partially breaking to consumers because publicly accessible types are moved into a new submodule)
  • 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"). Requireds to uncouple 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.
  • Remove the 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

  • These changes leave all services untouched.
  • These changes would be breaking the public API of astria-core, but we don't provide any stability guarantees for it.

Related Issues

Part of #1798

@SuperFluffy SuperFluffy added refactor code refactoring or maintainence code-quality core pertaining to the astria-core crate labels Nov 11, 2024
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Nov 11, 2024
@SuperFluffy
Copy link
Member Author

Closing in favor of #1800 and #1802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality core pertaining to the astria-core crate refactor code refactoring or maintainence sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant