Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added support for legacy pre EIP 155 transactions with no chainID (chainId=0x0) #2228

Merged
merged 4 commits into from
Mar 22, 2024

Conversation

quiet-node
Copy link
Member

@quiet-node quiet-node commented Mar 21, 2024

Description:
This PR introduces a check method, isLegacyUnprotectedEtx(), within the precheck class and utilized it in precheck.chainId(), allows for compatibility with pre EIP 155 transactions (chainId=0x0, default v = {27, 28}). Additionally, the PR added new UT coverage for the update and resolves any related UT issues.

Related issue(s):

Fixes #2201

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@quiet-node quiet-node added enhancement New feature or request P1 labels Mar 21, 2024
@quiet-node quiet-node self-assigned this Mar 21, 2024
@quiet-node quiet-node linked an issue Mar 21, 2024 that may be closed by this pull request
@quiet-node quiet-node marked this pull request as draft March 21, 2024 16:23
Copy link

github-actions bot commented Mar 21, 2024

Tests

    1 files    35 suites   3s ⏱️
194 tests 193 ✔️ 1 💤 0
197 runs  196 ✔️ 1 💤 0

Results for commit c589e4b.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Mar 21, 2024

Acceptance Tests

  12 files  148 suites   15m 11s ⏱️
393 tests 389 ✔️ 4 💤 0
414 runs  410 ✔️ 4 💤 0

Results for commit c589e4b.

♻️ This comment has been updated with latest results.

@quiet-node quiet-node marked this pull request as ready for review March 21, 2024 16:58
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG
Additional check on chain id 1

packages/relay/src/lib/precheck.ts Outdated Show resolved Hide resolved
AlfredoG87
AlfredoG87 previously approved these changes Mar 21, 2024
Copy link
Collaborator

@AlfredoG87 AlfredoG87 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -100,7 +100,7 @@ export class Precheck {
chainId(tx: Transaction, requestId?: string) {
const requestIdPrefix = formatRequestIdMessage(requestId);
const txChainId = prepend0x(Number(tx.chainId).toString(16));
const passes = txChainId === this.chain;
const passes = txChainId === '0x0' || txChainId === this.chain;
Copy link
Member

Choose a reason for hiding this comment

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

should we tighten this up a bit by checking to see if the v value is 27 or 28 (for legacy transactions) when the chain_id is zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this makes sense! Just pushed in an update for it

@quiet-node quiet-node force-pushed the 2201-support-eip-155-default-v branch from 776c312 to c589e4b Compare March 22, 2024 14:30
Copy link

sonarcloud bot commented Mar 22, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
18.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Member

@lukelee-sl lukelee-sl left a comment

Choose a reason for hiding this comment

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

LGTM

@quiet-node quiet-node merged commit 512a8f6 into main Mar 22, 2024
27 of 29 checks passed
@quiet-node quiet-node deleted the 2201-support-eip-155-default-v branch March 22, 2024 15:57
AlfredoG87 pushed a commit that referenced this pull request Mar 22, 2024
…D (chainId=0x0) (#2228)

* feat: added support for legacy unprotected ETX pre EIP-155 (chainID=0x0)

Signed-off-by: Logan Nguyen <[email protected]>

* test: added new UT for precheck.chainId() with a case that has chainID=0x0

Signed-off-by: Logan Nguyen <[email protected]>

* test: fixed UT to allow support for pre EIP155 txs

Signed-off-by: Logan Nguyen <[email protected]>

* feat: added isLegacyUnprotectedEtx() method

Signed-off-by: Logan Nguyen <[email protected]>

---------

Signed-off-by: Logan Nguyen <[email protected]>
AlfredoG87 added a commit that referenced this pull request Mar 22, 2024
#2240)

fix: added support for legacy pre EIP 155 transactions with no chainID (chainId=0x0) (#2228)

* feat: added support for legacy unprotected ETX pre EIP-155 (chainID=0x0)



* test: added new UT for precheck.chainId() with a case that has chainID=0x0



* test: fixed UT to allow support for pre EIP155 txs



* feat: added isLegacyUnprotectedEtx() method



---------

Signed-off-by: Logan Nguyen <[email protected]>
Co-authored-by: Logan Nguyen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support EIP 155 default v
4 participants