Skip to content

Testing: add unit tests for T3N bridge authorization gate and decision engine #9

Description

@David-patrick-chuks-02

Summary

This repo currently has no test files and no test framework (package.json has no vitest/jest/playwright, no *.test.*/*.spec.* files).

The two most critical, security-adjacent pieces of logic are completely unverified:

  1. T3N bridge authorization (src/lib/t3n/authCore.tscheckBridgeAuthorization) — verifies an operator-signed authorization before autonomous fund movement. Wrong logic here could authorize blocked bridges (expired, over max amount, wrong source/destination chain, bad signature).
  2. Decision engine (src/lib/agent.tsYieldAgent.analyze() + src/lib/yields.tsfindBestYield()) — decides whether/when to move real money, including policy handling (blocked chains, allowed destinations, max route cost, min net gain).

Suggested scope

  • Add vitest (or similar).
  • Unit tests for findBestYield(): edge cases (no data, missing current chain, exactly at threshold).
  • Unit tests for checkBridgeAuthorization(): expired auth, amount over max, chain outside allowlist, invalid signature, valid happy path.
  • Unit tests for parseExecutionIntent() / resolveChainAlias() (covers Bug: "base sepolia" resolves to Base mainnet in chain alias parsing #5).

Files

  • src/lib/t3n/authCore.ts
  • src/lib/t3n/authorization.ts
  • src/lib/agent.ts
  • src/lib/yields.ts
  • src/lib/execution.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions