I found a strange case and didn't find out why.

modifier onlyMaster() {
        require(msg.sender == master || msg.sender == developer, "caller is not the master");

Deploy Gas amount: 1183967

I tried to delete some words for saving deployment gas as follows.

modifier onlyMaster() {
        require(msg.sender == master || msg.sender == developer, "caller is not master");

Deploy Gas amount: 1186943

But the gas amount was increased against my prediction like this.

Other omissions decreased the gas amount but only this omission increased the gas amount.

So I created a very simple smart contract and tested it.

contract Demo {
    address public master;
    uint256 public callTimer;
    function setMaster(address master_) external {
        master = master_;
    function demoFunction() external{
        require(msg.sender == master, "caller is not the master");

I removed "the" and the deploy gas amount was decreased just I thought.

I am sorry that I can't provide the whole code, but has anyone ever had a similar experience?

What's the reason?

FYI, the "caller is not the" string is not repeated in the smart contract.

  • Can you show the function where the modifier onlyMaster applies ?
    – clement
    Nov 25, 2020 at 19:05
  • function setMaster(address master_) external onlyMaster { master = master_; }
    – webelf000
    Nov 25, 2020 at 20:34
  • The most critical piece of information required here is a coding example which actually does reproduce the problem (and not your minimization attempt, which although wise by itself as a debug-filtering method, does not reproduce the problem). The fact that you cannot share your full code, doesn't mean that you should not share a piece of code which reproduces the problem that you're describing. How else would anyone here be able to investigate it otherwise? Nov 26, 2020 at 15:02
  • 1
    Additional pieces of information which seem very relevant to your question.are: What compiler version are you using? What compiler configuration are you using (for example, number of optimization runs)? Nov 26, 2020 at 15:03
  • I used default optimization run (200) and I used the latest compiler version (0.7.5).
    – webelf000
    Nov 26, 2020 at 15:20


Your Answer

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

Browse other questions tagged or ask your own question.