Low events block range on Polygon Mumbai

Congratulations on adding Polygon support, it’s good to see solid infrastructure growing around this new technology!

We’re trying out Polygon on Mumbai ourselves and I’m testing our smart contracts which are heavily reliant on events. They are working perfectly fine on Ethereum when using Infura, but unfortunately on Mumbai Infura refuses doing queries touching more than 100K blocks. This is extremely small considering that the whole Mumbai is already 15M blocks tall.

Is this supposed to be like this or is it a bug? Should I iterate and make ~150 queries 100K blocks each to cover the whole blockchain? Or is it a Mumbai-only issue and Mainnet doesn’t have this limitation?

Hi @igor.zuk, and welcome to the Infura community! We do have a limitation set on the number of blocks one can poll at once so our nodes don’t crash. We suggest iterating starting from HEAD and doing 10K blocks at a time in order to prevent timeouts and get the information you need.

Hi @Leiya_Kenney, thank you for answering!

Is this limitation the same for Polygon Mainnet? Do you have plans to lift it? Maybe there’s an obvious workaround for the limit problem, which I don’t know? Polygon generates almost 40K blocks per day, at this rate the event queries will be feasible for ~2 weeks after each deployment :laughing:

Currently, the best workaround is to pick a range of blocks and iterate through as many total blocks as necessary. If this changes, we’ll be sure to put out an announcement!

1 Like