ChainSecurity / deployment_validation

Deployment Validation Files aim to simplify Deployment Validation of Smart Contracts
GNU Affero General Public License v3.0
21 stars 1 forks source link

Early quit validation of critical events #28

Open stiefn opened 3 weeks ago

stiefn commented 3 weeks ago

Current behaviour

When validating a DVF, a critical event is queried throughout the entire range of blocks. Once the querying part is done, the expected event behaviour is compared to what is specified in the DVF.

Problem

It takes an unnecessary long time for some validations to fail. For instance, if the number of occurrences of an event does not match, this can be spotted early on during the event querying.

Example

I was validating the USDC proxy contract, and after about 20 minutes I got this error:

Validation failed. Deployment invalid: Found 8 occurrences of event AdminChanged(address,address), but expected 0.

I was expecting this error, but I would have liked the querying to early stop at the first event occurrence found.

stiefn commented 3 weeks ago

Possible solution: https://docs.rs/ethers/latest/ethers/providers/struct.LogQuery.html