Skip to content

fix: explicitly handle initial block case for getBlockHashMembershipWitness#21836

Merged
mverzilli merged 4 commits into
merge-train/fairiesfrom
martin/node-cover-block-zero
Mar 23, 2026
Merged

fix: explicitly handle initial block case for getBlockHashMembershipWitness#21836
mverzilli merged 4 commits into
merge-train/fairiesfrom
martin/node-cover-block-zero

Conversation

@mverzilli

@mverzilli mverzilli commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Just a minor nit, but I noticed getBlockHashMembershipWitness was not handling the initial block case explicitly and it made me nervous.

@spalladino please let me know if it's ok to backport this too

Closes F-473

@mverzilli mverzilli requested review from nchamo and spalladino March 20, 2026 10:48

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great improvement 👏

Comment thread yarn-project/aztec-node/src/aztec-node/server.ts
Comment thread yarn-project/aztec-node/src/aztec-node/server.ts Outdated
Comment thread yarn-project/aztec-node/src/aztec-node/server.test.ts Outdated
mverzilli and others added 3 commits March 20, 2026 12:19
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
@spalladino

Copy link
Copy Markdown
Contributor

Let's backport to v4-next, no more changes to v4 unless critical

@mverzilli

mverzilli commented Mar 20, 2026 via email

Copy link
Copy Markdown
Contributor Author

@mverzilli mverzilli merged commit b0f1b85 into merge-train/fairies Mar 23, 2026
23 checks passed
@mverzilli mverzilli deleted the martin/node-cover-block-zero branch March 23, 2026 11:21
@AztecBot

Copy link
Copy Markdown
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

