Skip to content

refactor: typing BlockHeader hash#19899

Merged
AztecBot merged 1 commit intonextfrom
01-23-feat_typing_blockheader_hash
Jan 26, 2026
Merged

refactor: typing BlockHeader hash#19899
AztecBot merged 1 commit intonextfrom
01-23-feat_typing_blockheader_hash

Conversation

@benesjan
Copy link
Copy Markdown
Contributor

@benesjan benesjan commented Jan 23, 2026

When touching Aztec Node endpoints a while ago I had to use there L2BlockHash type in order to be able to accept a generic block arg on the input that could represent either a block number or block hash (when I used Fr for the block hash there were serialization issues as these 2 types were getting mixed up).

But after this I had quite a few ugly conversions in PXE between L2BlockHash and Fr. In this PR I drop some of those conversions.

This results in ugly conversions being in some other places but eventually we should use the type everywhere so this is a step in a good direction.

Admittedly a low-priority issue but such tech debt even a cheap model like Sonnet is able to tackle so no reason to keep it around.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan changed the title feat: typing BlockHeader hash refactor: typing BlockHeader hash Jan 23, 2026
@benesjan benesjan added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure and removed ci-squash-and-merge labels Jan 23, 2026
@benesjan benesjan force-pushed the 01-23-feat_typing_blockheader_hash branch from badf7c0 to a605791 Compare January 26, 2026 06:45
return this.header.hash();
public async hash(): Promise<Fr> {
const blockHash = await this.header.hash();
return blockHash.toField();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would tackle this in a followup PR.

Copy link
Copy Markdown
Contributor

@spalladino spalladino left a comment

Choose a reason for hiding this comment

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

Looks good, but seems like there are a few APIs that still need changing, just by looking at the toField calls.

Also, unrelated to this PR: shouldn't L2BlockHash extend from Fr instead of Buffer32, given it's a field element? And also, we should probably add some branding to the L2BlockHash to avoid mixing it up with vanilla Frs. But neither of this are specific for this PR.

@benesjan
Copy link
Copy Markdown
Contributor Author

Good points. Will adress in a follow-up PR.

@spalladino Thanks for the review!

@AztecBot AztecBot force-pushed the 01-23-feat_typing_blockheader_hash branch from a605791 to 3a18b49 Compare January 26, 2026 12:27
@benesjan benesjan added this pull request to the merge queue Jan 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 26, 2026
@benesjan
Copy link
Copy Markdown
Contributor Author

The full_prover.test.ts that just failed in queue passes locally so I will re-add it to the queue to see if it was just a flake.

@benesjan benesjan added this pull request to the merge queue Jan 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 26, 2026
@spalladino
Copy link
Copy Markdown
Contributor

@benesjan heads up that full-prover runs with REAL_PROOFS enabled only on merge queue

@benesjan benesjan force-pushed the 01-23-feat_typing_blockheader_hash branch from 3a18b49 to 94487e8 Compare January 26, 2026 19:15
When touching Aztec Node endpoints a while ago I had to use there `L2BlockHash` type in order to be able to accept a generic block arg on the input that could represent either a block number or block hash (when I used `Fr` for the block hash there were serialization issues as these 2 types were getting mixed up).

But after this I had quite a few ugly conversions in `PXE` between `L2BlockHash` and `Fr`. In this PR I drop some of those conversions.

This results in ugly conversions being in some other places but eventually we should use the type everywhere so this is a step in a good direction.

Admittedly a low-priority issue but such tech debt even a cheap model like Sonnet is able to tackle so no reason to keep it around.
@AztecBot AztecBot force-pushed the 01-23-feat_typing_blockheader_hash branch from 94487e8 to 7f0c678 Compare January 26, 2026 19:36
@AztecBot AztecBot enabled auto-merge January 26, 2026 19:36
@AztecBot AztecBot added this pull request to the merge queue Jan 26, 2026
Merged via the queue into next with commit 0b5b57e Jan 26, 2026
18 checks passed
@AztecBot AztecBot deleted the 01-23-feat_typing_blockheader_hash branch January 26, 2026 21:16
github-merge-queue Bot pushed a commit that referenced this pull request Jan 27, 2026
We had an `L2BlockHash` defined in `block_hash.ts` and it was returned
from the `hash` function of `BlockHeader`. I didn't like the
inconsistency so I decided to just drop "L2" from the class name.

Yesterday I merged a
[PR](#19899) that
touched a lot of this so this might be quite a convenient time to do
this (conflicts-wise).

I just globally replaced the "L2BlockHash" string with "BlockHash" so
checking this in-depth is not really needed.
AztecBot pushed a commit that referenced this pull request Jan 29, 2026
As Santiago proposed [here](#19899 (review)) makes sense to have `BlockHash` extend from `Fr` instead from `Buffer32` because the hash is the output of Poseidon2 hash and hence natively a field.

Also introduced branding to avoid collisions with `Fr` and cleaned up the type from unused functions.
AztecBot pushed a commit that referenced this pull request Jan 29, 2026
As Santiago proposed [here](#19899 (review)) makes sense to have `BlockHash` extend from `Fr` instead from `Buffer32` because the hash is the output of Poseidon2 hash and hence natively a field.

Also introduced branding to avoid collisions with `Fr` and cleaned up the type from unused functions.
github-merge-queue Bot pushed a commit that referenced this pull request Jan 29, 2026
As Santiago proposed
[here](#19899 (review))
makes sense to have `BlockHash` extend from `Fr` instead from `Buffer32`
because the hash is the output of Poseidon2 hash and hence natively a
field.

Also introduced branding to avoid collisions with `Fr` and cleaned up
the type from unused functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants