UniswapV2Pair
Port source ports/uniswap-v2-pair, runtime code hash 0x443e928a28d99481a56b924e038dbc0427a440e9ede17cc51aaf017d20492983 (5878 bytes), in place of the deployed code with hash 0x5b83bdbcc56b2e630f2807bbadd2b0c21619108066b92a58de081261089e9ce5 (11293 bytes). Blocks /root/v2blocks/0x192d500 to /root/v2blocks/0x192d5c7.
No behavior difference: every transaction that ran the port, every mutation of them and every random call behaved as on the deployed code.
| Mainnet, as it happened | passed |
|---|---|
| Mainnet, mutated | passed |
| Random calls | passed |
| Mutants: the unchanged port | passed |
Mainnet, as it happened
Each transaction of the blocks ran on its own mainnet pre-state, with the port in place of every account holding the deployed code, and was compared with the chain: status, logs, every balance, nonce and storage slot. Only gas may differ.
| Blocks | 200 |
|---|---|
| Transactions | 69643 |
| Transactions that ran the port | 856 |
| Identical to the chain | 806 |
| Differ where other code read the gas left | 47 |
| of which part at or under that code | 47 |
| Differ where other code read code hashes | 3 |
| Only the deployed code ran out of gas | 0 |
| Behave differently | 0 |
Gas per call in identical transactions
| Function | In the port's source | Calls | Deployed | Port | Change |
|---|---|---|---|---|---|
Swap | src/lib.fe:467 | 873 | 58308 | 57761 | -0.9% |
Token0 | src/lib.fe:333 | 49 | 2136 | 2063 | -3.4% |
Token1 | src/lib.fe:337 | 26 | 2049 | 1976 | -3.5% |
GetReserves | src/lib.fe:341 | 803 | 2185 | 2088 | -4.4% |
Factory | src/lib.fe:329 | 43 | 2402 | 2329 | -3% |
KLast | src/lib.fe:353 | 1 | 2388 | 2316 | -3% |
TotalSupply | src/lib.fe:234 | 7 | 2388 | 2315 | -3% |
Approve | src/lib.fe:262 | 1 | 7342 | 7190 | -2% |
TransferFrom | src/lib.fe:274 | 1 | 35449 | 34939 | -1.4% |
Burn | src/lib.fe:418 | 1 | 172325 | 167369 | -2.8% |
Mint | src/lib.fe:369 | 1 | 57304 | 51563 | -10% |
Price0CumulativeLast | src/lib.fe:345 | 2 | 2387 | 2315 | -3% |
Price1CumulativeLast | src/lib.fe:349 | 1 | 2409 | 2337 | -2.9% |
Sync | src/lib.fe:550 | 7 | 33498 | 33902 | +1.2% |
Transfer | src/lib.fe:268 | 1 | 29840 | 29614 | -0.7% |
Mainnet, mutated
Each transaction that touched the deployed code ran again with its calldata changed, or with one call into the contract changed in flight, on both codes, gas free.
| Transactions | 856 |
|---|---|
| Runs | 17120 |
| Identical | 16591 |
| Differ where other code read the gas left or code hashes | 489 |
| of which code hashes | 49 |
| of the rest, part at or under the code that read the gas left | 440 |
| Only the deployed code ran out of gas | 40 |
| Differ after an address-shaped word got upper bits | 0 |
| Differ after the calldata was cut short | 0 |
| Differ | 0 |
The port ran 2556 of its 3466 instructions (73.7%) in these runs.
Random calls
1,000 sessions of up to 60 random calls each, against both codes in step, checking the pair's invariants after every call.
| Well-formed calls | 49464 |
|---|---|
| Well-formed calls that differ | 0 |
| Calls with short calldata that differ | 0 |
| Calls with dirty addresses that differ | 0 |
| Invariants broken | 0 |
The port ran 3299 of its 3466 instructions (95.1%).
How sharp the checks are
Mutants of the port's source, one operator changed each, built with fe and put through random calls and then mutations of the first ten blocks. The unchanged port passed the same checks first.
| Operators in the source | 74 |
|---|---|
| Mutants built | 74 |
| Killed by random calls | 61 |
| Killed by mainnet mutations | 0 |
| Survived | 13 |
82.4% killed. A survivor is a blind spot of the checks or a change that means the same; each deserves a look:
line 522: if mul(adjusted0, adjusted1) <= mul(mul(reserve0, reserve1), 1_000_000) {
line 675: let size: usize = (if reason.len >= 32 { 132 } else { 100 })
line 681: if reason.len >= 32 {
line 735: if x <= y { x } else { y }
line 740: if y >= 3 {
line 742: var x = y / 2 - 1
line 749: if y == 0 { 1 } else { 0 }
line 754: if balance >= left {
line 809: if elapsed >= 0 && reserve0 != 0 && reserve1 != 0 {
line 847: if root_k >= root_k_last {
line 851: if liquidity >= 0 {
line 856: } else if last == 0 { k_last = 0 }
line 928: if data.len() != 0 { return }
Made by fevm-replay certify, written in Fe and running fevm, the EVM written in Fe.