Skip to main contentA-REX Foundation

सिस्टम डिज़ाइन · AREX-TEST

Testing

Use Node.js 20 or 22 LTS with npm; the committed package lock.json is the source of truth for dependency versions. Newer Node majors may print Hardhat support warnings.

दस्तावेज़ आईडी
AREX-TEST
संस्करण
2.0
तिथि
2026-09-21
स्रोत
docs/TESTING.md
केवल अंग्रेज़ी में उपलब्ध
यह पृष्ठ अंग्रेज़ी में है। श्वेतपत्र के अध्याय, आरेख और प्लेटफ़ॉर्म पृष्ठ अनूदित हैं; सहायता लेख कंसोल की सहायता की भाषाओं का पालन करते हैं। नॉर्मेटिव मानक रिपॉज़िटरी में रहता है; उस पाठ के लिए शीघ्र पहुँच का अनुरोध उपयोग करें। सिस्टम डिज़ाइन मार्गदर्शिकाएँ और निर्णय रिकॉर्ड अंग्रेज़ी में रहते हैं।
FieldValue
Document IDAREX-TEST
Version2.0
Date2026-09-21
RelatedAREX-SDD-001 §12 (traceability matrix), AREX-AUD-001 §7 (coverage matrix)

Test layers

LayerLocationCovers
Standard / referencetest/standard/ARexToken.test.jsbatches, lineage, ERC-7943 enforcement, hook pipeline, conformance, upgrade authorization
Standard / hookstest/standard/DomainHooks.test.jsperishability, seasonal, delivery, traceability, sanctions TTL
Standard / extensionstest/standard/Extensions.test.jsprice oracle, carbon wrapper, parametric insurance
Documentation / guidetest/standard/ImplementationGuide.test.jsevery code block of the Implementation Guide and the example hooks in contracts/examples/, executed in order
Standard / invariantstest/standard/Invariants.test.jsseeded random operation sequences; supply conservation, terminal status, canTransfer ⇔ outcome, lock
Standard / securitytest/standard/OpContext.test.jsoperation context does not leak into calls made from ERC-1155 acceptance callbacks (see docs/SECURITY-NOTE-op-context.md)
Deploymenttest/standard/DeployFullStack.test.jsscripts/deploy-full-standard.js splits roles between ADMIN_ADDRESS and OPS_ADDRESS and the deployer renounces every role
Standard / attestations (Foundry)test/foundry/ARexAttestationsRevoke.t.solAREX-CORE §6 revocation: the issuer and a revoker it delegated revoke; ATTEST_ADMIN_ROLE and strangers cannot (fuzzed); IARexAttest interface id unchanged. Run with forge test
Standard / attestations (Foundry)test/foundry/ARexAttestationsAttest.t.solAREX-CORE §6 re-attestation: another issuer never replaces a record (live, expired or distrusted; fuzzed), a revoked record is never re-attested (its issuer, another issuer, after a delegated revocation), the issuer renews a live or expired record; IARexAttest interface id unchanged. Run with forge test
Standard / delivery (Foundry)test/foundry/DeliveryHookSchedule.t.solDeliveryHook.schedule never underflows after a forced transfer took the balance below the locked units (InsufficientBalance, fuzzed). Run with forge test
Conformanceconformance/ (npm run conformance)implementation-agnostic suite: every MUST and SHOULD of AREX-CORE.md, by clause id, through an adapter; runs on the reference and on third-party implementations, writes conformance/report.json

Commands

Use Node.js 20 or 22 LTS with npm; the committed package-lock.json is the source of truth for dependency versions. Newer Node majors may print Hardhat support warnings.

Determinism rules

  • Tests that advance chain time restore a snapshot in after() so they do not leak into other files (takeSnapshot / restore).
  • No test depends on wall-clock time: CommodityPriceOracle numbers its rounds instead of bucketing block.timestamp, and the seasonal tests set the block time explicitly.
  • The invariant test is seeded (AREX_INVARIANT_SEED); a failure is reproducible with the same seed and step count.

What tests establish

Repeatable evidence of implemented behaviour in the Hardhat environment. They do not establish absence of vulnerabilities, regulatory compliance, correctness of off-chain data, economic safety, production gas viability across chains, or storage compatibility of future upgrades beyond the OpenZeppelin plugin validation.

Before production

  • Third-party audit (package: AUDIT-READINESS.md).
  • Fork tests on every target chain.
  • Worst-case batch gas benchmarks with the production hook set.
  • Upgrade rehearsal against a mainnet fork with the plugin's validateUpgrade.