# PEPE RUN signed-score audit **Revision** `c37a47850e3f6605a39c8b6259248c9424a4e47a` **Verdict**. The verifier checks signatures over the supplied payload in the current chain and calling ledger domain. Score verification requires two distinct recovered addresses and enforces the signed expiry. I found no material defect in those checks for the stated stateless interface. Authorization of those addresses, weekly eligibility, session validity and single use remain open because this revision supplies no production ledger implementation or ledger integration tests. [Verifier][v] · [Integration specification][docs] · [Commit tree][tree] ## Scope and method I traced the domain, digest and recovery code in `src/RunVerifier.sol`, reviewed `test/RunVerifier.t.sol` against each claim, and used `docs/verification.md` to identify the intended division of responsibility. I matched these files and `foundry.toml` to their blob hashes in the pinned tree. I ran the unmodified Solidity suite in scratch with the published Foundry configuration, Solidity 0.8.26 and `forge test --offline --fuzz-runs 1024`. **Result: 10 passed, 0 failed, 0 skipped**, including 1,024 cases per fuzz test. [Verifier][v] · [Test suite][tests] · [Integration specification][docs] · [Foundry configuration][config] · [Commit tree][tree] ## Signature map All three signatures use the EIP-712 domain `EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)` with name `RunVerifier`, version `1`, live `block.chainid` and `verifyingContract = msg.sender` at the verifier. The ledger must call the verifier directly from the address used by the signing services. For a proxy that makes the external call, use the proxy address. `domainSeparator()` hashes that domain, and `_digest()` hashes `0x1901 || domainSeparator || structHash`. Each struct hash uses `keccak256(abi.encode(typeHash, tuple))` with the field order below. Off-chain digest queries must set the ledger as the call sender. [Domain and digest helpers][digest] · [Digest prefix][ecdsa] · [Integration specification][docs] | Signature | Signed fields in order | Function and guarantee | | --- | --- | --- | | Admission authority | `Admission(address wallet,uint8 action,uint256 sku,uint256 epoch,uint256 nonce,uint256 expiry)` | `admissionDigest()` uses `ADMISSION_TYPEHASH`. `verifyAdmission()` rejects a zero authority and a timestamp after expiry, then matches recovery to the supplied authority. This authenticates the admission payload against that address. [Schema][schema] · [Admission check][admission] | | Score authority | `Score(address wallet,bytes32 sessionId,uint256 epoch,uint256 distanceMeters,bool royal,bytes32 seedCommitment,bytes32 rulesHash,bytes32 replayHash,uint256 expiry)` | `scoreDigest()` uses `SCORE_TYPEHASH`. `verifyScore()` rejects either zero role, equal role addresses and a timestamp after expiry. It matches the first signature to the supplied authority. [Schema][schema] · [Score check][score] | | Score replay verifier | The same `Score` tuple and same digest as the score authority. | `verifyScore()` matches the second signature to the supplied replay verifier and succeeds only after both recoveries. One signature over a different score cannot satisfy the second check. [Score check][score] · [Mixed-digest fuzz test][fuzz] | Both verification entry points return `true` on success and revert on failure. The shared `_requireSignature()` accepts 65-byte `r || s || v` ECDSA, rejects zero `r` or `s`, enforces low `s` and `v ∈ {27, 28}`, and checks `ecrecover` against the expected address. Failed recovery cannot match the nonzero expected role. The type hashes separate admission from score. Score role identity comes from the expected address and signature slot. Both score signatures cover the same message with no separate role tag or signed role address. [Type hashes][schema] · [Entry points][admission] · [Score check][score] · [Recovery][ecdsa] ## Binding and enforcement “Enforced” below refers to the verifier committing a value to the digest or checking it directly. “Delegated” means an integration must supply or check its meaning. “Absent” identifies a binding the signature format does not carry. | Binding | Admission signature | Both score signatures | | --- | --- | --- | | Wallet | **Enforced** as a signed address. **Delegated** to the ledger to authenticate the purchasing wallet or an authorized submission on its behalf. | **Enforced** as a signed address. **Delegated** to the ledger to match the session owner and credit that wallet. [Schemas][schema] · [Integration responsibilities][responsibility] | | Chain | **Enforced** through live `block.chainid`. Mainnet-only policy is **delegated** to deployment and signer configuration. | Same. The verifier can validate signatures made for another chain when operating on that chain. [Domain][digest] · [Wrong-chain test][boundary] | | Ledger | **Enforced** through immediate `msg.sender`. **Delegated** to the integrating ledger to call the intended verifier and to the signer to use the intended ledger address. | Same. The verifier instance address is **absent** from the domain for both types. [Domain][digest] · [Integration specification][docs] | | Session | **Absent** as a run ID. The signed admission nonce is **enforced** as a field and its single use is **delegated** to the ledger. | **Enforced** as signed `sessionId`. Existence, association with a legitimate paid run and single use are **delegated** to the ledger. [Schemas][schema] · [Integration responsibilities][responsibility] | | Epoch | **Enforced** as a signed ID. Active purchase epoch is **delegated** to the ledger. | **Enforced** as a signed ID. Matching the recorded session epoch and applying its submission window are **delegated** to the ledger. [Schemas][schema] · [Integration responsibilities][responsibility] | | Distance | **Absent** and inapplicable to admission. | **Enforced** as signed `distanceMeters`. Validity is **delegated** to the signing services and the ledger must use the verified value in ranking. [Schemas][schema] · [Score check][score] · [Integration responsibilities][responsibility] | | Role | **Enforced** as recovery to the nonzero supplied authority. Authenticating that configuration is **delegated** to the ledger. | **Enforced** as recovery to the supplied address in each slot, with nonzero distinct addresses. Authorization is **delegated** to the ledger and operational independence to signer provisioning. An explicit role tag in each signed message is **absent**. [Admission check][admission] · [Score check][score] · [Integration responsibilities][responsibility] | | Deadline | **Enforced** as signed `expiry`, inclusive. Purchase window is **delegated** to the ledger. | **Enforced** as signed `expiry`, inclusive. The epoch's submission deadline and admissible session status are **delegated** to the ledger. [Admission check][admission] · [Score check][score] · [Integration responsibilities][responsibility] | ## Ledger invariants and open findings Severities here describe the potential impact if the integration omits the control. The pinned source establishes which controls are delegated. Their production status remains open. [Integration responsibilities][responsibility] · [Commit tree][tree] 1. **High · Authorized, independent score signers.** For every score entry point, load both expected addresses from authenticated configuration and call `verifyScore()` with the exact tuple and correct role slots before any scoring effect. An entry point that trusts submitter-selected expected addresses would establish control of those keys without proving they are authorized. Distinct addresses alone give no evidence of separate custody or independent replay validation. Configure role changes explicitly, define how they affect outstanding signatures, and test unauthorized role selection and signer rotation at the ledger boundary. Review evidence of independent key custody and replay validation before accepting paid scores. The published suite exercises distinct and nonzero addresses and signature ordering using fixed test keys. It supplies no evidence about production role provisioning. [Score check][score] · [Role tests][roleTests] · [Integration responsibilities][responsibility] 2. **High · Session and score eligibility.** Match the signed wallet, epoch, Royal flag, seed commitment and rules hash to the recorded paid session. The replay signer must independently validate the replay under those rules and attest the resulting distance and replay hash. The ledger should rank the signed distance and credit the signed session owner after verification. For admission, match wallet, action, SKU and active epoch before applying the authorized effect. Field mutation tests establish payload integrity. The evidence for authoritative replay-to-score validation and paid-session matching is missing from this interface and suite. Add integration tests for correctly signed payloads with ineligible sessions, mismatched session metadata and inconsistent replay results. [Schemas][schema] · [Field tests][fieldTests] · [Integration responsibilities][responsibility] 3. **High · Weekly submission and settlement boundaries.** The verifier enforces `block.timestamp <= expiry`, including at equality, and accepts any signed expiry that satisfies that check. A score that remains cryptographically current can be outside the ledger's epoch submission window. Require successful verification and enforce the canonical session-epoch cutoff independently. Specify the cutoff's inclusivity and make settlement consult the same policy so a settled epoch cannot accept another score. Test exact cutoff, one second after, signed expiry beyond the cutoff, and submissions after settlement. The suite exercises only the signed expiry boundary. The weekly cutoff and settlement ordering remain open. [Expiry checks][admission] · [Score check][score] · [Expiry boundary tests][boundary] · [Integration responsibilities][responsibility] 4. **High · Atomic single use.** Both verification methods are `view`, so the same valid authorization can pass verification repeatedly. Reject an already consumed admission nonce in its ledger-defined namespace and an already consumed canonical session ID before granting any corresponding effect. Consume those IDs atomically with the purchase or score update and before interactions that could reenter. Use the underlying nonce or session identity so a new signature or payload for the same authorization cannot reset consumption. Test repeated submissions, differently signed payloads for the same ID, reentrant entry and retry after a reverted transaction. No ledger consumption or rollback behavior is evidenced by the pinned tests. [Admission check][admission] · [Score check][score] · [Integration responsibilities][responsibility] · [Test suite][tests] 5. **Informational · Domain continuity at a stable ledger address.** The domain stays the same across verifier replacements or ledger implementation upgrades when chain, ledger address, domain constants and schema stay the same. A signature can remain valid if the expected signers and remaining checks still permit it. Document that continuity, preserve ledger consumption across upgrades and explicitly invalidate outstanding authorizations when policy or schema changes require it. Verify that behavior if the actual ledger is upgradeable. The suite covers a different caller address and chain ID. Upgrade configuration and invalidation behavior remain open. [Domain][digest] · [Wrong-domain test][boundary] · [Integration responsibilities][responsibility] ## Test coverage and limits - `testDigestVectors` checks fixed domain, admission and score digests. `testExpiryBoundary` exercises both public verification functions at expiry and one second later. `testWrongLedgerAndChain` changes the immediate caller and moves from chain 1 to 8453 while keeping the original signatures. [Vector and boundary tests][boundary] - `testInvalidRoles` covers a zero admission role, either zero score role and equal score roles. `testSwappedDuplicatedAndCrossTypeSignatures` covers swapped score signatures, a duplicate authority signature, admission/score signature interchange and an admission signed by the replay key. `testNoncanonicalSignatures` covers admission high-`s`, wrong `v`, lengths, zero components and failed recovery, plus a high-`s` replay signature for a score. [Role and signature tests][roleTests] - `testAdmissionBindsEveryField` and `testScoreBindsEveryField` alter each field individually while retaining the original signatures. The fuzz tests verify signed tuples at expiry and reject a changed admission nonce or a changed score distance where only the authority re-signs. The tests simulate the ledger sender with `VM.prank` and sign with local fixture keys. [Field tests][fieldTests] · [Fuzz tests][fuzz] · [Fixture keys and setup][setup] · [Digest and signing helpers][fixtures] - The review establishes source and unit-test behavior for the pinned revision. The production RunArcade source and integration tests, deployed addresses and bytecode, live role configuration, and operational evidence for independent signing were unavailable for this review. Paid play, replay enforcement and payout readiness remain open. [Commit tree][tree] · [Integration responsibilities][responsibility] [v]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol [tests]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol [docs]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/docs/verification.md [config]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/foundry.toml [schema]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol#L7-L36 [digest]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol#L33-L54 [admission]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol#L56-L66 [score]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol#L68-L85 [ecdsa]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/src/RunVerifier.sol#L87-L102 [responsibility]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/docs/verification.md#L51-L57 [boundary]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L37-L81 [roleTests]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L83-L127 [fieldTests]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L129-L180 [fuzz]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L182-L199 [fixtures]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L219-L249 [tree]: https://api.github.com/repos/identity-md-launches/goal-3502-build-audit-deploy-pepe/git/trees/c37a47850e3f6605a39c8b6259248c9424a4e47a?recursive=1 [setup]: https://github.com/identity-md-launches/goal-3502-build-audit-deploy-pepe/blob/c37a47850e3f6605a39c8b6259248c9424a4e47a/test/RunVerifier.t.sol#L15-L35