Skip to content

fix: drop usage of include and indexof on types that support equals#23595

Merged
nventuro merged 2 commits into
merge-train/fairiesfrom
nico/f-679-fix-arrayincludes-bug-class-on-value-type-arrays-extend
May 28, 2026
Merged

fix: drop usage of include and indexof on types that support equals#23595
nventuro merged 2 commits into
merge-train/fairiesfrom
nico/f-679-fix-arrayincludes-bug-class-on-value-type-arrays-extend

Conversation

@nventuro

Copy link
Copy Markdown
Contributor

includes and indexOf compare values by reference, they don't do deep equality checks. We had three instances of this, two in pxe (not great, not terrible) and one in the validator client (minor, an error message would contain a misdiagnosis), plus a bunch in mocks and tests.

This introduces an eslint rule that catches this: if we do includes or indexOf on a type that implements the equals function, then that's an error. This PR also fixes some instances that are not actually incorrect as they happen to perform the check on values that were created locally, so the reference check matches the deep equality check, but this is brittle and should not be relied upon.

@nventuro nventuro requested a review from Thunkar May 27, 2026 15:48
@nventuro nventuro enabled auto-merge (squash) May 28, 2026 13:43
@AztecBot

Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/02ec6d16f3103d37�02ec6d16f3103d378;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_cross_chain_messaging/token_bridge_public.test.ts (705s) (code: 0)

@nventuro nventuro merged commit 05ad02c into merge-train/fairies May 28, 2026
14 checks passed
@nventuro nventuro deleted the nico/f-679-fix-arrayincludes-bug-class-on-value-type-arrays-extend branch May 28, 2026 13:45
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jun 4, 2026
BEGIN_COMMIT_OVERRIDE
refactor(aztec-nr): use constructor methods for MessageDelivery variants
(AztecProtocol#23596)
docs: update testing_contracts.md for two-crate aztec new layout
(AztecProtocol#23617)
fix: drop usage of include and indexof on types that support equals
(AztecProtocol#23595)
fix: unused ts expressions in tests (AztecProtocol#23621)
feat(aztec-nr): Get tagging index for constrained delivery  (AztecProtocol#23359)
feat!: demote auth registry to non-protocol contract (AztecProtocol#23106)
feat(aztec-nr)!: embed BoundedVec max length in validation requests
(AztecProtocol#23622)
fix: regenerate standard contract addresses after auth registry demotion
(AztecProtocol#23640)
feat(aztec-nr): encrypt handshake log for indistinguishability (AztecProtocol#23638)
feat!: demote public_checks to non-protocol contract (AztecProtocol#23217)
fix: noir precommit re-staging inside worktrees (AztecProtocol#23628)
END_COMMIT_OVERRIDE
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