Skip to content

rpcdaemon,rulesconfig: align Bor engine selection - #20667

Open
JayeTurn wants to merge 2 commits into
erigontech:mainfrom
JayeTurn:rpcdaemon-rulesconfig-bor-selection
Open

JayeTurn wants to merge 2 commits into
erigontech:mainfrom
JayeTurn:rpcdaemon-rulesconfig-bor-selection

Conversation

@JayeTurn

Copy link
Copy Markdown
Contributor

Summary

  • add a shared ActiveRulesName / UsesBorEngine decision in node/rulesconfig
  • make rpcdaemon use that decision for local engine setup, remote engine setup, and Bor reader compatibility checks
  • add a regression test covering the ValidatorContract gate

Problem

CreateRulesEngine only enables the Bor engine when the Bor config has a validator contract, but rpcdaemon was instantiating bor.NewRo whenever cc.Bor != nil. That let the RPC path drift away from the main engine factory and could enable Bor-only behavior on configs that should still behave like ethash.

Solution

Move the active consensus selection into node/rulesconfig and reuse it from rpcdaemon, so both paths apply the same Bor gate and fall back consistently when Bor support is only partially present.

@AskAlexSharov AskAlexSharov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

unfortunately we don't support bor/polygon anymore

@awskii awskii mentioned this pull request Aug 22, 2026
@awskii

awskii commented Aug 22, 2026

Copy link
Copy Markdown
Member

Closing as overtaken by events rather than on the merits: Erigon has dropped Polygon support, tracked in #23503.

The diagnosis was right — rpcdaemon instantiated bor.NewRo whenever cc.Bor != nil while CreateRulesEngine additionally gated on the validator contract, so the two paths really could disagree. Consolidating that decision in node/rulesconfig was the correct shape.

Both sides of the mismatch are now gone: #23492 removed the Bor arm from CreateRulesEngine and the bor.NewRo construction from cmd/rpcdaemon/cli, and #23497 removes chain.Config.Bor and the BorConfig interface entirely, so there is no longer a gate to align. Sorry this sat open long enough to be outrun.

@awskii awskii closed this Aug 22, 2026
@awskii awskii reopened this Aug 25, 2026
@awskii

awskii commented Aug 25, 2026

Copy link
Copy Markdown
Member

Reopening. I closed this on the Bor half of the mismatch; the shape you diagnosed outlived Polygon.

rpcdaemon still never consults node/rulesconfig. Both paths fall through to ethash.NewFaker() — cmd/rpcdaemon/cli/config.go:555 and :1012 — while CreateRulesEngine now checks the L2 engine registry first and panics on an unregistered one (node/rulesconfig/config.go:85-88). Same misconfiguration, opposite failure modes: loud in-node, silent L1 semantics for calls and traces in standalone rpcdaemon. ReadChainConfig restores only L2JSON and chain.Config.L2 is json:"-", so cc.L2 is nil there even for a correctly registered chain.

Your fix shape — move the active consensus selection into node/rulesconfig and reuse it from rpcdaemon — is still the right one. The gate to align is now the L2 engine registry instead of Bor's validator contract. // TODO(yperbasis): try to unify with CreateRulesEngine is still sitting at :995.

Also recorded independently by yperbasis on #22200 (2026-07-29).

@awskii

awskii commented Aug 26, 2026

Copy link
Copy Markdown
Member

To be concrete about where this lands now — the diff above is empty against current main. #23492 and #23497 deleted both Bor arms, so there is nothing left for this patch to change.

The defect you diagnosed did survive the removal, and it is item 1 of the gate in #22193.

What it looks like today, with Bor gone:

  • cmd/rpcdaemon/cli/config.go:555 and :1012 still fall through to ethash.NewFaker()
  • CreateRulesEngine now consults the L2 engine registry first and panics on an unregistered one (node/rulesconfig/config.go:85-88)
  • so one misconfiguration has two failure modes: a loud panic in-node, and silent L1 semantics for calls and traces in standalone rpcdaemon
  • ReadChainConfig restores only L2JSON, and chain.Config.L2 is json:"-" — so cc.L2 is nil in rpcdaemon even for a correctly registered chain. The resolver contract is part of the fix, not just the switch

Your shape holds unchanged: move the active consensus selection into node/rulesconfig and reuse it from rpcdaemon. The gate to align is the L2 engine registry rather than Bor's validator contract. // TODO(yperbasis): try to unify with CreateRulesEngine is still at :995, and yperbasis recorded the same divergence independently on #22200 (2026-07-29).

It closes standalone and blocks nothing else in that epic. Yours if you want it — say so and I will leave it alone; otherwise I will pick it up and credit the diagnosis here.

This branch has not been deployed

No deployments
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