[BUG]: EVM settlement does not validate an overridden chain_id against the configured CAIP-2 network

Open
#91 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

@AyushSrivastava1818 is already working on this.

Since Nov 14, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, typescript

Research direction

The payload names no files, so start from the chain registry lookup and the place where the chain_id workflow input overrides it before the EVM driver is constructed. Find the driver verification path that checks the configured CAIP-2 network, then add a check that rejects a registered network paired with a conflicting chain ID before signing. Done when a mismatch is rejected, matching and unregistered-network configurations still pass, and regression tests cover all three cases.

Written by the indexing model from the issue text.

Description

bug
Bug Description

GitPay derives the expected EVM chain ID from the chain registry but allows the chain_id workflow input to override that value without validating it against the configured CAIP-2 network.

The driver verification path validates the configured network identifier, but does not establish that the overridden numeric chain ID represents the same network.

This allows an inconsistent configuration to proceed into transaction preparation and signing.

Steps to Reproduce

Configure a real settlement with:

  • network: eip155:11155111
  • chain_id: 1
  • rpc_url: A valid Sepolia RPC endpoint.
  • Other required inputs: Valid Sepolia settlement configuration.

The configured network and numeric chain ID now refer to different chains.

Expected Behaviour

For networks present in the chain registry, an explicitly supplied chain_id should be validated against the registry's expected chain ID.

A mismatch should be rejected before transaction signing or ledger recording.

Actual Behaviour

The supplied chain ID is accepted and used when constructing the EVM driver.

The transaction can consequently be signed for a different chain than the configured network.

The RPC endpoint may reject the transaction during broadcast. Since GitPay records the broadcasting receipt before broadcasting, this can leave the payout in an unconfirmed state requiring manual intervention.

Suggested Fix
  1. Resolve the expected chain ID from the chain registry.
  2. If the network is registered and an explicit chain_id is supplied, reject any mismatch.
  3. Preserve custom chain ID configuration for unregistered networks where explicitly supported.
  4. Verify the RPC endpoint's reported chain ID before signing.
  5. Add regression tests covering matching IDs, mismatched IDs and unregistered networks.
Testing

Add tests proving that a registered network cannot be paired with a conflicting chain ID, and that valid custom-network configurations remain supported.

Dominant language
TypeScript
Stars
5
Forks
4
Avg merge
2d 12h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/GitPay

All issues in StabilityNexus/GitPay

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.