Skip to content

CGD-576: Remove unreachable _counter undefined guard in abstract-eth#8504

Draft
pritam-gembali wants to merge 1 commit intomasterfrom
CGD-576-remove-unreachable-counter-guard
Draft

CGD-576: Remove unreachable _counter undefined guard in abstract-eth#8504
pritam-gembali wants to merge 1 commit intomasterfrom
CGD-576-remove-unreachable-counter-guard

Conversation

@pritam-gembali
Copy link
Copy Markdown
Contributor

@pritam-gembali pritam-gembali commented Apr 14, 2026

Summary

Removes a dead code guard in abstract-eth TransactionBuilder that was flagged in the internal security audit. The _counter === undefined check in validateBaseTransactionFields can never be true since _counter is typed as number and always initialized to 0 in the constructor.

Jira: WP-8439
Linear: CGD-576

Changes

  • Remove unreachable if (this._counter === undefined) guard from validateBaseTransactionFields in modules/abstract-eth/src/lib/transactionBuilder.ts

Test Plan

  • Existing unit tests for abstract-eth cover transaction validation — no behavior change expected.

CLOSES TICKET: CGD-576

@linear
Copy link
Copy Markdown

linear bot commented Apr 14, 2026

_counter is typed as `number` and initialized to 0 in the constructor,
making the `_counter === undefined` check in validateBaseTransactionFields
permanently unreachable dead code. Remove it and the associated test
assertions that relied on the dead guard.

Ticket: CGD-576
@pritam-gembali pritam-gembali force-pushed the CGD-576-remove-unreachable-counter-guard branch from b314202 to 5a09eb2 Compare April 14, 2026 18:12
@pritam-gembali pritam-gembali marked this pull request as ready for review April 14, 2026 18:32
@pritam-gembali pritam-gembali requested a review from a team as a code owner April 14, 2026 18:32
@pritam-gembali pritam-gembali marked this pull request as draft April 14, 2026 18:32
@pritam-gembali
Copy link
Copy Markdown
Contributor Author

The guard if (this._counter === undefined) is dead code — _counter is typed as number and initialized to 0 in the constructor, so the check can never fire.

That said, since this changes no runtime behavior and TypeScript already prevents undefined from being passed, this PR may not need to land. Raised on CGD-576 to confirm whether this needs to be merged or can be closed as 'accepted / no fix needed'.

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.

1 participant