1

I have function which uses for loops on the calldata array as following:

mapping (address => bool) public userRegistered;
function registerUsers(address[] calldata users) external {
  for (uint256 i; i < users.length; ++i) {
    userRegistered[users_[i]] = true;
  }
}

Context of the function doesn't matter, I just shortened the actual function to give the idea. So I know the block gas limit on ethereum is 15M, but maximum it can be 30M. I want to put a constraint on the length of the users_ array so it does not hit block gas limit ever causing so much loss of money.

I am planning to pick such a maximum length that, gas cost will be very close to the block gas limit. But my confusion is, should I arrange according to 15M or 30M limit? For instance when the network is rather empty at that point and the produced blocks are mostly consist of 15M gas limit, and I submit the tx that will require 29.9M gas, will it not be executed or will the execution will be much slower?

1 Answer 1

0

You can definitely submit the transaction with 29.9M gas at any point and rest assured that it can be included in a block, regardless of current congestion. You do need to be aware that buying out a block like that basically means you need to pay a higher miner tip gas price than any other transaction in the mempool, so you'll likely end up paying more on average for a full block transaction than if you went for a lower limit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.