base-org / pessimism

Detect real-time threats and events on OP Stack compatible blockchains
https://base-org.github.io/pessimism/
MIT License
1.54k stars 435 forks source link

Feat - Hash Verification #187

Open epociask opened 12 months ago

epociask commented 12 months ago

Problem

The withdrawal_safety heuristic currently verifies that a CrossDomainHash is reflective of a standard 256 bit hexadecimal hash output. This is done by taking the Sorensen Dice coefficient to ensure dissimilarity when compared to constant values (0x0...0, 0xF...F). Currently this check happens in the heuristic directly and fails to consider for additional constant values.

Problem Solution

Add some HashVerification function into the common/math library that performs integrity checks to verify if a value is reflective of a real hash output. This can extend on the existing implementation or leverage more intelligent techniques.