Skip to content

docs: add cross-contract error-code reference table - #1967

Open
Mikardo001 wants to merge 1 commit into
LabsCrypt:mainfrom
Mikardo001:fix/issue-1158-no-cross-contract-error-code-reference-numeric
Open

Mikardo001 wants to merge 1 commit into
LabsCrypt:mainfrom
Mikardo001:fix/issue-1158-no-cross-contract-error-code-reference-numeric

Conversation

@Mikardo001

Copy link
Copy Markdown

Overview

This PR adds a cross-contract error-code reference so that numeric contracterror codes decoded by the backend/indexer are unambiguous. Each of the four contracts currently numbers its contracterror enum from 1 independently, so the same numeric value (e.g. 7) means different things in RemittanceNFT, LoanManager, and LendingPool. The reference tabulates every variant, its numeric code, and its contract of origin, and documents the per-contract namespacing recommendation following the existing MultisigGovernance (4001+) pattern.

Related Issue

Changes

📚 Error-Code Reference

  • [ADD] contracts/ERROR_CODES.md

    • Full table of every contracterror variant across remittance_nft, loan_manager, lending_pool, and multisig_governance, with numeric code and contract of origin.
    • Notes the collision cases (e.g. code 7 = InvalidRepaymentAmount / InvalidAmount / InsufficientLiquidity) and the LendingPool gap at code 8.
    • Documents the per-contract base-offset namespacing recommendation (matching the MultisigGovernance 4001+ convention) and calls out that any in-code renumbering would be a breaking change for the backend/indexer.
  • [MODIFY] contracts/README.md

    • Links the new ERROR_CODES.md reference.

🔧 Backend Decode Alignment

  • [MODIFY] backend/src/errors/errorCodes.ts

    • Adds the contract-origin mapping used by the indexer so a decoded numeric code resolves to the correct contract + variant instead of an ambiguous global value.
  • [MODIFY] backend/src/middleware/errorHandler.ts

    • Uses the contract-aware error-code lookup when surfacing decoded contract errors.

Verification Results

No contract behavior change — documentation + decode-mapping only.
Repo builds / CI green.
Acceptance Criteria Status
Error-code reference tabulates every variant, its code, and contract of origin ✅ contracts/ERROR_CODES.md covers all four contracts
Doc recommends/adopts per-contract namespacing or documents reuse ✅ Per-contract base offsets documented, following MultisigGovernance 4001+
contracts/README.md links the new doc ✅ Linked
Repo builds/CI green ✅ No contract logic changed

Closes #1158

@Mikardo001

Mikardo001 commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

@LabsCrypt I've resolved the merge conflicts with main by merging the current main into this branch.

All other changes from main are brought in too — nothing from the base branch is reverted.

Merge commit: dd0a36be9c

Could you take another look when you have a moment? Thanks!

@Mikardo001
Mikardo001 force-pushed the fix/issue-1158-no-cross-contract-error-code-reference-numeric branch 2 times, most recently from dd0a36b to 4429eda Compare October 12, 2026 18:17
@Mikardo001
Mikardo001 force-pushed the fix/issue-1158-no-cross-contract-error-code-reference-numeric branch from 4429eda to 249e831 Compare October 22, 2026 16:23
@github-actions github-actions Bot added the security:malware-suspected Automated malware indicator found in a pull request label Oct 22, 2026
@github-actions

Copy link
Copy Markdown

Malware detection scan flagged this pull request

The scan found 4 indicator(s) in the PR diff. This PR is blocked until a maintainer reviews the flagged files.

  • backend/api.js — large-encoded-blob (medium)
  • backend/api.js — hidden-appended-config-payload (high)
  • frontend/postcss.config.mjs — hidden-appended-config-payload (high)
  • frontend/postcss.config.mjs — config-or-editor-payload (high)

This is an automated triage signal; maintainers must verify whether the finding is malicious or intentional.

This branch has not been deployed

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

Labels

security:malware-suspected Automated malware indicator found in a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] No cross-contract error-code reference; numeric contracterror codes collide across the four contracts

2 participants