matter-labs / foundry-zksync

Fork of Foundry tailored for zkSync environment
Apache License 2.0
302 stars 130 forks source link

Estimate gas limit using paymaster balance when in use #695

Closed Jrigada closed 2 weeks ago

Jrigada commented 2 weeks ago

When paymaster is active the gas limit is set to the max value possible. This leads to a extremely high gas estimation from the paymaster contract when paying for the given transaction. We can apply the same heuristic calculation we do with users balance to estimate a smaller value if the paymaster balance is not outrageously large.