eth_estimateGas always fail on a specific contract

Hi,

I tried to call eth_estimateGas on few contracts, it works all well but for one. The body of the request is:

{"method":"eth_estimateGas","params":[{"data":"0x60806040523480156200001157600080fd5b50604051620034da380380620034da833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b50604052505050818181818181620001d36301ffc9a760e01b6200027b60201b60201c565b620001eb6380ac58cd60e01b6200027b60201b60201c565b6200020b620001ff6200038460201b60201c565b6200038c60201b60201c565b6200022363780e9d6360e01b6200027b60201b60201c565b81600a90805190602001906200023b929190620005b1565b5080600b908051906020019062000254929190620005b1565b506200026d635b5e139f60e01b6200027b60201b60201c565b505050505050505062000660565b63ffffffff60e01b817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141562000318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433136353a20696e76616c696420696e746572666163652069640000000081525060200191505060405180910390fd5b6001600080837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b620003a7816005620003ed60201b620027311790919060201c565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b620003ff8282620004d160201b60201c565b1562000473576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156200055a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180620034b86022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005f457805160ff191683800117855562000625565b8280016001018555821562000625579182015b828111156200062457825182559160200191906001019062000607565b5b50905062000634919062000638565b5090565b6200065d91905b80821115620006595760008160009055506001016200063f565b5090565b90565b612e4880620006706000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80636352211e116100c3578063a14481941161007c578063a1448194146108e5578063a22cb4651461094b578063aa271e1a1461099b578063b88d4fde146109f7578063c87b56dd14610afc578063e985e9c514610ba35761014d565b80636352211e1461065157806370a08231146106bf5780638832e6e31461071757806395d89b4114610814578063983b2d561461089757806398650275146108db5761014d565b806318160ddd1161011557806318160ddd1461044d57806323b872dd1461046b5780632f745c59146104d957806340c10f191461053b57806342842e0e146105a15780634f6ccce71461060f5761014d565b806301ffc9a71461015257806306fdde03146101b7578063081812fc1461023a578063095ea7b3146102a8578063150b7a02146102f6575b600080fd5b61019d6004803603602081101561016857600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610c1f565b604051808215151515815260200191505060405180910390f35b6101bf610c86565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ff5780820151818401526020810190506101e4565b50505050905090810190601f16801561022c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102666004803603602081101561025057600080fd5b8101908080359060200190929190505050610d28565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f4600480360360408110156102be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc3565b005b6103f96004803603608081101561030c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561037357600080fd5b82018360208201111561038557600080fd5b803590602001918460018302840111640100000000831117156103a757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610faa565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b610455610fbe565b6040518082815260200191505060405180910390f35b6104d76004803603606081101561048157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fcb565b005b610525600480360360408110156104ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611041565b6040518082815260200191505060405180910390f35b6105876004803603604081101561055157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611100565b604051808215151515815260200191505060405180910390f35b61060d600480360360608110156105b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061117b565b005b61063b6004803603602081101561062557600080fd5b810190808035906020019092919050505061119b565b6040518082815260200191505060405180910390f35b61067d6004803603602081101561066757600080fd5b810190808035906020019092919050505061121b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610701600480360360208110156106d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e3565b6040518082815260200191505060405180910390f35b6107fa6004803603606081101561072d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561077457600080fd5b82018360208201111561078657600080fd5b803590602001918460018302840111640100000000831117156107a857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506113b8565b604051808215151515815260200191505060405180910390f35b61081c611435565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561085c578082015181840152602081019050610841565b50505050905090810190601f1680156108895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108d9600480360360208110156108ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d7565b005b6108e3611548565b005b610931600480360360408110156108fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061155a565b604051808215151515815260200191505060405180910390f35b6109996004803603604081101561096157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506115d5565b005b6109dd600480360360208110156109b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061178d565b604051808215151515815260200191505060405180910390f35b610afa60048036036080811015610a0d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610a7457600080fd5b820183602082011115610a8657600080fd5b80359060200191846001830284011164010000000083111715610aa857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506117aa565b005b610b2860048036036020811015610b1257600080fd5b8101908080359060200190929190505050611822565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b68578082015181840152602081019050610b4d565b50505050905090810190601f168015610b955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610c0560048036036040811015610bb957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611935565b604051808215151515815260200191505060405180910390f35b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b6060600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d1e5780601f10610cf357610100808354040283529160200191610d1e565b820191906000526020600020905b815481529060010190602001808311610d0157829003601f168201915b5050505050905090565b6000610d33826119c9565b610d88576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180612cf0602c913960400191505060405180910390fd5b6002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610dce8261121b565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612d966021913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610e74611a3b565b73ffffffffffffffffffffffffffffffffffffffff161480610ea35750610ea281610e9d611a3b565b611935565b5b610ef8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180612c146038913960400191505060405180910390fd5b826002600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600063150b7a0260e01b9050949350505050565b6000600880549050905090565b610fdc610fd6611a3b565b82611a43565b611031576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180612db76031913960400191505060405180910390fd5b61103c838383611b37565b505050565b600061104c836112e3565b82106110a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612b67602b913960400191505060405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106110ed57fe5b9060005260206000200154905092915050565b600061111261110d611a3b565b61178d565b611167576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612c9f6030913960400191505060405180910390fd5b6111718383611b5b565b6001905092915050565b611196838383604051806020016040528060008152506117aa565b505050565b60006111a5610fbe565b82106111fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180612de8602c913960400191505060405180910390fd5b6008828154811061120957fe5b90600052602060002001549050919050565b6000806001600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112da576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180612c766029913960400191505060405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612c4c602a913960400191505060405180910390fd5b6113b1600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611b7c565b9050919050565b60006113ca6113c5611a3b565b61178d565b61141f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612c9f6030913960400191505060405180910390fd5b61142a848484611b8a565b600190509392505050565b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114cd5780601f106114a2576101008083540402835291602001916114cd565b820191906000526020600020905b8154815290600101906020018083116114b057829003601f168201915b5050505050905090565b6114e76114e2611a3b565b61178d565b61153c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612c9f6030913960400191505060405180910390fd5b61154581611bfb565b50565b611558611553611a3b565b611c55565b565b600061156c611567611a3b565b61178d565b6115c1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612c9f6030913960400191505060405180910390fd5b6115cb8383611caf565b6001905092915050565b6115dd611a3b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4552433732313a20617070726f766520746f2063616c6c65720000000000000081525060200191505060405180910390fd5b806004600061168b611a3b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611738611a3b565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051808215151515815260200191505060405180910390a35050565b60006117a3826005611ccd90919063ffffffff16565b9050919050565b6117bb6117b5611a3b565b83611a43565b611810576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180612db76031913960400191505060405180910390fd5b61181c84848484611dab565b50505050565b606061182d826119c9565b611882576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612d67602f913960400191505060405180910390fd5b600c60008381526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119295780601f106118fe57610100808354040283529160200191611929565b820191906000526020600020905b81548152906001019060200180831161190c57829003601f168201915b50505050509050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000806001600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415915050919050565b600033905090565b6000611a4e826119c9565b611aa3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180612be8602c913960400191505060405180910390fd5b6000611aae8361121b565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611b1d57508373ffffffffffffffffffffffffffffffffffffffff16611b0584610d28565b73ffffffffffffffffffffffffffffffffffffffff16145b80611b2e5750611b2d8185611935565b5b91505092915050565b611b42838383611e1d565b611b4c8382612078565b611b568282612216565b505050565b611b6582826122dd565b611b6f8282612216565b611b78816124f5565b5050565b600081600001549050919050565b611b948383611b5b565b611ba16000848484612541565b611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180612b926032913960400191505060405180910390fd5b505050565b611c0f81600561273190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b611c6981600561280c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b611cc9828260405180602001604052806000815250611b8a565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612d1c6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611db6848484611b37565b611dc284848484612541565b611e17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180612b926032913960400191505060405180910390fd5b50505050565b8273ffffffffffffffffffffffffffffffffffffffff16611e3d8261121b565b73ffffffffffffffffffffffffffffffffffffffff1614611ea9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180612d3e6029913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612bc46024913960400191505060405180910390fd5b611f38816128c9565b611f7f600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612987565b611fc6600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206129aa565b816001600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006120d06001600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506129c090919063ffffffff16565b90506000600760008481526020019081526020016000205490508181146121bd576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061213d57fe5b9060005260206000200154905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061219557fe5b9060005260206000200181905550816007600083815260200190815260200160002081905550505b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548091906001900361220f9190612b15565b5050505050565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506007600083815260200190815260200160002081905550600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190915055505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612380576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4552433732313a206d696e7420746f20746865207a65726f206164647265737381525060200191505060405180910390fd5b612389816119c9565b156123fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081525060200191505060405180910390fd5b816001600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612495600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206129aa565b808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505090600182039060005260206000200160009091929091909150555050565b60006125628473ffffffffffffffffffffffffffffffffffffffff16612a0a565b61256f5760019050612729565b60008473ffffffffffffffffffffffffffffffffffffffff1663150b7a02612595611a3b565b8887876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612651578082015181840152602081019050612636565b50505050905090810190601f16801561267e5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156126a057600080fd5b505af11580156126b4573d6000803e3d6000fd5b505050506040513d60208110156126ca57600080fd5b8101908080519060200190929190505050905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150505b949350505050565b61273b8282611ccd565b156127ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6128168282611ccd565b61286b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612ccf6021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146129845760006002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b61299f600182600001546129c090919063ffffffff16565b816000018190555050565b6001816000016000828254019250508190555050565b6000612a0283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612a55565b905092915050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b8214158015612a4c5750808214155b92505050919050565b6000838311158290612b02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ac7578082015181840152602081019050612aac565b50505050905090810190601f168015612af45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b815481835581811115612b3c57818360005260206000209182019101612b3b9190612b41565b5b505050565b612b6391905b80821115612b5f576000816000905550600101612b47565b5090565b9056fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766520746865204d696e74657220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c654552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e526f6c65733a206163636f756e7420697320746865207a65726f20616464726573734552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e6473a265627a7a72315820f7ae556ed070b609f988ee99fc12c63916dcc9fb2546f9467edc8a38e763e46c64736f6c634300050c0032526f6c65733a206163636f756e7420697320746865207a65726f20616464726573730000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036c6d61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036c6d610000000000000000000000000000000000000000000000000000000000"}],"id":42,"jsonrpc":"2.0"}

