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

chore(deps): internalize rpc types #490

Merged
merged 3 commits into from
Feb 12, 2025
Merged

Conversation

jbcaron
Copy link
Member

@jbcaron jbcaron commented Feb 7, 2025

Pull Request type

Please add the labels corresponding to the type of changes your PR introduces:

  • Refactoring (no functional changes, no API changes)

What is the current behavior?

Currently, Madara relies on the external starknet-types-rpc crate from the Starknet team, which is no longer actively maintained. This creates a dependency on an unmaintained third-party library for critical RPC types and functionality.

Resolves: #NA

What is the new behavior?

  • Creates a new mp-rpc crate that is a fork of starknet-types-rpc v0.7.1 under Madara's control
  • Migrates all usage of starknet-types-rpc types to use the new mp-rpc types internally
  • Updates imports and dependencies across all affected crates to use the new mp-rpc
  • Removes starknet-types-rpc dependency
  • Preserves all existing functionality while bringing type definitions under internal control

Key changes:

  • Copied and adapted RPC types from starknet-types-rpc to new mp-rpc crate
  • Unified RPC type usage across Madara codebase
  • Updated serialization/deserialization implementations
  • Removed unnecessary genericity on Felt to reduce complexity
  • Maintained compatibility with existing interfaces

Does this introduce a breaking change?

No

Other information

@jbcaron jbcaron self-assigned this Feb 7, 2025
@jbcaron jbcaron changed the title chore(dps): internalize rpc types chore(deps): internalize rpc types Feb 7, 2025
Copy link
Collaborator

@Trantorian1 Trantorian1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

crates/madara/primitives/rpc/src/custom/query.rs Outdated Show resolved Hide resolved
Comment on lines 1 to 20
//! This crate is a fork of the original [starknet-types-rpc](https://github.com/starknet-io/types-rs) v0.7.1,
//! which was originally developed by the Starknet team under the MIT license.
//!
//! The original crate is no longer actively maintained, so this fork has been created
//! to ensure continued maintenance and compatibility with our project needs.
//!
//! Original authors:
//! - Pedro Fontana (@pefontana)
//! - Mario Rugiero (@Oppen)
//! - Lucas Levy (@LucasLvy)
//! - Shahar Papini (@spapinistarkware)
//! - Abdelhamid Bakhta (@abdelhamidbakhta)
//! - Dan Brownstein (@dan-starkware)
//! - Federico Carrone (@unbalancedparentheses)
//! - Jonathan Lei (@xJonathanLEI)
//! - Maciej Kamiński (@maciejka)
//!
//! Original repository: https://github.com/starknet-io/types-rs
//! Original version: 0.7.1
//! License: MIT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add this in a .md at the crate level?

@heemankv heemankv self-requested a review February 10, 2025 13:56
@@ -291,10 +291,10 @@ impl Default for TrieLogConfig {
/// by subscribing to the corresponding channel.
pub struct EventChannels {
/// Broadcast channel that receives all events regardless of their sender's address
all_channels: tokio::sync::broadcast::Sender<EmittedEvent<Felt>>,
Copy link
Contributor

@heemankv heemankv Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://github.dev/jbcaron/types-rs

v0_6_0 :
pub type BlockHash = Felt;
v0_7_1 :
pub type BlockHash<F> = F;

This PR's description says we are following v0_7_1 but the code suggests that we are falling back to v0_6_0,
Can you clear this confusion @jbcaron ?
Thanks

This seems to be followed throughout the PR.

  • BroadcastedInvokeTxn
  • EmittedEvent
  • AddInvokeTransactionResult
    and so on

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve removed the genericity on Felt to simplify the codebase.
That’s why it might seem like we’re falling back to v0_6_0, but it’s intentional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I notice you have also updates the PR description,
looks good to me now!

@heemankv heemankv self-requested a review February 12, 2025 08:39
@jbcaron jbcaron merged commit af7078c into main Feb 12, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants