Skip to content

refactor(juno): obsolete the PendingData interface#3512

Merged
rodrodros merged 19 commits intomainfrom
maksym/deprecate-pending-data-interface
Apr 8, 2026
Merged

refactor(juno): obsolete the PendingData interface#3512
rodrodros merged 19 commits intomainfrom
maksym/deprecate-pending-data-interface

Conversation

@MaksymMalicki
Copy link
Copy Markdown
Contributor

@MaksymMalicki MaksymMalicki commented Mar 30, 2026

This PR is the follow-up to Pending block deprecation. Previously, the PendingData interface was used through-out the project, so that both Pending and PreConfirmed blocks were accepted depending on protocol version. They were differentiated by a Variant() method . After deprecating the Pending block, the PendingData became a single-implementation interface an can be removed.

Since both rpcv6 and v8 return an empty Pending block for PendingData, which has no transactions, receipts and events - a no-op function is used for backward compatibility.

The scope of this PR is solely to get rid of PendingData interface. There will be a follow-up PR, where the naming through-out the project will be cleaned (e.g. rpc/v9/subscriptions.go - onPendingData - > onPreConfirmed). Reviewers should focus purely on correctness, as cosmetic changes were separated into another PR to reduce the noise.

NOTES:

  • linter fails are expected as the core.Pending (which is deprecated) was used in the rpc v6/v8 instead of PendingData interface

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 72.00000% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.46%. Comparing base (a6a6425) to head (c4109a3).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
rpc/mocks/mock_gateway_handler.go 0.00% 15 Missing ⚠️
sync/sync.go 50.00% 5 Missing and 2 partials ⚠️
rpc/v8/subscriptions.go 50.00% 2 Missing and 1 partial ⚠️
sequencer/sequencer.go 33.33% 2 Missing ⚠️
builder/builder.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3512      +/-   ##
==========================================
+ Coverage   75.10%   75.46%   +0.36%     
==========================================
  Files         386      385       -1     
  Lines       34923    34823     -100     
==========================================
+ Hits        26228    26279      +51     
+ Misses       6736     6708      -28     
+ Partials     1959     1836     -123     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaksymMalicki MaksymMalicki marked this pull request as ready for review March 31, 2026 10:04
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-v2 branch from 0c3775c to 531e909 Compare March 31, 2026 17:08
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch 2 times, most recently from 02da98b to 22c736c Compare March 31, 2026 18:06
Comment thread sync/sync.go Outdated
Comment thread sync/sync.go Outdated
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-v2 branch from 06916cd to 3bffac0 Compare April 1, 2026 15:04
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch from 1af841f to 77b412e Compare April 1, 2026 16:55
Copy link
Copy Markdown
Contributor

@EgeCaner EgeCaner left a comment

Choose a reason for hiding this comment

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

Dropped some comments, rest looks good to me

Comment thread sync/sync.go Outdated
Comment thread sync/pending_polling.go Outdated
Comment thread rpc/v10/subscriptions_test.go Outdated
Base automatically changed from maksym/deprecate-pending-v2 to main April 2, 2026 12:36
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch 2 times, most recently from 8261a14 to 1374738 Compare April 2, 2026 12:58
Comment thread rpc/v10/helpers.go
Comment thread rpc/v10/helpers.go Outdated
Comment thread sync/pending_polling.go
Copy link
Copy Markdown
Contributor

@rodrodros rodrodros left a comment

Choose a reason for hiding this comment

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

blocking until I do a full review

Comment thread sync/pending_polling.go Outdated
Comment thread sync/pending_polling.go Outdated
Copy link
Copy Markdown
Contributor

@rodrodros rodrodros left a comment

Choose a reason for hiding this comment

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

It seems rebase was not correctly done?

Comment thread sync/pending_polling_test.go Outdated
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch from fdd32ed to dd125fc Compare April 2, 2026 14:35
@MaksymMalicki MaksymMalicki marked this pull request as draft April 3, 2026 11:28
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch from 002d6a1 to d277bb1 Compare April 7, 2026 11:28

mockReader.EXPECT().TransactionByHash(txHash).Return(nil, db.ErrKeyNotFound)
mockSyncReader.EXPECT().PendingData().Return(nil, core.ErrPendingDataNotFound)
mockReader.EXPECT().HeadsHeader().Return(nil, db.ErrKeyNotFound)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The removal of the pending_data_wrapper.go allowed me to reduce the number of HeadsHeader() from 2 to 1 (called only once by the syncReader.PendingData(). No need to mock rn

Comment thread rpc/v6/helpers.go
block, err = h.bcReader.BlockByNumber(id.Number)
}
if err != nil {
if errors.Is(err, db.ErrKeyNotFound) || errors.Is(err, core.ErrPendingDataNotFound) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PendingData() for v6 now always returns an empty PendingBlock - core.ErrPendingDataNotFound is never emitted

Comment thread sync/sync.go
return nil, core.ErrPendingDataNotFound
}

func (s *Synchronizer) PendingBlock() *core.Block {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this was only used with tests and could simply be replaced by GetBlock() method of the preconfirmed

Copy link
Copy Markdown
Contributor

@EgeCaner EgeCaner left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread sync/pending_polling_test.go Outdated
@MaksymMalicki MaksymMalicki force-pushed the maksym/deprecate-pending-data-interface branch from fcb6d74 to c4109a3 Compare April 7, 2026 18:52
@MaksymMalicki MaksymMalicki marked this pull request as ready for review April 7, 2026 19:08
@rodrodros rodrodros merged commit 3380467 into main Apr 8, 2026
24 of 25 checks passed
@rodrodros rodrodros deleted the maksym/deprecate-pending-data-interface branch April 8, 2026 15:15
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.

3 participants