Skip to content

modularise message routing for sidecars#7751

Merged
tersec merged 7 commits intounstablefrom
mro
Jan 22, 2026
Merged

modularise message routing for sidecars#7751
tersec merged 7 commits intounstablefrom
mro

Conversation

@agnxsh
Copy link
Contributor

@agnxsh agnxsh commented Nov 23, 2025

No description provided.

@github-actions
Copy link

github-actions bot commented Nov 23, 2025

Unit Test Results

       12 files  ±0    2 440 suites  ±0   49m 34s ⏱️ - 14m 50s
12 668 tests ±0    9 191 ✔️ ±0    3 477 💤 ±0  0 ±0 
63 856 runs  ±0  51 426 ✔️ ±0  12 430 💤 ±0  0 ±0 

Results for commit a3c1040. ± Comparison against base commit 791cb3a.

♻️ This comment has been updated with latest results.

const finalSidecars = noSidecars
elif someSidecarsOpt is NoSidecarsAtFork and
typeof(blck).kind in ConsensusFork.Deneb..ConsensusFork.Electra:
let finalSidecars = Opt.none(BlobSidecars)
Copy link
Member

Choose a reason for hiding this comment

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

why is there no routing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the routing is called in the else block, apart from that, NoSidecarsAtFork is trying to capture all cases where we are in sidecar fork but there's no sidecar proposed for that block.

Copy link
Member

Choose a reason for hiding this comment

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

so .. why would we call this function with NoSideCarsAtFork and block from a fork that has sidecars?

Copy link
Member

Choose a reason for hiding this comment

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

basically this should be when someSidecarsOpt is NoSidecarsAtFork: nosidecars else: await publishSidecars(router, blck, someSidecarsOpt)

Copy link
Member

Choose a reason for hiding this comment

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

or add a noop overload for publishSidecars(..., NoSidecars)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, plausible

forkyBlck, Opt.some(
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),
Opt.none(seq[fulu.DataColumnSidecar]),
checkValidator = true)
Copy link
Member

Choose a reason for hiding this comment

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

why not overload routeSignedBeaconBlock too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we would have to re-write validate block and publish block part in each of the overloads, unless we add another function adapter of sorts, apart from that, there's no reason to not have it.

this looks ok too to me, i'm trying to assess what's the benefit of the overload.

NoSidecarsAtFork |
Opt[seq[BlobSidecar]] |
Opt[seq[fulu.DataColumnSidecar]] |
Opt[seq[gloas.DataColumnSidecar]]
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR doesn't seem to treat gloas.DataColumnSidecar at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to manage this in a follow up pr, to keep gloas changes atomic

signature = shortLog(signedBlock.signature),
msg = r.error()
return err(VerifierError.Invalid)
elif consensusFork in ConsensusFork.Phase0 .. ConsensusFork.Capella:
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this and replacing it with

  when sidecarsOpt is NoSidecars:
    static: doAssert consensusFork in ConsensusFork.Phase0 .. ConsensusFork.Capella

means that if one tries to call verifySidecars(ConsensusFork.Phase0 through Capella, but not NoSidecars, it will now fall into the Unknown consensus fork` error message case, a bit misleadingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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


proc broadcastDataColumnSidecar*(
node: Eth2Node, subnet_id: uint64, data_column: fulu.DataColumnSidecar):
node: Eth2Node, subnet_id: uint64,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why split this line? it's 76 characters total

Copy link
Contributor Author

Choose a reason for hiding this comment

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


proc broadcastDataColumnSidecar*(
node: Eth2Node, subnet_id: uint64,
data_column: gloas.DataColumnSidecar):
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the fulu one, sort of, regarding splitting across two lines -- it's be 77 characters as a single line, which is fine.

Copy link
Member

Choose a reason for hiding this comment

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

nph ftw ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, why does nph do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return RestApiResponse.jsonError(Http400, InvalidBlockObjectError)

when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
when consensusFork == ConsensusFork.Gloas:
Copy link
Contributor

Choose a reason for hiding this comment

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

In H fork, which we'll start development on sometime in the next few months, this will silently resolve to the pre-Deneb case, which is incorrect. Hopefully other compiletime checks pick it up, but regardless this isn't correct. We have at leasttwo basic approaches to this:

  1. Use when consensusFork >= ConsensusFork.Gloas: when we're pretty sure that H fork has a good chance of still using Gloas datacolumns. It slightly a bet, so it does depend; or
  2. If we want to express no view on the likely future of Gloas datacolumns, directly becore when consensusFork == ConsensusFork.Gloas: insert a static: doAssert high(ConsensusFork) == ConsensusFork.Gloas to signal to whoever does this that they have to specifically verify that the code is updated for H fork correctly.

But this has the failure mode of potentially silently breaking in H fork.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.none(seq[BlobSidecar]),
Opt.none(seq[fulu.DataColumnSidecar]), checkValidator = true)
when consensusFork >= ConsensusFork.Bellatrix:
Copy link
Contributor

Choose a reason for hiding this comment

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

How can consensusFork >= ConsensusFork.Bellatrix possibly be true here? it's the else clause directly after

      elif consensusFork >= ConsensusFork.Bellatrix:
        return RestApiResponse.jsonError(
          Http400, $consensusFork & " builder API unsupported")
      else:
        # ... this code is here ...

Copy link
Contributor

Choose a reason for hiding this comment

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

They're on separate objects (currentfork vs withBlck) but in that case the question is why they'd be inconsistent.

forkyBlck, Opt.none(seq[gloas.DataColumnSidecar]),
checkValidator = true)
elif consensusFork >= ConsensusFork.Fulu:
elif consensusFork >= ConsensusFork.Fulu and
Copy link
Contributor

Choose a reason for hiding this comment

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

This is exactly one hardfork, Fulu

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tersec tersec enabled auto-merge (squash) January 22, 2026 12:00
@tersec tersec merged commit 2025a6d into unstable Jan 22, 2026
11 checks passed
@tersec tersec deleted the mro branch January 22, 2026 13:21
agnxsh added a commit that referenced this pull request Jan 24, 2026
* modularise message routing for sidecars

* remove unused proc

* some reviews applied

* address some of the reviews

* some more changes, caller functions

* reviews
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.

4 participants