Lattice is unaudited, pre-1.0 software. It re-implements and adapts established contracts (OpenZeppelin, Solady, Uniswap V2, Yearn V3) into the EIP-2535 Diamond facet pattern, but it has not received an independent security audit. Do not deploy it to mainnet with funds at risk without your own review. Review evidence lists what has been checked so far.
Lattice is pre-1.0. Only the latest tagged release is supported: fixes land on
the development branch (dev) and ship in the next release. Older 0.x releases
receive no backports. See
Versioning and compatibility for what
a minor or patch release may change.
| Path | Status |
|---|---|
src/**, except src/examples/** |
In scope |
script/base/** (recipe deploy scripts and their one-transaction init rule) |
In scope |
script/deploy/**, script/lib/** (release and factory deployment) |
Reports welcome; in scope once a canonical release deployment exists |
src/examples/**, test/**, the testnet demos and their scripts |
Reports welcome; not production code |
lib/** (submodules) |
Report to the upstream project; tell us if Lattice is affected |
Vendored and ported code is listed in lib/VENDORED.md. A
bug inherited from an upstream source is still worth reporting here, since the
Lattice copy may not receive the upstream fix.
Please do not open public issues, pull requests, or discussions for security vulnerabilities.
Report privately through GitHub's private vulnerability reporting: Security → Report a vulnerability on https://github.com/dadadave80/lattice. This opens an advisory visible only to the maintainer.
If private reporting is unavailable, contact the maintainer (daveproxy80.eth) to arrange a disclosure channel before posting any details publicly.
A useful report names the affected module, the commit or release tag, and a reproduction, ideally a failing Foundry test.
As a solo-maintained project, responses are best-effort. The targets are:
- Acknowledgement within 7 days of the report.
- Initial assessment (accepted, needs more information, or declined) within 14 days.
- Fix on
devas soon as practical, in the next release.
Please allow reasonable time for a fix before public disclosure (90 days is a good default). Reporters who follow coordinated disclosure will be credited unless they prefer to remain anonymous.
Lattice has no bug bounty and offers no payment for reports.
A vulnerability in a tagged release is published as a GitHub Security Advisory once a fixed release is out. The fix is also listed in the changelog, which says when a fresh deployment is required. Bugs found and fixed before they reach a release are handled as ordinary issues.
Lattice holds no funds and has not adopted the
SEAL Whitehat Safe Harbor agreement.
The SafeHarborAdopter facet lets a
diamond adopt it, but each adopting deployment publishes and maintains its own
agreement. The facet covers only the on-chain half: creating and registering an
agreement (createAndAdopt) or registering a pre-deployed one
(adoptSafeHarbor). SEAL's
adoption procedure
ends with three steps. The adopting protocol does the first two off-chain;
the facet makes the third:
- Publish an Agreement Fact Page with every detail of the adoption, maintained off-chain for anyone to view.
- Add the agreement's Exhibit D (User Adoption Procedures), adapted, to the terms of service.
- Make the registry call from the decision-making authority. That call is
the legally binding step. The diamond makes it through the facet and is
recorded as the adopter, so the call must come from the protocol's
governance: grant
SAFE_HARBOR_ADMIN_ROLEonly to it (for example its Governor-controlledTimelockController), never to an operator key, and keepDEFAULT_ADMIN_ROLE, which administers that role, with the same authority. The agreement's owner (theownerargument ofcreateAndAdopt, or the owner of a pre-deployed agreement passed toadoptSafeHarbor) must be that same authority too: after adoption the owner alone can change the agreement's chains, accounts, asset-recovery addresses and bounty terms.
The facet's NatSpec lists the same steps. Check SEAL's repository for changes before adopting.
These are the P0 and P1 contract bugs from the 2026-09 hardening pass
(#213), all present in
released versions. Lower-priority fixes are tracked in #213 and will be listed
in the 0.5.0 changelog. Deployed diamonds keep the vulnerable facets until they
cut in the 0.5.0 ones. Each item names the regression tests that replay the
original attack against the fixed code; run one with
forge test --mt <test name>. The linked issue has the full reproduction.
-
AccessManager / AccessManaged, v0.1.0 to v0.4.0: fail-open. Do not use these releases to gate anything.
AccessManager.executeset a persistent "consuming" flag on the managed target, andrestrictedChecklet every caller through while it was set. Migrating a target withexecute(target, setAuthority(x))left the flag set for good, and a restricted function that called out could be re-entered by anyone during anexecute(#215, fixed in #267). Reproduce withtest_MigrationViaExecuteDoesNotLeaveTargetOpenandtest_PublicRoleExecuteCalleeCannotReenterAdminFunctioninAccessManagedTest.- The manager did not enforce a target's admin delay on
setTargetFunctionRoleorsetTargetClosed, nor a role admin's execution delay ongrantRole/revokeRole(#219, fixed in #280). Reproduce with thetest_AdminDelay_*andtest_RoleAdminDelay_*tests inAccessManagerTest.
The fixes follow OpenZeppelin v5 semantics and change the ERC-165 interface IDs:
IAccessManagergoes from0x8fc52f86to0x03fde054andIAccessManagedfrom0xe5b444fdto0x4a531f33. -
ERC-4626 vaults with strategies, v0.1.0 to v0.4.0: shares priced on idle assets.
ERC4626Libpriced every conversion, preview and mutator on the vault's own asset balance, not VaultCore's full NAV. Once a StrategyManager allocated funds, redeemers received only the idle share of their value and depositors minted cheap shares at holders' expense;rebalance()is permissionless, so anyone could move the price around their own deposit (#214, fixed in #269). Reproduce withtest_ConvertersPriceOnFullNavandtest_DepositWhileAllocated_DoesNotDiluteinVaultFullNavPricingTest. The fix changes share pricing and capsmaxWithdraw/maxRedeemat idle assets.- Strategy recalls, v0.1.0 to v0.4.0:
rebalance()could lock up.StrategyManager.rebalance()reverted when an over-target strategy returned even 1 wei less than requested, and every adapter could under-deliver, so the strategy could be neither recalled nor removed (#221, fixed in #281). Reproduce withtest_Rebalance_HonestPartialRecall_CompletesinStrategyManagerTestand thetest_PoC_*tests inStrategyLiquidityTest. The second half of #221 is not fixed:CurveStableSwapAdaptervalues its LP at spotget_virtual_price(), which read-only reentrancy can skew. It is unsupported in 0.5.0; do not register it with a vault's StrategyManager. - Strategy adapter liquidity, v0.1.0 to v0.4.0. Two follow-ups to #221
(#271):
- Aave V3 and Compound V3 recalls asked for the whole remainder, so when
borrowers had taken the market's cash,
rebalance()reverted. A recall is now capped at the cash the market can pay: the aToken's underlying balance (and, on Aave v3.1+, the reserve's virtual balance), or the Comet's base balance. The rest is an honest partial recall. Reproduce withtest_Recall_UtilisationSpike_IsPartial_ThenCompletesin the Aave and Compound suites ofStrategyLiquidityTest. - The swap-free UniswapV3 adapter counted token1 in its NAV at the TWAP,
although the vault can only ever receive token0, so the last redeemers
bore the token1 value when the admin's
emergencyWithdrawmoved it out. NAV is now token0 only (idle token0 plus the position's token0 leg), and a recall pays idle token0 without unwinding the position. Reproduce withtest_TargetZero_ExitViaAdminEmergencyWithdraw_ConservesNavin the same file. The pool prices a deploy at spot while NAV counts the new token0 leg at the TWAP, so a deploy steps NAV by aboutdeployed × (√(P_spot / P_twap) − 1), anddeployruns inside the permissionlessrebalance(). It now refuses any step beyondslippageBpsof the token0 it consumes; within that bound an attacker who moves spot can still choose the step. Reproduce with thetest_Deploy_*Twap*tests in the same file.
- Aave V3 and Compound V3 recalls asked for the whole remainder, so when
borrowers had taken the market's cash,
- Strategy recalls, v0.1.0 to v0.4.0:
-
CCTP hooks, v0.2.0 to v0.4.0: hook skipped on plain relay. The permissionless
CCTPBridgeAdapter.relayMessagerelayed a message carrying a Lattice hook envelope without running the hook. The USDC was minted and the CCTP nonce consumed, so a receiver that books credit in its hook (such as theCCTPHookVaultexample) stranded the funds (#216, fixed in #268). Reproduce withtest_RelayMessageRefusesHookedMessageFromThirdPartyinCCTPBridgeAdapterTest. -
ERC-7786 OpenBridge, v0.1.0 to v0.4.0: executes at threshold 0. The init leaves the attestation threshold at 0, and
receiveMessageexecuted once the gateway count reached it, so fromregisterRemoteBridgeuntil the firstsetThresholdanyone, gateway or not, could deliver a forged message to the recipient. Only a freshly configured bridge is exposed, since the threshold cannot return to 0 (#217, fixed in #266). Reproduce withtest_ThresholdZeroNonGatewayDeliveryDoesNotExecuteinERC7786OpenBridgeTest. The fix makesregisterRemoteBridgerevert while the threshold is 0. -
Governed diamond cuts, v0.1.0 to v0.4.0: delay bypass and guardian brick. Both need a privileged role.
GovernedSafeDiamondCut.setMinDelaytook effect at once, so the Safe could set the delay to 0, then schedule and execute any cut in one transaction. Reproduce withtest_SetMinDelayZero_CannotScheduleAndExecuteInOneBlockinGovernedSafeDiamondCutTest.- With nothing frozen, which is the default,
emergencyRemoveCutlet an emergency guardian removediamondCutitself, permanently ending upgrades. Reproduce withtest_EmergencyRemove_RefusesDiamondCutinGovernedDiamondCutTestandSafeDiamondCutTest.
Both are #218, fixed in #279. A lowered delay now applies only after the old delay has passed, and
MinDelayChangedis replaced byMinDelayChangeScheduled. -
SessionKey, v0.1.0 to v0.4.0: spend caps bypassed through approvals. A cap counted only transfers and balance drops inside one batch, so a key allowed to call
approveon a capped token could approve an address it controls and pull the balance later, outside the account. Revoking a key also left its grants in place for a re-registered key (#220, fixed in #277). Reproduce withtest_SessionKey_ApproveThenLaterPull_Blockedandtest_SessionKey_RevokeClearsGrantsinSessionKeyApprovalTest. Approvals of a capped token are now reset after each batch, and anANY_TARGETgrant no longer matches the account itself. -
ERC20Votes, v0.1.0 to v0.4.0: stray storage write. The ERC20Votes, GovernedVault and GovernedVaultENS inits wrote
1to the un-namespaced slotkeccak256(bytes32(0)). Lattice keeps no state there, so the write matters only to a facet that uses slot-0 storage. The live Sepolia M2 vault has the write, where it is harmless (#222, fixed in #278). The guard is thekeccak256(0)check inRecipeGuards, run bytest_Upgradeable_ERC20VotesinRecipeUpgradeabilityTokensTest. -
Vault deposits after a strategy force-removal (unreleased). A force-removed strategy's funds leave the vault's NAV, so if they later returned, depositors who entered at the lower NAV shared in them at the expense of the existing holders (#270). Reproduce with
test_ForceRemoval_DonationSandwich_DepositsLatchedinVaultFullNavPricingTest. A force removal now latches deposits closed until the manager admin callsclearDepositLatch(); exits stay open. -
Vault deposits after a strategy-manager replacement (unreleased). The deposit latch lived in the strategy manager, so
setStrategyManagerdropped it: a fresh manager started unlatched, deposits reopened at the lower NAV, and depositors who entered then shared in any funds the old manager's strategies returned later. This applied both to the last-resort recovery from an overflowing strategy and to a swap made while the old manager was latched (#305). Reproduce withtest_DepositLatch_ManagerSwapCarriesLatchandtest_OverflowingStrategy_RecoveredBySetStrategyManagerinVaultFullNavPricingTest. A swap now latches deposits on the vault itself (IVaultCoreRecovery) unless the old manager reports both no latch and nothing allocated; a read that fails counts as stranding funds and never blocks the swap. Deposits stay closed on the new manager until the vault admin callsclearManagerSwapLatch(); exits stay open.
- HSSAdapter
scheduleSelfCalljobId strand. A self-call schedule that is deleted, expires unfired, or cannot be paid for at fire time holds itsjobIduntil a diamond cut (#226). - UniswapV3 adapter exit (accepted).
rebalance()can allocate into the swap-free position but never recall from it, so capital allocated there reaches redeemers only after the admin'semergencyWithdraw, the only exit; size the target with that in mind. The exit has no slippage floor and the pool pays it at spot, so NAV steps by aboutleg0 × (√(P_twap / P_spot) − 1): run it while spot sits near the TWAP. It sends the token1 leg and any idle token1 to the vault, outside NAV, and VaultCore has no sweep for a non-asset token, so that token1 stays in the vault unless its admin cuts a sweep in (#271). - Conflicting module inits. A second EIP-712 or AccessControl init in the same diamond silently overwrites the domain or adds an admin (#205).
- ERC-165 claims without a routed function. The GovernedSafeDiamondCut
recipe reports
IDiamondCutbut routes nodiamondCut, and several recipes reportIEIP712without routingeip712Domain(); a call that trusts the claim reverts (#206).
No external audit has been performed. The evidence below is internal review and automated checking; it is not a substitute for an audit.
- Hardening pass (2026-09). A full-repository review filed its findings as #213 and its child issues, including the fixed items under Known issues.
- Static analysis. Slither runs in CI and fails on any untriaged High
result (#282). The
configuration is
slither.config.json; each triaged result inslither.db.jsoncarries a reason, checked byscript/slither-db.py. Run it withmake slither. - Differential tests. Ported math (every
mulDivcopy, the ERC-4626 converters and previews, Governor counting, Checkpoints, constant-product quotes, ECDSA) is fuzzed against independent references intest/fuzz/(#283). - Invariant and fuzz suites.
test/invariant/andtest/fuzz/; invariant runs fail on revert. Seetest/README.mdfor the testing approach. - Storage layout. Every ERC-7201 namespace in
src/is checked against a committed baseline bycheck-storage-layout.sh(make storage-check), and the module slot constants are re-derived and checked for collisions inStorageSlotVerificationTest.STORAGE_REGISTRY.mdlists the namespaces and ERC-165 interface IDs. - CI gates.
test.ymlruns formatting, licence notices, EIP-170 sizes, the via-IR build, the storage guard, the test suite, the gas snapshots insnapshots/and Slither, all required through oneCI OKcheck ondevandmain.scheduled.ymlruns the fork suites and coverage weekly. - Provenance.
lib/VENDORED.mdlists vendored, ported and adapted code with its upstream source and licence.
An audit is recorded by adding its report under audits/, named
<YYYY-MM-DD>-<auditor>.pdf, and a row here giving the auditor, the audited
commit SHA, the scope (the files or modules covered), and the commits that fix
each finding. Code changed after the audited commit is not covered by it.