The response is:

{
    "jsonrpc": "2.0",
    "id": 42,
    "error": {
        "code": -32000,
        "message": "gas required exceeds allowance (11958548) or always failing transaction"
    }
}

I’ve tried on multiple contracts and only one give me this error, also I dont face any problem to deploy the contract.

Is there a limitation ? Or is something else wrong ?

Hi @Nebulis - welcome to the Infura community!
Per our docs, the gas parameter is capped at 10x the current block gas limit, so yes, there is a limitation.

Hi,

Thanks for your response. As per my understanding the current block gas limit is 12,500,000. For the deployment of my contract I need 2,778,998 gas (https://ropsten.etherscan.io/tx/0x0dbdf730bcd193ab617c1f09953cf0849b41ea8ad30dba3edc9ef06f3a26e626).

Based on those number it should not fail ? (or maybe I understand something wrong)

I manage to estimate the gas correctly using ganache-cli, I’m using ethers.js and the estimateGas method. I only changed the provider used to have it working on ganache

Hi @Nebulis - since you’ve not seen this behaviour with other contracts, can you please provide me with the body for one of those so I can compare?
It sounds like this error is falling into the “always failing transaction” section of the error message, so it may be something with the request itself that’s causing the issue.

The code is fully available in github

  • github .com/Open-Attestation/open-attestation-cli (sorry I cant make this a link :slight_smile:)
  • branch feat/dry-run
  • working: npx ts-node ./src/index deploy document-store "My first document store" --dry-run
  • not working: npx ts-node ./src/index deploy token-registry lma lma --dry-run

If I change to use ganache instead of infura it works well:

  • in src/implementations/utils/dryRun.ts change L22 to const provider = new JsonRpcProvider("http://localhost:8545");
  • start ganache: npx ganache-cli
  • working: npx ts-node ./src/index deploy token-registry lma lma --dry-run

When I dug into ethers.js to get the details of the requests sent

If I run the query using postman it works on ganache. If I deploy the contract it works as well. Only the gas estimation on infura gives me error (as far as I can tell).

Hope this helps

Thanks so much for providing that! Have you tried explicitly defining the network you want to use (i.e. 'rinkeby' instead of 'network'? From the ethers docs, it looks like that may be a good place to start trying to debug, as when you’re using ganache, you’re explicitly defining the JsonRpcProvider.

Yes I tried to use

  • ethers.getDefaultProvider(“ropsten”) which resolves to https://ropsten.infura.io/v3
  • ethers.getDefaultProvider(“rinkeby”) which resolves to https://rinkeby.infura.io/v3
  • ethers.getDefaultProvider() which resolves to https:// mainnet .infura.io/v3 (again link limitation =))

If I reuse the body created when using one of the method above on ganache using postman it works well. This makes me thing that the problem does not lie on ethers.js

Hmm. If you run the curl commands with your information from our docs, does that work successfully?
It looks like you may be missing the to param in your request above, which is required.

Yeah it works, I didn’t use curl directly but postman (https://www.postman.com/).

I thought about that at first. I also found that https://eth.wiki/json-rpc/API#eth_estimategas indicates that all params are optional.

That aside if to was really required it shouldn’t work for the other contract which doesnt have the to field as well.

Okay, thanks for the additional information! Have you tried manually overriding the gasLimit? I know it sounds silly, given that it’s saying the allowance is 11,958,548 in the error message, but actually manually overriding it to get a successful response. Again, this isn’t typical, but it has come up in the past, so I would test it out.

From this thread, it sounds like occasionally estimateGas has been known to return too high a value and therefore it guesses your tx will fail.

Yes I tried until the upper limit (*10)

Gotcha.
I was looking through the code a bit deeper and noticed on L21 of the dryRun.ts file, you have const provider = ethers.getDefaultProvider([network]) - based on the ethers.js docs, that actually needs to be ethers.providers.getDefaultProvider([network]). This automatically creates a FallbackProvider that’s backed by Infura and Etherscan, and should hopefully help with the problem!

ethers.getDefaultProvider and ethers.providers.getDefaultProvider are the same => https://github.com/ethers-io/ethers.js/blob/master/packages/ethers/src.ts/ethers.ts (L12-13, 67-68)

I can confirm there is indeed a fallback on etherscan also failing. I can’t perform the request again before Tuesday but iirc it was failing because the request URL is too long (GET request with the body passed in the URL). I can give more details but that still doesn’t explain why infura is not able to fulfill that request (body limit ?)

I reached out to our engineering team to see what was going on, and they suggested checking to make sure the contract size isn’t too large, which would potentially give you that error.

Also, you don’t have any special flags when you’re running Ganache, correct?

No specific flags. The command I run is npx ganache-cli

Could you tell me the max contract size ?