Skip to content

fix: filter for empty attestations when pulling from block#12740

Merged
Maddiaa0 merged 6 commits intomasterfrom
md/palla/store-attestations-in-archiver
Mar 14, 2025
Merged

fix: filter for empty attestations when pulling from block#12740
Maddiaa0 merged 6 commits intomasterfrom
md/palla/store-attestations-in-archiver

Conversation

@Maddiaa0
Copy link
Member

Overview

Attestations can be empty if not received, filter them before pulling from block

Copy link
Member Author

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

spalladino and others added 5 commits March 14, 2025 11:58
Downloads attestor signatures from L1 and stores them along with blocks.
These are pushed into the attestation pool when new blocks are seen, to
guarantee that all attestations are visible in the pool (in case some
were missed via p2p).

Introduces a new `PublishedL2Block` type (that replaces the
`L1Published` wrapper type), and adds a `getPublishedBlocks` method to
both archiver and node. Eventually we could merge this method with
`getBlocks`, but I did not want to change every single client of
`getBlocks` at this stage.
@Maddiaa0 Maddiaa0 force-pushed the md/palla/store-attestations-in-archiver branch from 5c20d49 to 4faf2ab Compare March 14, 2025 11:59
@Maddiaa0 Maddiaa0 enabled auto-merge (squash) March 14, 2025 11:59
Copy link
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.

Thanks for catching this. Curious: when is a signature empty? Shouldn't it be rejected by the Rollup contract? Or is it temporary?

@Maddiaa0
Copy link
Member Author

Maddiaa0 commented Mar 14, 2025

Thanks for catching this. Curious: when is a signature empty? Shouldn't it be rejected by the Rollup contract? Or is it temporary?

The signatures of the committee are checked in order, and if we do not have a signature, we check for empty. This is rather than looking up the committee for their addresses one by one. Its more gas efficient to do at the expense of calldata, like alot of things, this is up for change / fix come the gas reaper.

    bytes32 digest = _digest.toEthSignedMessageHash();
    for (uint256 i = 0; i < _signatures.length; i++) {
      // To avoid stack too deep errors
      Signature memory signature = _signatures[i];
      if (signature.isEmpty) {
        continue;
      }

      // The verification will throw if invalid
      signature.verify(committee[i], digest);  /////////////// rather than have a reverse lookup of address to committee index
      validAttestations++;
    }

@Maddiaa0 Maddiaa0 merged commit 27fc6f7 into master Mar 14, 2025
7 checks passed
@Maddiaa0 Maddiaa0 deleted the md/palla/store-attestations-in-archiver branch March 14, 2025 12:51
TomAFrench added a commit that referenced this pull request Mar 14, 2025
* master:
  fix: filter for empty attestations when pulling from block (#12740)
  feat: one-way noir sync (#12592)
  feat(avm): Address derivation gadget (#12721)
  chore(ci): add workflow dispatch to masternet (#12739)
  feat: add default accounts (#12734)
  feat: gas reports and snapshots (#12724)
  fix(avm): fix vm1 fake proof size (#12733)
  feat(bb): extend_edges optimization for zero values past end_index (#12703)
  fix: remove hard coding of constructor for account manager (#12678)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  fix: verify_honk_proof inputs generation in bootstrap (#12457)
  fix: Patches to cycle_group and cycle_group fuzzer (#12385)
spalladino added a commit that referenced this pull request Mar 21, 2025
This test was failing with an invalid signature:

```
18:06:18   ● e2e_p2p_network › should rollup txs from all peers
18:06:18
18:06:18     r must be 0 < r < CURVE.n
18:06:18
18:06:18       79 |     const { r, s, v } = signature;
18:06:18       80 |     const recoveryBit = toRecoveryBit(v);
18:06:18     > 81 |     const sig = new secp256k1.Signature(r.toBigInt(), s.toBigInt()).addRecoveryBit(recoveryBit);
18:06:18          |                 ^
18:06:18       82 |     const publicKey = sig.recoverPublicKey(hash.buffer).toHex(false);
18:06:18       83 |     return Buffer.from(publicKey, 'hex');
18:06:18       84 | }
18:06:18
18:06:18       at Signature.assertValidity (../../node_modules/@noble/curves/src/abstract/weierstrass.ts:801:46)
18:06:18       at new Signature (../../node_modules/@noble/curves/src/abstract/weierstrass.ts:782:12)
18:06:18       at recoverPublicKey (../../foundation/dest/crypto/secp256k1-signer/utils.js:81:17)
18:06:18       at recoverAddress (../../foundation/dest/crypto/secp256k1-signer/utils.js:44:23)
18:06:18       at BlockAttestation.getSender (../../stdlib/dest/p2p/block_attestation.js:55:27)
18:06:18           at async Promise.all (index 0)
18:06:18       at Object.<anonymous> (e2e_p2p/gossip_network.test.ts:128:21)
18:06:18
```

The cause was that we were trying to recover the signer from an empty
signature (all zeroes). This is not typically an issue since the p2p
client filters them out (see #12740), but in this test we were reaching
directly to the archiver to retrieve them.

This PR filters out empty signatures before recovering signers for them.

It also includes some extra logging and a test for the validation
service (because why not).

Sample error: http://ci.aztec-labs.com/80ef02336cf535f1
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.

3 participants