fix: filter for empty attestations when pulling from block#12740
Merged
fix: filter for empty attestations when pulling from block#12740
Conversation
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.
5c20d49 to
4faf2ab
Compare
PhilWindle
approved these changes
Mar 14, 2025
spalladino
approved these changes
Mar 14, 2025
Contributor
spalladino
left a comment
There was a problem hiding this comment.
Thanks for catching this. Curious: when is a signature empty? Shouldn't it be rejected by the Rollup contract? Or is it temporary?
Member
Author
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++;
} |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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