Skip to main contentA-REX Core

Decision records · ADR-009

ADR-009: Attestations implemented in a companion contract

The reference implements IARexAttest in a separate ARexAttestations contract bound to one token, because embedding it pushed the token over the EIP-170 size limit.

Accepted
Document ID
ADR-009
Date
2026-09-21
FieldValue
IDADR-009
Subject areaDeployment
StatusAccepted
Date2026-09-21
OwnersA-REX Contributors
Related requirementsFR-11, NFR-07 (SDD §3)
Supersedes / superseded by—

Context

Layer 3 of the standard, IARexAttest, is a SHOULD: a token may implement it itself or through a companion. Implementing it inside ARexToken took the token to about 25.5 KB of deployed bytecode, above the 24,576-byte EIP-170 limit that every EVM chain enforces.

Issue

Where should the reference implementation put the attestation registry so that the token remains deployable everywhere?

Assumptions

  • Layer 3 may be implemented by a companion contract (normative text).
  • Hooks and integrators can be told the registry address at deployment.

Constraints

  • Every contract must fit EIP-170 (NFR-07).
  • No delegatecall libraries (they complicate upgrades and audits).

Alternatives considered

AlternativeForAgainstOutcome
External libraries through delegatecallKeeps one addressHarder upgrades and audits; linked-library deploymentRejected
Remove features from the tokenFits in one contractLoses functionality the standard needsRejected
A companion ARexAttestations bound to the tokenSmall, separately auditable, no size pressureTwo addresses to publishAccepted

Decision

ARexAttestations implements IARexAttest for exactly one token, checks that the batch exists on that token, and manages trusted issuers per topic under ATTEST_ADMIN_ROLE. Hooks such as AttestationHook read it directly. The token does not report IARexAttest in supportsInterface.

Argument

Attestations are consulted by hooks and integrators, not by the token's own transfer logic, so separating them costs no functionality and removes the size constraint for good.

Consequences

Positive

  • The token stays at 24,136 bytes.
  • The registry can be audited, and in the future replaced, independently.

Negative

  • Integrators must discover the registry address from deployment metadata, not from the token.

Obligations it creates

  • Deployment manifests publish both addresses (the deployment scripts print them).

Implementation and evidence

WhatWhere
Registrycontracts/reference/core/ARexAttestations.sol
Trust, revocation, expiry, gatingtest/standard/ARexToken.test.js: only trusted issuers can attest; revocation and expiry are honoured, AttestationHook gates transfers on a per-commodity attestation
SizeARexToken 24,136 bytes (SDD §15)
  • ADR-004: One hook interface, flags cached at registration, ordered evaluation
  • ADR-010: Authority comes from roles, never from balances; RETIRED is terminal
  • ADR-014: Carbon as a registry-immobilised wrapper plus attestations; no primary issuance