Skip to content

feat: add Mantle and MantleTestnet to EthereumNetworks enum#31

Open
skydudie wants to merge 3 commits intoTradeTrust:masterfrom
Accredifysg:Add-Mantle-and-MantleTestnet
Open

feat: add Mantle and MantleTestnet to EthereumNetworks enum#31
skydudie wants to merge 3 commits intoTradeTrust:masterfrom
Accredifysg:Add-Mantle-and-MantleTestnet

Conversation

@skydudie
Copy link
Copy Markdown

@skydudie skydudie commented Apr 2, 2026

This pull request adds support for the Mantle mainnet and testnet Ethereum networks throughout the codebase. The changes ensure that Mantle networks (netId 5000 and 5003) are recognized and properly handled in both the core logic and the test suite.

Mantle network support:

  • Added mantle (netId 5000) and mantleTestnet (netId 5003) to the EthereumNetworks enum in dnsTxt.ts, enabling recognition of these networks in the application logic.
  • Updated the EthereumNetworkIdT union type to include Mantle mainnet and testnet, ensuring type safety and validation for these new network IDs.

Testing enhancements:

  • Added unit tests in index.test.ts to verify that Mantle mainnet and testnet records are accepted by parseDocumentStoreResults.
  • Added a new Astron record to the expected results in the getDocumentStoreRecords for Astron test, likely to ensure comprehensive coverage for multiple networks.

Summary by CodeRabbit

  • New Features

    • DNS TXT parsing now accepts any numeric chain/network ID (enabling support for networks like Mantle mainnet/testnet).
  • Tests

    • Added unit tests ensuring network IDs in DNS TXT records are strictly numeric (accepted) and that non-numeric or alphanumeric IDs are rejected.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a92e295f-f868-4ff5-b5a3-5122edb77948

📥 Commits

Reviewing files that changed from the base of the PR and between b76813f and d5032b1.

📒 Files selected for processing (2)
  • src/index.test.ts
  • src/records/dnsTxt.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/index.test.ts
  • src/records/dnsTxt.ts

📝 Walkthrough

Walkthrough

Replaces a fixed-set enum validation for netId in OpenAttestation DNS TXT parsing with a numeric-string constraint and adds unit tests validating that only purely numeric netId values are accepted and non-numeric/alphanumeric values are rejected.

Changes

Cohort / File(s) Summary
DNS TXT type update
src/records/dnsTxt.ts
Replaced EthereumNetworks enum and the union-of-literals EthereumNetworkIdT with a String.withConstraint that accepts only numeric strings (/^\d+$/). Removed unused Union import.
Tests: TXT parsing
src/index.test.ts
Added unit tests for parseDocumentStoreResults ensuring openatts TXT netId is accepted only when purely numeric (returned as string), including previously-unseen numeric values, and rejected (empty array) when non-numeric or alphanumeric.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇🥕 I nibble on nets of numeric gold,
Only digits please—no letters bold.
Tests hop in, ears all alert,
Reject the mix, accept the pure dirt.
A tiny rabbit cheers the change, swift and bold.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to add Mantle to the EthereumNetworks enum, but the actual changes remove the enum entirely and replace it with a numeric string validation pattern. Update the title to accurately reflect the actual changes, such as: 'refactor: replace EthereumNetworks enum with numeric netId validation' or 'feat: broaden Ethereum network validation to accept any numeric netId'
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/records/dnsTxt.ts Outdated
Comment on lines 26 to 54
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For this, we can remove the EthereumNetworks & EthereumNetowrkIdT type check, instead we can change it to numeric string type check.

Copy link
Copy Markdown
Author

@skydudie skydudie Apr 27, 2026

Choose a reason for hiding this comment

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

Replaced the checks with a numeric string type check: d5032b1

@skydudie skydudie requested a review from isaackps April 27, 2026 04:33
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