Skip to content

[BUG] - envelopeChecks ignoring header's protocol major version? #2127

Description

@KtorZ

Internal/External: External

Summary
The consensus layer is responsible for validating block headers (at least, some elements of it). This happens through the envelopeChecks:

envelopeChecks cfg lv hdr = do
unless (m <= maxpv) $ throwError (ObsoleteNode m maxpv)
unless (bhviewHSize bhv <= fromIntegral @Word16 @Int maxHeaderSize) $
throwError $
HeaderSizeTooLarge (bhviewHSize bhv) maxHeaderSize
unless (bhviewBSize bhv <= maxBodySize) $
throwError $
BlockSizeTooLarge (bhviewBSize bhv) maxBodySize
where
pp = praosParams cfg
(MaxMajorProtVer maxpv) = praosMaxMajorPV pp
(ProtVer m _) = lvProtocolVersion lv
maxHeaderSize = lvMaxHeaderSize lv
maxBodySize = lvMaxBodySize lv
bhv = mkHeaderView hdr

One of the check refers to the protocol major version:

    unless (m <= maxpv) $ throwError (ObsoleteNode m maxpv)

However:

  • maxpv is a configuration parameter provided at runtime
  • m comes from the ledger view and reflects the current protocol version major

Notice that the protocol version from the header is totally ignored.

Steps to reproduce

See this block on Preview which declares a protocol major version 12 when the network just transitioned into 11.

Expected behavior

I am unclear whether this is desired or a genuine oversight? It seems to me that this check only ensures that the consensus and ledger libraries agree on what is the maximum protocol version; but then, why perform this check on every header?

If this is the intended behavior, then so be it. If not, let me know 😶

System info (please complete the following information):

  • OS Name: irrelevant
  • OS Version: irrelevant
  • Consensus version: ==3.0.1.0

Screenshots and attachments

Image

Additional context
Add any other context about the problem here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions