Skip to content

chore: Fix for e2e gossip network test#12954

Merged
Maddiaa0 merged 1 commit intomasterfrom
palla/fix-gossip-test
Mar 24, 2025
Merged

chore: Fix for e2e gossip network test#12954
Maddiaa0 merged 1 commit intomasterfrom
palla/fix-gossip-test

Conversation

@spalladino
Copy link
Contributor

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).

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
const [block] = await dataStore.getBlocks(blockNumber, blockNumber);
const payload = ConsensusPayload.fromBlock(block.block);
const attestations = block.signatures.map(sig => new BlockAttestation(payload, sig));
const attestations = block.signatures.filter(s => !s.isEmpty).map(sig => new BlockAttestation(payload, sig));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the fix for the issue

@Maddiaa0 Maddiaa0 merged commit 5a256c8 into master Mar 24, 2025
7 checks passed
@Maddiaa0 Maddiaa0 deleted the palla/fix-gossip-test branch March 24, 2025 11:46
PhilWindle pushed a commit that referenced this pull request Mar 24, 2025
🤖 I have created a new Aztec Packages release
---


##
[0.82.2](v0.82.1...v0.82.2)
(2025-03-24)


### Features

* optimize unconstrained `embedded_curve_add`
(noir-lang/noir#7751)
([1e796e2](1e796e2))
* translator zk relation adjustments testing
([#12718](#12718))
([33e528f](33e528f))


### Bug Fixes

* increased poseidon gates
([#12973](#12973))
([49d6bfa](49d6bfa))


### Miscellaneous

* bump bb to 0.82.0 (noir-lang/noir#7777)
([1e796e2](1e796e2))
* Fix for e2e gossip network test
([#12954](#12954))
([5a256c8](5a256c8))
* get logs from init containers
([#12974](#12974))
([28d1f3e](28d1f3e))
* remove duplication on library list files
(noir-lang/noir#7774)
([1e796e2](1e796e2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
DanielKotov pushed a commit that referenced this pull request Mar 27, 2025
🤖 I have created a new Aztec Packages release
---


##
[0.82.2](v0.82.1...v0.82.2)
(2025-03-24)


### Features

* optimize unconstrained `embedded_curve_add`
(noir-lang/noir#7751)
([1e796e2](1e796e2))
* translator zk relation adjustments testing
([#12718](#12718))
([33e528f](33e528f))


### Bug Fixes

* increased poseidon gates
([#12973](#12973))
([49d6bfa](49d6bfa))


### Miscellaneous

* bump bb to 0.82.0 (noir-lang/noir#7777)
([1e796e2](1e796e2))
* Fix for e2e gossip network test
([#12954](#12954))
([5a256c8](5a256c8))
* get logs from init containers
([#12974](#12974))
([28d1f3e](28d1f3e))
* remove duplication on library list files
(noir-lang/noir#7774)
([1e796e2](1e796e2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
DanielKotov pushed a commit that referenced this pull request Mar 27, 2025
🤖 I have created a new Aztec Packages release
---


##
[0.82.2](v0.82.1...v0.82.2)
(2025-03-24)


### Features

* optimize unconstrained `embedded_curve_add`
(noir-lang/noir#7751)
([1e796e2](1e796e2))
* translator zk relation adjustments testing
([#12718](#12718))
([33e528f](33e528f))


### Bug Fixes

* increased poseidon gates
([#12973](#12973))
([49d6bfa](49d6bfa))


### Miscellaneous

* bump bb to 0.82.0 (noir-lang/noir#7777)
([1e796e2](1e796e2))
* Fix for e2e gossip network test
([#12954](#12954))
([5a256c8](5a256c8))
* get logs from init containers
([#12974](#12974))
([28d1f3e](28d1f3e))
* remove duplication on library list files
(noir-lang/noir#7774)
([1e796e2](1e796e2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants