Skip to content

feat: add CodeTreeRoot to BlockHeader - #4129

Open
PhilippGackstatter wants to merge 4 commits into
pgackst-code-patch-integrationfrom
pgackst-code-tree-root-block-header
Open

PhilippGackstatter wants to merge 4 commits into
pgackst-code-patch-integrationfrom
pgackst-code-tree-root-block-header

Conversation

@PhilippGackstatter

Copy link
Copy Markdown
Contributor

Changes

Adds the root of the CodeTree to BlockHeader and loads it into transaction kernel memory, as the next step of the code tree stack. Later PRs verify code witnesses against this root. MockChain now owns a CodeTree with a non-empty genesis tree, so that the witness verification and patch construction PRs can test present roots before blocks update the tree.

  • CodeTreeRoot newtype, used by CodeTree, PartialCodeTree and BlockHeader. One of the original motivations for WordWrapper was so we could have each field in BlockHeader properly typed, and so CodeTreeRoot made sense over Word.
  • BlockHeader commits to the code tree root, placed after the nullifier root. The sub commitment preimage gets a zero padding word, so that it stays a multiple of the hasher rate and the kernel can absorb it with full permutations.
  • The prologue stores the root in the block data section of kernel memory.
  • ProposedBlock copies the code tree root of the previous header, because blocks do not register code yet.
  • The protobuf BlockHeader message gets the new field.
  • MockChain registers the procedures that other code can reference at genesis: exec_kernel_proc (the only external node from the tx kernel) and the exported procedures of the core, protocol and standards libraries. Internal procedures are not registered, because no external node can reference them.

@PhilippGackstatter
PhilippGackstatter marked this pull request as ready for review October 28, 2026 16:38

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.

1 participant