flaky stress test#2614
Conversation
4b254dd to
d88d72e
Compare
the cache was introducing flakyness in the tests, this happened with tests that are long running but don't send many transactions, which makes the block gaslimit decrease significantly after the private blockchain fixture setup is done
d88d72e to
300e785
Compare
|
@hackaugusto Very nicely spotted. But wouldn't it be better to somehow remove the gas limit cache only for the stress test and keep it in the actual production code? Isn't it useful in production? |
I don't think so, this will always be a problem when the chain is under congestion. If the idea is to save RPC calls then we should first measure the performance impact, and if measured to be worth while add a cache on a per block basis. Edit: In general I think we should only use caches for memoizatoin, otherwise it introduces data races like this one. i.e. the gasprice cache should go too. |
Completely agree on the general idea of optimizing only if a bottleneck is found.
I am not sure I understand why blockchain congestion plays a part here. Can you elaborate a bit? The TTL cache essentially waits 600 seconds until making a new RPC call. In real blockchain scenarios 600 seconds is about 42 blocks. The gas limit can not change significantly in the ethereum mainnet in that small amount of blocks. |
|
As @hackaugusto proposed in #2623 , the actual solution is to not use last block gas as gaslimit, but instead either hardcode known limits or properly estimating gas. |
|
yeah properly estimating gas sounds good |
the cache was introducing flakyness in the tests, this happened with
tests that are long running but don't send many transactions, which
makes the block gaslimit decrease significantly after the private
blockchain fixture setup is done