Ethereum security initiativeDraft proposal. Not submitted.
Demo · real code, illustrated review
A four-layer review, walked through on Aave V4.
The commits and functions below are real, read from Aave V4's public repository. The review drawn over them is an illustration: no researcher was assigned and no finding was filed.
Real codeSolid lines. Read from github.com/aave/aave-v4 by a committed script.
6959e32v0.5.6Earlier reviewed versioncdacec5v0.5.11Final reviewed version176 functions added or changed, 53 removed
348 functions at cdacec5, in 24 files
- Added or changed since 6959e32
- Unchanged, calls or is called by changed code (demo computation)
- Unchanged
T4Function348 functions, one owner each
T3Contract24 contracts, one owner each
T2ConnectionsSpoke, Hub and the calls between them
T1SystemThe protocol as a whole
FIG 1 — One tick per function at cdacec5, grouped by file; a file's width is its function count. Solid marks are read from the repository; dashed boxes are the review an assignment would create.
Both listed in ChainSecurity's Aave V4 report, 23 March 2026, version table (opens in a new tab).
How the code facts were produced
- Repository
- https://github.com/aave/aave-v4
- Command
- node scripts/initiative/extract-aave-inventory.mjs
- SHA-256 of the scanned files
- 5749c9052a92703d433b7657ff90845d5a9b20c230114452c21217e746747fbd
- Scope
- src/spoke/**/*.sol, src/hub/**/*.sol
Aave is named because its code is public and its auditors published the reviewed commits. Aave is not a partner and has not reviewed this demo.
Start at step 1Step 1 of 5
First, the code is split into units a person can own.
A review starts by reading the source and grouping it. Each unit has a clear boundary, so one researcher owns it at each layer and nothing falls between two people.
Aave V4 Spoke and Hub cluster
LiveFile and function counts are real.Unit A: Spoke
| File | Functions | Lines |
|---|---|---|
| AaveOracle.sol | 7 | 55 |
| Spoke.sol | 62 | 736 |
| SpokeConfigurator.sol | 25 | 238 |
| SpokeStorage.sol | 0 | 16 |
| TokenizationSpoke.sol | 43 | 343 |
| TreasurySpoke.sol | 8 | 65 |
| instances/ | 1 | 17 |
| instances/ | 1 | 15 |
| instances/ | 1 | 12 |
| libraries/ | 6 | 106 |
| libraries/ | 11 | 52 |
| libraries/ | 12 | 673 |
| libraries/ | 18 | 183 |
| libraries/ | 10 | 54 |
| libraries/ | 2 | 22 |
| libraries/ | 7 | 112 |
Unit B: Hub
| File | Functions | Lines |
|---|---|---|
| AssetInterestRateStrategy.sol | 8 | 94 |
| Hub.sol | 78 | 718 |
| HubConfigurator.sol | 24 | 268 |
| HubStorage.sol | 0 | 11 |
| instances/ | 1 | 12 |
| libraries/ | 18 | 188 |
| libraries/ | 1 | 12 |
| libraries/ | 4 | 47 |
24 contracts, 348 functions, 4,049 lines of code (counted without blanks and comments)
Counted by the script at commit cdacec5. Dependencies excluded.
Step 2 of 5
Then each layer gets its own question.
Does this one function do what it claims, for every input?
- Example unit
Spoke.withdraw(uint256,uint256,address) · external- What the owner would check
- Inputs at their limits.
- Rounding.
- What happens when the function is called twice in one transaction.
- Checked by
- T3 owner
Do the functions together keep the contract's rules?
- Example unit
- Contract Spoke in src/spoke/Spoke.sol · 62 functions
- What the owner would check
- Which functions change shared state.
- Who is allowed to call each one.
- Whether a sequence of valid calls breaks a rule.
- Checked by
- T2 owner
What happens when this contract talks to another one?
- Example unit
Spoke.supply(uint256,uint256,address) · externalHub.add(uint256,uint256) · external- What the owner would check
- What the Spoke assumes about the Hub's answer.
- What happens when a price feed is stale or a token behaves oddly.
- Checked by
- T1 owner
How could someone with money and patience break the protocol as a whole?
- Example unit
- Contract Spoke in src/spoke/Spoke.sol · 62 functions
- Contract Hub in src/hub/Hub.sol · 78 functions
- Contract AaveOracle in src/spoke/AaveOracle.sol · 7 functions
- What the owner would check
- Whether liquidations still work in a fast-moving market.
- Who can upgrade or pause, and what they could do with that power.
- Checked by
- T0 arbiter for disputes
The same function can appear at several layers. Each layer asks a different question about it.
Step 3 of 5
A finding is checked by the layer above, and disputes go to T0.
- 01Filed by T4 owner
- 02Checked by T3 owner
- 03Disputed
- 04Decided by T0
- 05Locked in the record
- Claim
- A rounding step lets a user withdraw slightly more than they deposited.
- Layer
- T4
- Checked by T3
- Rejected: the rounding favours the protocol.
- Appeal
- The T4 owner shows a sequence of two calls where it does not.
- T0 decision
- Valid. Severity set by T0. Credited to the T4 owner.
- Record
- Locked. Payment follows this record.
The person who filed a finding never decides it. The locked record, not a chat thread, decides who is paid.
Step 4 of 5
When the code changes, only the change goes back through review.
ChainSecurity's version table lists an earlier reviewed commit, 6959e32 (v0.5.6), and the final one, cdacec5 (v0.5.11). Compare the two and you get the scope a follow-up would need.
348 functions in the cluster at cdacec5, all in scope.
- src/hub/AssetInterestRateStrategy.sol8
- src/hub/Hub.sol78
- src/hub/HubConfigurator.sol24
- src/hub/instances/HubInstance.sol1
- src/hub/libraries/AssetLogic.sol18
- src/hub/libraries/Premium.sol1
- src/hub/libraries/SharesMath.sol4
- src/spoke/AaveOracle.sol7
- src/spoke/Spoke.sol62
- src/spoke/SpokeConfigurator.sol25
- src/spoke/TokenizationSpoke.sol43
- src/spoke/TreasurySpoke.sol8
- src/spoke/instances/SpokeInstance.sol1
- src/spoke/instances/TokenizationSpokeInstance.sol1
- src/spoke/instances/TreasurySpokeInstance.sol1
- src/spoke/libraries/EIP712Hash.sol6
- src/spoke/libraries/KeyValueList.sol11
- src/spoke/libraries/LiquidationLogic.sol12
- src/spoke/libraries/PositionStatusMap.sol18
- src/spoke/libraries/ReserveFlagsMap.sol10
- src/spoke/libraries/SpokeUtils.sol2
- src/spoke/libraries/UserPositionUtils.sol7
105 added, 71 changed, 53 removed, plus 102 unchanged functions that call or are called by a changed one.
Changed or added since the earlier reviewed commit (176)
Unchanged, but calls or is called by changed code (102)
Unchanged since the earlier reviewed commit: 70 functions not in scope
A follow-up reviews this change set through the same four layers. The earlier review stays on record for the code that did not change.
Step 5 of 5
A published record is what a wallet can check.
Once a review is released and the deployed code matches the reviewed commit, the Proof of Audits Snap can show it in the MetaMask confirmation for the exact function being called. Today, the public explorer has no released audits, so Aave V4 reads Not verified.
Aave V4 on the public explorer
Source: public explorer, read now.
MetaMask install
All ten protocols
Try it on ten deployed protocols
The function explorer lists every callable function of ten Ethereum mainnet protocols at one pinned block, with the proxy route, the source it can reach and the audit reports that name its files.
What this demo does not show
- A real assignment. No researcher was paid or assigned for this page.
- A real finding. The finding in Step 3 is invented and has no link to Aave's code.
- A security opinion about Aave V4.
- Production coverage rules. The gap-only scope here is computed by the demo.