Skip to content

Conversation

@madisoncarter1234
Copy link
Contributor

@madisoncarter1234 madisoncarter1234 commented Dec 10, 2025

Summary

Migrates flashblocks subscriptions from the base namespace to the eth namespace per #250.

Since no release has been cut with base_subscribe yet, this is a clean replacement with no backwards compatibility needed.

  • Rename BasePubSubApiEthPubSubApi (namespace: baseeth)
  • Rename BasePubSubEthPubSub
  • Rename BaseSubscriptionKindEthSubscriptionKind
  • Use replace_configured to override reth's existing eth_subscribe
  • Update all tests to use eth_subscribe/eth_unsubscribe

Usage

- method: "base_subscribe", params: ["newFlashblocks"]
+ method: "eth_subscribe", params: ["newFlashblocks"]

- method: "base_unsubscribe"
+ method: "eth_unsubscribe"

Test plan

  • All 18 flashblocks RPC tests pass
  • Release build succeeds

Closes #250

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Dec 10, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

  Migrates flashblocks subscriptions from the base namespace to eth namespace
  per issue base#250. Since no release has been cut with base_subscribe yet,
  this is a clean replacement with no backwards compatibility needed.

  Changes:
  - Rename BasePubSubApi -> EthPubSubApi (namespace: base -> eth)
  - Rename BasePubSub -> EthPubSub
  - Rename BaseSubscriptionKind -> EthSubscriptionKind
  - Use replace_configured to override reth's existing eth_subscribe
  - Update all tests to use eth_subscribe/eth_unsubscribe

  Closes base#250
@madisoncarter1234 madisoncarter1234 force-pushed the feat/migrate-base-subscribe-to-eth branch from 0efce22 to 58c4468 Compare December 10, 2025 22:56
Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

This looks good to me. Would appreciate second set of eyes from @danyalprout. Since we're using replace_configured on the module context, we shouldn't run into any namespace collision errors and the test suite should validate this behavior. Nice work @madisoncarter1234!

@madisoncarter1234
Copy link
Contributor Author

This looks good to me. Would appreciate second set of eyes from @danyalprout. Since we're using replace_configured on the module context, we shouldn't run into any namespace collision errors and the test suite should validate this behavior. Nice work @madisoncarter1234!

glad to help!!

@danyalprout
Copy link
Collaborator

This looks great re: renaming. As we're overriding, do we need to extend the enum for the standard subscription types and proxy them to Reth?

@madisoncarter1234
Copy link
Contributor Author

This looks great re: renaming. As we're overriding, do we need to extend the enum for the standard subscription types and proxy them to Reth?

Right.​‍​‌‍​‍‌​‍​‌‍​‍‌ The initial PR was mainly about the namespace migration from base_subscribe to eth_subscribe and didn't really consider the full enum extension that you mentioned in #250. Because replace_configured changes the whole eth_subscribe handler, standard subscription types such as newHeads and logs would stop working if used with the current implementation.

I will change the enum to include standard types and proxy them to reth's underlying handler. A revision will be ​‍​‌‍​‍‌​‍​‌‍​‍‌pushed.

@danyalprout
Copy link
Collaborator

Amazing -- thank you @madisoncarter1234

  Per base#250, this extends the eth_subscribe handler to support both
  standard Ethereum subscription types and Base-specific flashblocks
  subscriptions.

  Changes:
  - Rename EthSubscriptionKind to ExtendedSubscriptionKind
  - Add standard types: newHeads, logs, newPendingTransactions, syncing
  - Add Base-specific types: newFlashblocks, pendingLogs
  - Proxy standard subscription types to reth's underlying implementation
  - Add reth-rpc dependency for access to RethEthPubSub
  - Update EthPubSub to accept eth_api for proxying
  - Add test for standard newHeads subscription

  This ensures backwards compatibility with existing eth_subscribe usage
  while adding flashblocks-specific subscription capabilities.
@madisoncarter1234
Copy link
Contributor Author

Updated​‍​‌‍​‍‌​‍​‌‍​‍‌ the implementation to extend eth_subscribe with full support for standard subscription types per #250.

Changes:

  • Renamed EthSubscriptionKind to ExtendedSubscriptionKind
  • Added standard types: newHeads, logs, newPendingTransactions, syncing
  • Added Base-specific types: newFlashblocks, pendingLogs
  • Standard subscription types are now proxied to reth's underlying EthPubSub implementation
  • Added reth-rpc dependency for access to reth's pubsub handler

This maintains backwards compatibility, existing eth_subscribe("newHeads") calls will still function as they have been while also allowing for flashblocks-specific subscriptions to be used.

Regarding the overriding of newPendingTransactions to use flashblocks state, I have left it as standard behavior for now since it has different semantics (mempool txs vs sequenced txs) I would be glad to create a flashblocks specific variant in a follow up if you want

Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

This looks great; nice work!

/// New flashblocks subscription.
pub enum ExtendedSubscriptionKind {
/// New block headers subscription (standard).
NewHeads,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe this enum should encapsulate the SubscriptionKind enum rather than redefining it. while i dont expect the signature to change anytime soon, if it ever were to change, it would be nice to automatically have support for it or automatically get an unhandled error

Copy link
Contributor

Choose a reason for hiding this comment

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

➕ I like this approach as well.

assert_eq!(sub["jsonrpc"], "2.0");
assert_eq!(sub["id"], 1);
// Should return a subscription ID, confirming the subscription was accepted
assert!(sub["result"].is_string(), "Expected subscription ID, got: {:?}", sub);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is is_string the correct assertion to make here?

Copy link
Collaborator

@danyalprout danyalprout left a comment

Choose a reason for hiding this comment

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

This looks great, I'm happy to experiment with the enum proposal in a follow up.

@danyalprout danyalprout merged commit 08bd601 into base:main Dec 12, 2025
10 checks passed
@madisoncarter1234
Copy link
Contributor Author

Thanks everyone!!

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

Successfully merging this pull request may close these issues.

Migrate base_subscribe to eth_subscribe

5 participants