ajna-finance / ajna-core

The Ajna protocol is a non-custodial, peer-to-peer, permissionless lending, borrowing and trading system that requires no governance or external price feeds to function.
https://www.ajna.finance/
Other
31 stars 11 forks source link

Intermittant failure of Fenwick tree removal #508

Closed EdNoepel closed 1 year ago

EdNoepel commented 1 year ago

Need to rework randomness function to base it on a deterministic seed. Afterword, we can run a continuous test to reproduce the behavior of failed removal, and further investigate the problem.

Details from the card DSTest currently has this randomInRange facility which generates psuedorandomness by taking the keccak of block.timestamp, msg.sender, and _nonce. The block timestamp and nonce are not deterministic, hindering reproduction of fuzz test failures.

Create a new random function which takes a fuzzed seed, and move consumers over to this function as failures are observed. First subject is FenwickTreeInstance.fuzzyFill.

EdNoepel commented 1 year ago

Seems this was an issue with the fuzz tests, not the Fenwick tree itself. Will be fixed by #523 once upstream PRs are merged.