delvtech / hyperdrive

An automated market maker for fixed and variable yield with on-demand terms.
Apache License 2.0
33 stars 4 forks source link

[CRASH REPORT] fuzz invariant -- vault shares not equal in balance check #696

Closed dpaiton closed 11 months ago

dpaiton commented 11 months ago

Crash Report

https://app.rollbar.com/a/delv/fix/item/FirstProject/37

Description

Test: fuzz_hyperdrive_balance.py

Expected Behavior

We expect the vault shares to be invariant if all open trades are subsequently closed.

Actual Behavior

We are seeing varying differences (a histogram of the differences is below):

count    2.500000e+01
mean     2.219572e+20
std      1.190247e+20
min      6.381239e+19
25%      1.283130e+20
50%      2.077195e+20
75%      3.138953e+20
max      5.180030e+20
Name: additional_info.invariance_check:vault_shares_difference_in_wei, dtype: float64

Steps to Reproduce

Run the fuzz test.

Screenshots or Error Messages

image

Logs or Stack Traces

fuzz_hyperdrive_balance2023_12_12_18_34_47_Z.json

jalextowle commented 11 months ago

I don't know that I'd expect this to be true. As mentioned on some of the other issues, the share reserves isn't necessarily path independent (even though the effective share reserves is). Also, if we have fees turned on, that would definitely break this.

dpaiton commented 11 months ago

Ok, we will not check vault shares and instead check effective share reserves

slundqui commented 11 months ago

Fixed in https://github.com/delvtech/agent0/pull/1205