AztecBot pushed a commit that referenced this pull request Mar 23, 2026
…shMembershipWitness (#21836)

Cherry-pick of f8b6239 with conflicts.
mverzilli added a commit that referenced this pull request Mar 23, 2026
…for getBlockHashMembershipWitness) to v4-next (#21891)

## Summary
Backport of #21836
to v4-next.

Cherry-pick of f8b6239 onto `backport-to-v4-next-staging` with
conflict resolution.

**Conflict:** `server.ts` had a conflict because v4-next doesn't have
the `resolveBlockNumber` method or the `N-1` world state lookup refactor
from `next`. Adapted the fix to check for block 0 using both
`BlockNumber.ZERO` and initial block hash comparison, keeping the
v4-next `getWorldState(referenceBlock)` pattern.

**Original PR description:** Explicitly handles the initial block (block
0) case in `getBlockHashMembershipWitness`. Block 0 has an empty
archive, so no membership witness can exist.

## Changes
- `yarn-project/aztec-node/src/aztec-node/server.ts`: Early return
`undefined` when reference block is block 0 (by number or hash)
- `yarn-project/aztec-node/src/aztec-node/server.test.ts`: Added test
for the initial block case

## Commits (3-commit backport structure)
1. Cherry-pick with conflict markers
2. Conflict resolution (adapted for v4-next)
3. Test comment adaptation

---------

Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
AztecBot added a commit that referenced this pull request Mar 24, 2026
…for getBlockHashMembershipWitness) to v4-next (#21891)

Backport of #21836
to v4-next.

Cherry-pick of f8b6239 onto `backport-to-v4-next-staging` with
conflict resolution.

**Conflict:** `server.ts` had a conflict because v4-next doesn't have
the `resolveBlockNumber` method or the `N-1` world state lookup refactor
from `next`. Adapted the fix to check for block 0 using both
`BlockNumber.ZERO` and initial block hash comparison, keeping the
v4-next `getWorldState(referenceBlock)` pattern.

**Original PR description:** Explicitly handles the initial block (block
0) case in `getBlockHashMembershipWitness`. Block 0 has an empty
archive, so no membership witness can exist.

- `yarn-project/aztec-node/src/aztec-node/server.ts`: Early return
`undefined` when reference block is block 0 (by number or hash)
- `yarn-project/aztec-node/src/aztec-node/server.test.ts`: Added test
for the initial block case

1. Cherry-pick with conflict markers
2. Conflict resolution (adapted for v4-next)
3. Test comment adaptation

---------

Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
Thunkar pushed a commit that referenced this pull request Mar 24, 2026
## Summary

Merges `v4-next` into `backport-to-v4-next-staging` to bring the staging
branch up to date. The staging branch was 6 commits behind v4-next (3
previous accumulated backport merges, 2 v4 merge commits, 1 version
bump) because it was never rebased after PR #21819 was merged.

This caused PR
#21899 to show a
massive 2932-file / 770K-addition diff and become unmergeable.

After merging this PR into staging, close PR #21899 — its diff against
v4-next will be clean.

## Conflict Resolution (server.ts)

In `getBlockHashMembershipWitness`, both sides modified the same
function:
- **Staging** (from #21836): Added block-0 / initial-block-hash early
return guard
- **v4-next** (from #21819): Added N-1 block number adjustment for
archive membership proof

Resolution: Both changes coexist — block-0 guard runs first, then the
N-1 adjustment applies.

BEGIN_COMMIT_OVERRIDE
chore: sync backport staging with v4-next HEAD
END_COMMIT_OVERRIDE

---------

Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Phil Windle <philip.windle@gmail.com>
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Co-authored-by: spypsy <spypsy@users.noreply.github.com>
Co-authored-by: Amin Sammara <84764772+aminsammara@users.noreply.github.com>
github-merge-queue Bot pushed a commit that referenced this pull request Mar 24, 2026
BEGIN_COMMIT_OVERRIDE
fix: explicitly handle initial block case for
getBlockHashMembershipWitness (#21836)
fix(aztec-up): narrow PATH cleanup regex to avoid removing user PATH
entries (#21828)
fix: use anchor block on getL1ToL2MsgWitness (#21872)
fix: make sure queries are not made ahead of the anchor block (#21874)
fix(aztec-up): strip leading `v` prefix from version strings (#21813)
END_COMMIT_OVERRIDE
Thunkar pushed a commit that referenced this pull request Mar 24, 2026
…for getBlockHashMembershipWitness) to v4-next (#21891)

Backport of #21836
to v4-next.

Cherry-pick of f8b6239 onto `backport-to-v4-next-staging` with
conflict resolution.

**Conflict:** `server.ts` had a conflict because v4-next doesn't have
the `resolveBlockNumber` method or the `N-1` world state lookup refactor
from `next`. Adapted the fix to check for block 0 using both
`BlockNumber.ZERO` and initial block hash comparison, keeping the
v4-next `getWorldState(referenceBlock)` pattern.

**Original PR description:** Explicitly handles the initial block (block
0) case in `getBlockHashMembershipWitness`. Block 0 has an empty
archive, so no membership witness can exist.

- `yarn-project/aztec-node/src/aztec-node/server.ts`: Early return
`undefined` when reference block is block 0 (by number or hash)
- `yarn-project/aztec-node/src/aztec-node/server.test.ts`: Added test
for the initial block case

1. Cherry-pick with conflict markers
2. Conflict resolution (adapted for v4-next)
3. Test comment adaptation

---------

Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
AztecBot added a commit that referenced this pull request Mar 25, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-up): narrow PATH cleanup regex to avoid removing user PATH
entries (#21828)
fix: consolidate blob source test into single summary log with supernode
detection (#21719)
fix: use anchor block on getL1ToL2MsgWitness (#21872)
fix: make sure queries are not made ahead of the anchor block (#21874)
chore(docs): backport docs infrastructure changes to v4 (#21437)
chore: backport PR #21836 (fix: explicitly handle initial block case for
getBlockHashMembershipWitness) to v4-next (#21891)
chore: backport PR #21813 (fix(aztec-up): strip leading v prefix from
version strings) to v4-next (#21912)
docs: document defi-wonderland immutable macro (#21764)
fix: pin typescript and harden lockfile check in docs examples CI (v4
backport) (#21914)
docs: expand circuit profiling guide and document kernel gate cost
overhead (#21770)
feat: cli-wallet (#21757)
chore: sync backport staging with v4-next HEAD (#21931)
fix: bot gas estimations (backport #21945) (#21947)
refactor(aztec-nr): use logging wrappers in
compute_note_hash_and_nullifier (#21897)
fix: backport v4 next staging (#21934)
fix: make PXE#getSyncedBlockHeader a concurrency=1 job to prevent IDB tx
liveness issues (#21944)
feat: add error page mapping for incompatible oracles (#21943)
fix(aztec-up): validate semver in uninstall to prevent path traversal
(#21892)
chore: merge v4-next into backport staging (fix ancestry) (#21954)
fix(aztec-up): add truncation protection to install scripts (#21896)
fix: noir format in compute_note_hash_and_nullifier.nr (#21956)
fix(stdlib): decode `EthAddress`, `FunctionSelector` and wrapped field
structs in `AbiDecoder` (#21926)
chore: update noir to nightly-2026-02-12-patch.1 (#21960)
fix: ensure empty docs examples does not populate yarn lock backport
(#21963)
fix: docs examples does not build on simple bootstrap backport (#21964)
fix: add rc/testnet version detection to API reference pages (#21966)
docs: document EmbeddedWallet automatic gas estimation and private
authwits (#21790)
fix(pxe): robust error handling in message processing (backport #21093)
(#21981)
chore: manually recreate backport (#21969)
chore: (A-779) load all accounts before calling
LogService.#getSecretsForSenders (#21923)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants