Skip to content

chore: remove candidate transactions and deprecated preconfirmed api#3732

Open
EgeCaner wants to merge 1 commit into
mainfrom
chore/remove-candidate-txs-and-deprecated-pconf-api
Open

chore: remove candidate transactions and deprecated preconfirmed api#3732
EgeCaner wants to merge 1 commit into
mainfrom
chore/remove-candidate-txs-and-deprecated-pconf-api

Conversation

@EgeCaner

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @EgeCaner's task in 4m 11s —— View job


PR Review: remove candidate transactions and deprecated preconfirmed API

  • Read PR diff (non-test source changes)
  • Review adapters / feeder / starknet removals
  • Review rpc v9/v10 subscription & transaction changes
  • Check for dangling references / build correctness
  • Post inline comments + summary

This is a clean, well-scoped removal. The Go packages all build (go build ./rpc/... ./adapters/... ./core/... ./clients/... ./starknet/... ./builder/... ./sequencer/... ./sync/... passes), there are no dangling references to the removed symbols (CandidateTxs, IsCandidateTx, GetCandidateTransaction, DeprecatedPreConfirmedBlock), and the AdaptPreConfirmedBlock / TransactionStatus refactors are functionally equivalent minus the candidate paths. One robustness point and one minor question below.

Important

  • adapters/sn2core/sn2core.go:538-544AdaptPreConfirmedBlock now indexes Receipts[i]/TransactionStateDiffs[i] unconditionally. The length check at L517-523 prevents index-out-of-range but not per-element nil, so a nil receipt or state diff (the old candidate signal) would now panic rather than error. This is safe under the new feeder API contract (no candidate slots), but since the input is external, consider an explicit guard — and note the test-side require.NotNilf contract check was also dropped. (inline comment posted)

Nit / question

  • rpc/v{9,10}/subscription_transactions.goTxnStatusCandidate / "CANDIDATE" is still accepted by the subscription UnmarshalJSON (subscription_types.go:102, subscriptions.go:309), but newTransactionsSubscriber no longer wires up any handler for it. A client subscribing to CANDIDATE alone will now silently receive nothing instead of an error. That's reasonable given candidates no longer exist in the protocol, but worth confirming whether the RPC should reject the value (or whether the enum should be removed in a follow-up) for clearer client feedback.
  • TransactionStatus now relies entirely on the feeder for any CANDIDATE finality (still mapped via adapt_transaction.go:275), rather than the local pre-confirmed search. Intentional and consistent with the deprecation — just noting the behavior shift.

Nothing here blocks the PR. The candidate removal looks correct and the test reduction tracks the deleted code paths.
chore/remove-candidate-txs-and-deprecated-pconf-api

Comment on lines +538 to 544
stateDiff, err := AdaptStateDiff(response.TransactionStateDiffs[i])
if err != nil {
return pending.PreConfirmed{}, err
}
txStateDiffs[preIdx] = &stateDiff
receipts[preIdx] = AdaptTransactionReceipt(response.Receipts[i])
txStateDiffs[i] = &stateDiff
receipts[i] = AdaptTransactionReceipt(response.Receipts[i])
eventCount += uint64(len(response.Receipts[i].Events))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The length check above (L517-523) guarantees the three slices have equal length, but it does not guarantee that individual elements are non-nil. With candidate handling removed, this loop now unconditionally dereferences each element:

  • AdaptStateDiff(response.TransactionStateDiffs[i]) panics if the entry is nil (AdaptStateDiff reads response.OldDeclaredContracts with no nil guard).
  • response.Receipts[i].Events (L544) is a nil-pointer deref if the receipt is nil.

A nil entry was precisely the old "candidate tx" signal (IsCandidateTx). This is safe only if the new PreConfirmedBlockWithIdentifier endpoint never returns partial/candidate slots — which is the documented API contract. Since this input comes from the (external) feeder gateway, a malformed/unexpected response would now panic the adapter instead of erroring out.

Consider guarding explicitly so a bad payload returns an error rather than crashing, e.g.:

if response.TransactionStateDiffs[i] == nil || response.Receipts[i] == nil {
    return pending.PreConfirmed{}, errors.New("pre_confirmed block contains a tx with missing receipt or state diff")
}

Note: the previous explicit contract assertion in TestAdaptPreConfirmedWithDelta (the require.NotNilf loop over receipts) was also removed in this PR, so neither the code nor the test now defends against this case.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.11%. Comparing base (ada24e9) to head (dc99137).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
rpc/v10/transaction.go 75.00% 1 Missing and 1 partial ⚠️
rpc/v9/transaction.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3732      +/-   ##
==========================================
- Coverage   75.13%   75.11%   -0.02%     
==========================================
  Files         425      424       -1     
  Lines       38331    38221     -110     
==========================================
- Hits        28799    28709      -90     
+ Misses       7538     7525      -13     
+ Partials     1994     1987       -7     

☔ View full report in Codecov by Harness.
📢 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.

@EgeCaner EgeCaner force-pushed the chore/remove-candidate-txs-and-deprecated-pconf-api branch from 8bd2e59 to dc99137 Compare June 18, 2026 18:27
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @EgeCaner's task in 2m 50s —— View job


PR Review: remove candidate transactions and deprecated preconfirmed API

  • Read updated PR diff (source changes)
  • Review sn2core adapter (nil-deref concern)
  • Review rpc v9/v10 subscription & transaction changes
  • Check for dangling references / build correctness
  • Post inline comments + summary

This is a clean, well-scoped removal. Affected Go packages build (go build ./adapters/... ./rpc/... ./core/... ./clients/... ./starknet/... ./builder/... ./sequencer/... ./sync/... passes), there are no dangling references to the removed symbols (CandidateTxs, IsCandidateTx, GetCandidateTransaction, DeprecatedPreConfirmedBlock, processCandidateTransactions), and the AdaptPreConfirmedBlock / TransactionStatus / subscription refactors are functionally equivalent minus the candidate paths.

Important

  • adapters/sn2core/sn2core.go:538-544AdaptPreConfirmedBlock now indexes TransactionStateDiffs[i] / Receipts[i] unconditionally. The length check (L517-523) prevents index-out-of-range but not per-element nil, so a nil receipt or state diff (the old candidate signal) would panic instead of erroring. Since the input is an external feeder-gateway response, a malformed payload crashes the adapter. The test-side require.NotNilf contract assertion was also dropped. Inline comment with a suggested guard posted. This is a robustness nit under the new API contract (no candidate slots), not a confirmed bug.

Nit

  • rpc/v{9,10}/subscription_transactions.goTxnStatusCandidate / "CANDIDATE" is still accepted by the subscription UnmarshalJSON, but newTransactionsSubscriber no longer wires any handler for it. A client subscribing to CANDIDATE alone now silently receives nothing rather than an error. Reasonable given candidates no longer exist in the protocol — worth confirming whether the RPC should reject the value or drop the enum in a follow-up.
  • rpc/v{9,10}/transaction.goTransactionStatus now relies entirely on the feeder for any CANDIDATE finality (still mapped via adapt_transaction.go), rather than the local pre-confirmed search. Intentional and consistent with the deprecation; just noting the behavior shift. The codecov-flagged uncovered lines are the feederClient == nil break and the adapt-error branch — test gaps, not bugs.

Nothing here blocks the PR. The candidate removal looks correct and the test reduction tracks the deleted code paths.
chore/remove-candidate-txs-and-deprecated-pconf-api

Comment on lines +538 to 544
stateDiff, err := AdaptStateDiff(response.TransactionStateDiffs[i])
if err != nil {
return pending.PreConfirmed{}, err
}
txStateDiffs[preIdx] = &stateDiff
receipts[preIdx] = AdaptTransactionReceipt(response.Receipts[i])
txStateDiffs[i] = &stateDiff
receipts[i] = AdaptTransactionReceipt(response.Receipts[i])
eventCount += uint64(len(response.Receipts[i].Events))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With candidate handling removed, this loop now unconditionally dereferences each per-tx slot. The size check at L517-523 only guarantees the three slices have equal length — not that individual elements are non-nil. A nil entry (previously the candidate signal via IsCandidateTx) would now panic rather than error:

  • AdaptStateDiff(response.TransactionStateDiffs[i]) panics — AdaptStateDiff reads response.OldDeclaredContracts (L457) with no nil guard.
  • response.Receipts[i].Events (L544) is a nil-pointer deref if the receipt is nil (AdaptTransactionReceipt itself handles nil, but this line doesn't).

Since this payload comes from the external feeder gateway, a malformed/unexpected response would crash the adapter instead of returning an error. The previous require.NotNilf contract assertion in TestAdaptPreConfirmedWithDelta was also dropped, so neither code nor test now defends this. Consider an explicit guard:

Suggested change
stateDiff, err := AdaptStateDiff(response.TransactionStateDiffs[i])
if err != nil {
return pending.PreConfirmed{}, err
}
txStateDiffs[preIdx] = &stateDiff
receipts[preIdx] = AdaptTransactionReceipt(response.Receipts[i])
txStateDiffs[i] = &stateDiff
receipts[i] = AdaptTransactionReceipt(response.Receipts[i])
eventCount += uint64(len(response.Receipts[i].Events))
if response.TransactionStateDiffs[i] == nil || response.Receipts[i] == nil {
return pending.PreConfirmed{}, errors.New("pre_confirmed block contains a tx with missing receipt or state diff")
}
stateDiff, err := AdaptStateDiff(response.TransactionStateDiffs[i])
if err != nil {
return pending.PreConfirmed{}, err
}
txStateDiffs[i] = &stateDiff
receipts[i] = AdaptTransactionReceipt(response.Receipts[i])
eventCount += uint64(len(response.Receipts[i].Events))

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.

1 participant