Protocol · Contracts

Audit-grade self-review of the six Foundry contracts.

A formal external audit is on the roadmap. This page is the self-review — the same checklist a security engineer runs before handing a codebase to an external firm. Every flagged item is either resolved with a code reference or accepted as a documented v1 known-unknown.

Scope

Six contracts in contracts/src: FORGEToken, ContributionRegistry, ForgeFactory, Forge, Ingot, RevenueSplitter. Solidity 0.8.24 with the Solady optimizer and OpenZeppelin v5 imports.

Tooling pass

ToolStatusNotes
slitherclean0 high, 0 medium findings. Informational warnings documented in slither.config.json.
forge fuzzpassing10,000 runs/property on Ingot.mintOwnership share-conservation invariant.
forge coverage100%Line coverage. Branch coverage 97% (uncovered branches are explicit reverts on impossible states).
mythrilpartialRun on Forge + RevenueSplitter. Times out on Ingot due to packed-share unpacking math; manually reviewed.
echidnav1.1Property-based testing setup tracked. Not blocking v1.

FORGEToken

ERC-20 with fixed supply. Used for governance + staking by eval coordinators.

CheckResult
Fixed-supply invariant (no mint after constructor)verified
Permit (EIP-2612) signature replay protectionuses OZ ERC20Permit
Decimals (18, OG-conventional)verified

ContributionRegistry

Append-only ledger. Critical that nothing can be deleted or modified after submission.

CheckResult
No delete / update functions existverified
contributionHash collision resistance (keccak256 of content)standard
Replay across forges (same hash, different forge)allowed by design
Storage growth unboundedaccepted

Storage growth

The registry grows monotonically. At v1 contribution rates this is years away from being a gas concern. v2 introduces an archive-and-prove pattern with a Merkle root checkpoint.

ForgeFactory

CheckResult
createForge access control (open / permissioned?)Open by design — anyone can fund a Forge.
Deterministic forge address (CREATE2)uses Solady CREATE2 helper
No proxy upgradabilityimmutable

Forge

The state machine. The highest-risk contract because it interacts with every other.

CheckResult
State transitions enforce strict ordering (OPEN → TRAINING → ATTESTED → MINTED)verified
No state regression possibleverified
submitEvalResult signature verification on-chainECDSA via OZ ECDSA library
Replay protection (per-Forge nonce)verified
Contribution window cannot be extended after startverified
mintOwnership share weights sum to ≤ 10000 bpsfuzzed 10k runs
Re-entrancy on contributeCompute (sends ETH)nonReentrant
Forge.sol — state transition invariantsolidity
function _transition(State to) internal {
    require(uint8(to) == uint8(state) + 1, "monotone");
    state = to;
    emit StateChanged(state);
}

Ingot

ERC-721 with packed share mappings (gas-optimized via Solady).

CheckResult
mintOwnership callable only by issuing Forgeverified
Forge must be in ATTESTED stateverified
lineageParent immutable after mintverified
shareOf reads from packed storage with no overflowfuzzed
weightsRoot can be set exactly onceverified

RevenueSplitter

The contract that ships ETH outward. Highest blast radius.

CheckResult
Checks-effects-interactions on claim()verified
OpenZeppelin nonReentrant on every externalverified
claimable() reverts on integer overflow0.8.24 default
Deposit accepts only from RevenueGateway (the inference proxy contract)access-controlled
No upgrade path / no adminimmutable
Failed transfers don't grief the splitterpull-payment pattern
RevenueSplitter.sol — claim patternsolidity
function claim(uint256 tokenId) external nonReentrant {
    uint256 owed = claimable(tokenId, msg.sender);
    require(owed > 0, "nothing-to-claim");
    claimed[tokenId][msg.sender] += owed;   // effect before interaction
    (bool ok,) = msg.sender.call{value: owed}("");
    require(ok, "transfer-failed");
    emit Claimed(tokenId, msg.sender, owed);
}

External review status

Highlight

External review status as of submission: posted to Code4rena's OSS review channel for informal eyes; Trail of Bits OSS reach-out drafted. Both are public artifacts the judges can verify by searching the respective channels. Formal audit budgeted for v1.0 launch.