Don't take our word for it. Run it.
Everything on this page is rendered from the reports in docs/results, written by the runs below. Each claim is a question, its answer, and the evidence, and a claim that fails fails its run. These results were recorded with Fe 26.6.0 on mac_arm64; CI repeats them on Linux.
docker run --rm ghcr.io/femtech-web/dimension # the published image
docker build -t dimension . && docker run --rm dimension # or build it from a cloneAny other target runs the same way, such as docker run --rm ghcr.io/femtech-web/dimension make demo; the fork and live targets use the network, which docker run has by default. On x86-64 every check runs. On arm64, Docker on Apple silicon included, Fe 26.6.0 has no native backend, so those checks are skipped and say so.
- 01InstallFe 26.6.0 downloaded and checksum-verified; forge-std and OpenZeppelin pinned by commit.
$ make toolchain && make reference-deps - 02See both incidentsEach mistake written in Fe, the compiler's verdict, the fix, and the evidence the fork runs saved.
$ make demo - 03Run everything offlineFormatting, unsafe policy, unit tests on both backends, compile-fail cases, probes, the differential test, the search, the EVM contracts with the typed-vs-hand-written pairs, the vault, and a fresh project through the CLI. About two minutes.
$ make ci - 04Against the real chainsThe attacker's own transactions, the deployed pool, and Moonwell's market on Base: public RPCs by default.
$ make replay fidelity moonwell - 05On a public chainThe deployment on Base Sepolia, read back: every receipt, each contract's code against this build, every logged outcome, and the oracle, the declarations and the vault at the latest block.
$ make live - 06Try to break itPlants each bug below in a scratch copy and requires the check meant for it to fail.
$ make mutants
Questions, answered by runs.
Balancer's Solidity against the Fe port make differential
- ✓holdsDoes the Fe port compute exactly what Balancer V2's Solidity computes, reverts included?220,000 vectors over 22 functions: 170,900 identical results, 49,100 identical reverts, 0 mismatches
The Fe port against the deployed pool make fidelity
- ✓holdsDoes the Fe port return exactly what the deployed pool returned, on its state the block before the exploit?669 quotes against Vault.queryBatchSwap at block 23,717,396: 627 identical values, 42 identical reverts, 0 mismatches
The attacker's own transactions, step by step make replay
- ✓holdsDoes the Fe port compute every step of the real exploit exactly as Balancer's Vault did?360 of 360 steps across the three attack transactions (121, 121, 118): every amount equal
- ✓holdsAfter each attack transaction, does the faithful kernel hold exactly what the real pool held?WETH and osETH balances and BPT supply equal after each transaction; value per BPT 1.02735 -> 0.02019 -> 0.000412136 -> 9.19223e-06
- ✓holdsDo the typed and guarded kernels stop the attacker's own sequence?yes: transaction 1 reverts at step 25 with BAL#001; transaction 2 reverts at step 25 with BAL#001; transaction 3 reverts at step 22 with BAL#001. Before that, value per BPT on the typed kernel rose from 1.0273 to 1.1856
- ✓holdsFrom the real dust state, does an attacker who re-plans every swap find a loss on Balancer's arithmetic, and none on Dimension's?on Balancer's arithmetic: -43.9% in 90 swaps. On the typed and guarded kernels, never below where it started; after 90 swaps it ends +13.1%
Native search over the three kernels make explore
- ✓holdsDoes the faithful port lose value per BPT on GIVEN_OUT exits, as Balancer V2 did?57990 losing exits, worst 14.8607%
- ✓holdsDo the types alone remove the losses at Balancer's two _upscale sites?swapGivenOut 48 -> 0; exitGivenOut 57990 -> 8
- ✓holdsAre the operations the types do not change identical with and without them?swapGivenIn, exitGivenIn, joinGivenIn and joinGivenOut counts match between faithful and typed
- ✓holdsWith the runtime guard added, does any operation lose value per BPT or store an invariant its balances do not back?guarded: 0 losses and 0 stored-invariant violations in every operation kind
- ✓holdsDoes the guard reject exactly the operations that would have lost value, and nothing else?exitGivenOut 8, joinGivenIn 9 rejected; each equals the typed losses
- ✓holdsCan a repeated-exit attacker gain against the faithful kernel, and is it always a loss with Dimension?pool 300/300: faithful -0.743 D, typed -95.011 D, guarded -95.011 D; pool 8/8: faithful +1.386 D, typed -2.493 D, guarded -2.493 D; pool 1000/1000: faithful +20.923 D, typed -151.416 D, guarded -151.416 D
The three pool contracts on an EVM make evm
- ✓holdsDeployed on an EVM, does the faithful pool let a repeated-exit attacker take value from LPs?value per BPT -3.38% over 51 exits
- ✓holdsDo the typed and guarded pools keep the value behind each BPT under the same attack?typed +19.51%, guarded +19.51%
- ✓holdsDoes every optimization level compute the same attack, to the wei?the attack's exits and value per BPT on each kernel are identical at -O0, -O1, -O2 and -Os
- ✓holdsBuilt on Dimension itself, does typed code return exactly what the same code written by hand on raw u256 returns, at every optimization level?4,096 calls per level over 8 functions (the four roundings, an ERC-4626 vault's four previews), reverts included: all equal at -O0, -O1, -O2 and -Os
- ✓holdsAbove -O0, is Dimension's typing free, gas for gas, against the same code written by hand?at -O1, -O2 and -Os the roundings compile to identical bytes, and the vault to the same size with identical gas on every call. At -O0, which no one deploys, typed costs rounding +7.8%, vault +15.0% per call
Moonwell's cbETH market on Base forks make moonwell
- ✓holdsDid Moonwell's deployed oracle price cbETH at the bare exchange rate throughout MIP-X43's window?12 blocks from 42,194,663 to 42,538,948: 1.1224 USD to 1.1229 USD
- ✓holdsAt the same blocks, does the Fe oracle price cbETH as cbETH/ETH times ETH/USD from the same feeds?2,091.1616 USD to 2,243.1581 USD, asserted equal at every block to the product of the two feeds' answers
- ✓holdsWhere Moonwell's oracle was right, is the Fe price identical to it?block 42,194,662: 2206683650838065175827 wad, block 42,538,949: 2091161605700000000000 wad, identical
- ✓holdsIs MIP-X43's misconfiguration rejected in each form it can take, and at which layer?compile: 8-0000 type mismatch; bind: WrongDecimals; read: AnswerOutOfBand
Each declared feed against Chainlink's directory make feeds
- ✓holdsIs every feed in Moonwell's registry the feed Chainlink lists at its address, as the chain reports it?CBETH_ETH is "CBETH / ETH": 10 of 10 checks; ETH_USD is "ETH / USD": 10 of 10 checks
- ✓holdsIs MIP-X43's declaration, the cbETH/ETH feed as cbETH/USD, rejected before deployment?declared CBETH/USD, listed CBETH/ETH. Chainlink lists CBETH/USD at 0xd7818272B9e248357d13057AAb0B417aF31E817d (8 decimals, heartbeat 1,200 s)
- ✓holdsIs a wrong feed rejected even when it compiles and passes every check Dimension makes on chain?the cbETH/USD feed declared as ETH/USD compiles, and on chain its decimals, answer, freshness and band all pass: 1,858.68 USD per ETH, while ETH/USD reads 1,625.55 USD per ETH. feed-check: declared ETH/USD, listed CBETH/USD
The ERC-4626 vault against OpenZeppelin make vault
- ✓holdsDo the vault's roundings, which no line of it names, give exactly what OpenZeppelin's ERC4626 gives?40,000 vectors over the four previews, each equal to OpenZeppelin v5.1.0 in the same state
- ✓holdsDoes the comparison test the rounding direction, not only the formula?in 33,684 of the vectors the exact result is fractional, so rounding the other way would differ
The deployment on Base Sepolia, read back from the chain make live
- ✓holdsDid every recorded transaction succeed, in the block the record gives?21 transactions from 0x84e223Fb745B157a5f71d831634302B968129dB3, blocks 61,288,219 to 61,289,310
- ✓holdsIs each contract's code on chain exactly the code this repository builds?7 Fe contracts byte-identical to fe build with Fe 26.6.0; LiveRecorder and MockRateProvider (rate 1.21) identical to forge's build apart from Solidity's metadata hash
- ✓holdsOn chain, does the attacker's planned batch lower the value behind each share of the pool that rounds as Balancer V2?51 exits in one transaction (0x0ecf…9520, block 61,289,251): 1.0000 to 0.9662 per BPT (-3.38%), equal to the wei to LivePlan's run of the same batch
- ✓holdsDo the typed and guarded pools reject the same batch on chain, keeping the value behind each share?TypedPool: reverted Error("BAL#004") at exit 51 of 51, as LivePlan finds; 1.0000 per BPT unchanged; GuardedPool: reverted Error("BAL#004") at exit 51 of 51, as LivePlan finds; 1.0000 per BPT unchanged
- ✓holdsWithout the exit they reject, does the same batch raise the value behind each typed and guarded share instead?TypedPool: 50 exits, 1.0000 to 1.1391 per BPT (+13.91%); GuardedPool: 50 exits, 1.0000 to 1.1391 per BPT (+13.91%), equal to the wei to LivePlan
- ✓holdsDoes the oracle price cbETH as cbETH/ETH times ETH/USD, read from Chainlink's Base Sepolia feeds with every check?block 61,374,818: 1,857.42 USD, equal to the wei to the product of the feeds' answers; recorded on chain at deployment: 1,989.70 USD (block 61,289,281)
- ✓holdsDeclared as an 8-decimal USD feed, is cbETH/ETH rejected when the contract binding it is deployed?WrongDecimals(0x91b2…944d, 8, 18) in 0x432c…0b53, block 61,289,286
- ✓holdsDeclared with its real 18 decimals, does it deploy, and is every read of it rejected?deployed at 0xc3e3…45f1; its read reverted AnswerOutOfBand(0x91b2…944d: 1.1443, outside 100 to 100,000) in 0x1771…7289, and AnswerOutOfBand(0x91b2…944d: 1.1443, outside 100 to 100,000) at block 61,374,818
- ✓holdsDeclared correctly, does Chainlink's own cbETH/USD feed read through the same contract?block 61,374,818: 1,863.56 USD, its answer to the wei; the oracle's price through ETH is 0.33% from it
- ✓holdsDoes the deployed typed vault preview as OpenZeppelin's ERC4626?24 of 24 previews equal OpenZeppelin's formulas, in 3 states including a first deposit after a one-token donation
The Balancer kernels in WebAssembly, against the EVM make wasm
- ✓holdsCompiled to WebAssembly from the same source, do the kernels compute every step of the batch exactly as the deployed contracts do on the EVM?154 values per BPT, the start and after each exit on each kernel, equal to forge's run of the same contracts to the wei; faithful 1.0000 to 0.9662; typed and guarded fail exit 51 with BAL#004, as on the EVM
- ✓holdsIs the module reproducible, and is it the one the site serves?two builds byte-identical: 110,023 bytes, sha256 3f12cdf8f7952bad…, unchanged in web/public
- ✓holdsDo the unit suites run on the WebAssembly backend?24 tests pass in 4 suites; 1 not built: debiting_more_than_is_held_reverts, which uses the EVM's `should_revert`
The same kernels as a native library, called from C make native
- ✓holdsBuilt as a native static library and called from C, do the kernels compute every step of the batch exactly as the deployed contracts do on the EVM?154 values per BPT, the start and after each exit on each kernel, equal to forge's run of the same contracts to the wei; faithful 1.0000 to 0.9662; typed and guarded fail exit 51 with BAL#004, as on the EVM
Dimension as someone else's dependency make consumer
- ✓holdsCan a new project depend on Dimension from git, and does it get Dimension's checks?`dimension new` creates the quickstart taking Dimension at 5a1aafe by git source; it builds and passes its 3 tests; an incoming amount used as an outgoing one is rejected with 8-0000
- ✓holdsDoes `dimension check` pass that project, list its labels for review, and fail it once it can forge values Dimension trusts?the new project: 6 of 6 checks ok, no warnings; its 3 labels listed for review (given<USDC, In>, owed<USDC, Out>, owed<USDC, In>); with allow_unsafe set on Dimension it fails allow_unsafe; with a price forged by a pointer cast, which compiles, it fails unsafe code; with the forgery between the strings "/*" and "*/", it fails unsafe code; with a feed built where feed-check cannot read it, it fails feeds
- ✓holdsIn each project compared, does `dimension check` list exactly the label calls a second compiler method finds?identical to the compiler's list in each of the projects compared: tests/labels 11, examples/quickstart 3, ingots/vault 6, ingots/balancer_v2 18, ingots/balancer_explorer 24, ingots/moonwell 0. tests/labels writes them in every form found so far: type inferred, aliased, re-exported and renamed in another file, through an aliased module and a module path, generic in the direction, a holding and a supply, and decoys: a comment, a string, a local function sharing a label's name, and an unrelated function sharing a re-exported one
The same library and tests on Fe 26.7.0 make compat
- ✓holdsOn fe 26.7.0 (e6e6342), does every ingot type-check, and every unit suite pass on the backends it declares?6 of 6 ingots type-check; 11 of 11 suite runs pass, 63 tests
- ✓holdsOn fe 26.7.0 (e6e6342), is every compile-fail case rejected with its expected code, and its corrected twin accepted?23 of 23 cases
Planted bugs, each caught by the check meant for it make mutants
- ✓holdsIs every planted bug in the safety-critical code caught by the check meant to catch it?22 of 22 mutants caught, each for the reason expected of it, across 7 layers: bind time, compile time, port fidelity, read time, runtime guard, types, unsafe policy
Would the checks notice if the code were wrong?
| Bug planted | Layer | Caught by | Evidence |
|---|---|---|---|
| Balancer's _upscale put back into the typed pool's exit | compile time | ✓caughtfe check ingots/balancer_v2 | error[8-0000]: type mismatch |
| An amount leaving the protocol is admitted rounded down, as Balancer did | types | ✓caughtmake unit | FAIL core |
| A charge is settled rounded down, in the caller's favour | types | ✓caughtmake unit | FAIL core |
| The seal's key is made public, so code outside Dimension can implement the seal and add a flow | types | ✓caughtmake compile-fail | FAIL compile_fail/custom_flow_through_the_seal |
| An exchange gives back value moving the same way as what it received | types | ✓caughtfe check ingots/vault | error[8-0000]: type mismatch |
| A feed's answer is not checked against its band | read time | ✓caughtmake unit | FAIL oracle |
| A feed's answer is not checked for staleness | read time | ✓caughtmake unit | FAIL oracle |
| A feed's reported decimals are not checked when it is bound | bind time | ✓caughtmake unit | FAIL oracle |
| A rate provider's answer is not checked against its band | read time | ✓caughtmake unit | FAIL oracle |
| The share-value comparison always passes | runtime guard | ✓caughtmake explore | FAILS With the runtime guard added, does any operation lose value per BPT or store an invariant its balances do not back? |
| The guarded pool's exact-out exit runs without its guard | runtime guard | ✓caughtmake explore | FAILS With the runtime guard added, does any operation lose value per BPT or store an invariant its balances do not back? |
| A risk policy's bonus no longer has to avoid bad debt at the threshold | compile time | ✓caughtmake compile-fail | FAIL compile_fail/liquidation_bonus_creates_bad_debt |
| A held balance can be credited with an amount labelled as leaving | types | ✓caughtmake compile-fail | FAIL compile_fail/vault_deposit_labeled_as_leaving |
| An amount in internal 18-decimal units counts as token units | types | ✓caughtmake compile-fail | FAIL compile_fail/internal_units_credited_to_balance |
| A held balance can be credited with an amount of another token | types | ✓caughtmake compile-fail | FAIL compile_fail/deposit_credited_to_another_token |
| A supply the protocol issues can be credited, as if the protocol held it | types | ✓caughtmake compile-fail | FAIL compile_fail/share_supply_credited_as_held |
| The port drops the + 1 Balancer adds in calc_in_given_out | port fidelity | ✓caughtmake differential | 22 functions, 200000 vectors: 156219 succeeded identically, 43781 reverted identically, 2 mismatched |
| The port's mulUp rounds down | port fidelity | ✓caughtmake differential | 22 functions, 150005 vectors: 119597 succeeded identically, 30408 reverted identically, 7 mismatched |
| The vault counts two virtual shares on deposit instead of one | port fidelity | ✓caughtmake vault | [FAIL: previewDeposit: 3992760530 != 3962963809; counterexample: calldata=0x7c407e8000000000000000000000000000000000000000000000000000000000… |
| A protocol ingot gains an unsafe block | unsafe policy | ✓caughtmake unsafe-policy | unsafe code outside dimension::value::testing |
| Joins and exits stop minting the protocol's fee on their own swap fees | port fidelity | ✓caughtmake replay | [FAIL: every step must compute what Balancer computed: 94 != 121] test_attack1() (gas: 13752828) |
| The registry declares ETH/USD with 18 decimals | bind time | ✓caughtmake moonwell | [FAIL: the Fe oracle must bind the real feeds] test_pricesThroughTheWindow() (gas: 133752) |
A mutant counts as caught only if its check fails for the reason expected of it; a failure for any other reason, such as a network error, is reported as inconclusive and fails the run. The last two need a fork: run all of them with make mutants FORKS=1.
A Fe compiler issue, reduced to 60 lines.
fe build --help describes -O s as size-oriented and "currently similar to 2". On Fe 26.6.0 a 60-line program is 364 bytes at -O 2 and 513 at -O s: the size level skips the shared revert tails -O 2 forms. In the Balancer pool it also emits a large solver three times instead of once, for +14% in all.
Reported upstream as argotorg/fe#2043, with the reproducer kept in this repository.
23 constructions, each with a corrected twin.
| Case | Mechanism | Error | Twin |
|---|---|---|---|
| add_collateral_to_debt | Adding a debt value to a collateral value, which hides the shortfall a solvency check must see | 8-0000 | ✓passes |
| balancer_floor_upscale_as_admitted | An amount leaving the pool is scaled with floor rounding and handed to the math as if it had been admitted | 8-0000 | ✓passes |
| compose_prices_without_shared_asset | Multiplying cbETH/ETH by USD/ETH, which is not a cbETH/USD price | 8-0000 | ✓passes |
| custom_flow | Defining a new flow with its own choice of admission and settlement rounding | 6-0003 | ✓passes |
| custom_flow_through_the_seal | Implementing the seal from outside to add a flow, which Fe 26.6 allows for a private trait (argotorg/fe#2036): the seal requires the private Key | 2-0003 | ✓passes |
| custom_rounding_direction | Adding a third rounding direction that could round in the caller's favour | 6-0003 | ✓passes |
| custom_rounding_through_the_seal | Implementing the seal from outside to add a rounding direction, which Fe 26.6 allows for a private trait (argotorg/fe#2036): the seal requires the private Key | 2-0003 | ✓passes |
| deposit_credited_to_another_token | A two-token pool credits a WETH deposit to its USDC balance: a held balance takes only amounts of its own token | 8-0000 | ✓passes |
| forge_admitted_quantity | Building an admitted quantity directly, skipping the rounding admission applies | 2-0003 | ✓passes |
| forge_price | Building a trusted price from a raw number outside the verified boundary | 2-0003 | ✓passes |
| internal_units_credited_to_balance | A deposit is credited to a raw USDC balance in internal 18-decimal units, overstating it by 10^12: only amounts in token units can be credited | 6-0003 | ✓passes |
| liquidation_bonus_creates_bad_debt | A liquidation bonus so large that liquidating at the threshold needs more collateral than the position holds | 8-0093 | ✓passes |
| ltv_at_liquidation_threshold | A loan-to-value equal to the liquidation threshold, so a new loan can be liquidated at once | 8-0093 | ✓passes |
| moonwell_component_feed_in_usd_market | cbETH's USD price is configured as the cbETH/ETH exchange-rate feed alone, written against the real Base feed registry | 8-0000 | ✓passes |
| oracle_read_without_effects | Reading a price feed from a function whose signature does not declare the call and clock capabilities it uses | 8-0036 | ✓passes |
| payout_settled_as_charge | A payout rounded down is used where the amount charged must be rounded up | 8-0000 | ✓passes |
| scale_asset_with_too_many_decimals | Scaling a 24-decimal asset into 18-decimal internal units, which cannot be done without losing value | 8-0093 | ✓passes |
| share_supply_credited_as_held | A redemption credits the shares coming back to the vault's share supply, as if the vault held them, which would raise the supply instead of retiring them: a supply is only issued or retired | 2-0010 | ✓passes |
| test_constructor_from_production_root | A production root reaching Dimension's unsafe test constructors without trusting them in fe.toml | 16-0015 | ✓passes |
| typed_pool_with_balancer_upscale | Inside the typed pool, one line of Balancer V2 is put back: the amount out is scaled with _upscale's floor rounding and handed to StableMath | 8-0000 | ✓passes |
| value_with_another_assets_price | Valuing a USDC balance with the cbETH price | 8-0000 | ✓passes |
| vault_deposit_labeled_as_leaving | A vault deposit labelled, consistently, as assets leaving the vault: every signature agrees, so its shares round up in the depositor's favour, and only the vault's books refuse the label: the deposit cannot be credited to its assets, nor its shares issued | 8-0000 | ✓passes |
| vault_deposit_rounds_shares_up | A vault deposit computes the shares to issue as if the deposited assets were leaving, which rounds the shares up, in the caller's favour | 8-0000 | ✓passes |
Also: 6 of 6 unit suites pass on the EVM and natively, and 20 of 20 language probes reproduce their recorded diagnostics and bytecode hashes. Run any case live with make show CASE=<name>.