Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eth_compilesolidity works on localhost with testrpc, but not on mainnet #1490

Closed
Tectract opened this issue May 24, 2017 · 14 comments
Closed

Comments

@Tectract
Copy link

This is in reference to: #1485

I built the EthDeployer, here, for a BlockGeeks solidity tutorial article:
https://github.com/Tectract/EthDeployer

The idea is that this tool should allow you to compile and deploy contracts to the mainnet without needing a full node connection, yourself. That is the main utility of the EthDeployer. It WAS working just fine, a couple weeks ago...

Now, it no longer is able to complete the function call

web3.eth.compile.solidity(formattedContract,function(err, resp){

Note: I do not see the solc compiler getting called on the system. I've added hard-logging to the solc executable and it's not being executed.

When you run the ethDeployer against a localhost:8545 node, or simply disable metamask, everything works ok. It's only failing when connected to the mainnet.

This was extensively tested and working on my web-server a couple weeks back. Did something change?

deployer_deployed

You can test the EthDeployer locally very easily, it's a simple react app so you just git clone, npm i, npm start it.

It's also available online for testing at www.enledger.io/ethdeployer

@Tectract
Copy link
Author

@Tectract
Copy link
Author

Here's the error I see in the network background panel:
background.js:3974 Error in RPC response:
Object {message: "Error while compiling code.", code: -32000}

Not sure what -32000 means, maybe it's a hint?

@Tectract
Copy link
Author

The error I'm seeing is throwing from background.js:3974, this chunk of code:


{

    key: 'setupProviderConnection',

    value: function setupProviderConnection(outStream, originDomain) {

      streamIntoProvider(outStream, this.provider, logger);

      function logger(err, request, response) {

        if (err) return console.error(err);

        if (response.error) {

          console.error('Error in RPC response:\n', response.error);

        }

        if (request.isMetamaskInternal) return;

        log.info('RPC (' + originDomain + '):', request, '->', response);

      }

    }

  }

@tmashuang
Copy link
Contributor

I am interested in what version of Metamask and Chrome you are using.

@Tectract
Copy link
Author

Chrome version Version 51.0.2704.106 (64-bit), metamask 3.7.1.

This hasn't changed on my end since my initial dev / testing of the EthDeployer a couple weeks ago when it was working, though.

@Tectract
Copy link
Author

I wonder if I could roll back metamask easily to try an older version?

@Tectract
Copy link
Author

Interesting, when I try the compile/deploy on Rinky Testnet, I get this message:

compile err: Error: The method eth_compileSolidity does not exist/is not available

I see no hits on my webserver access_logs, in either case.

@Tectract
Copy link
Author

Anyone? People were really excited to use this tool to deploy contracts without needing a connection to a full node, and it's already been featured in some ethereum meetups, plus it was sort of the capping-stone to this BlockGeeks article.

Helping me get this working again could bring a lot of usage and publicity to metamask...

@Tectract
Copy link
Author

I added some debug lines to the function onPayLoadHandled:

    provider.sendAsync(payload, function onPayloadHandled(err, response){
      console.log("onPayloadHandled: ");
      console.debug(payload);
      console.debug(stream);
      console.debug(provider);
      console.debug(response);

got this result:

targetURL : https://mainnet.infura.io/metamask
background.js:64355 Object {jsonrpc: "2.0", id: 580848883641271, method: "eth_compileSolidity", params: Array[1]}
background.js:64387 Response {type: "cors", url: "https://mainnet.infura.io/metamask", status: 200, ok: true, statusText: ""…}
background.js:65918 onPayloadHandled: 
background.js:65919 Object {jsonrpc: "2.0", id: 580848883641271, method: "eth_compileSolidity", params: Array[1]}id: 580848883641271jsonrpc: "2.0"method: "eth_compileSolidity"params: Array[1]0: "pragma solidity ^0.4.4;contract Geekt {address GeektAdmin;mapping ( bytes32 => notarizedImage) notarizedImages;bytes32[] imagesByNotaryHash;mapping ( address => User ) Users;address[] usersByAddress;struct notarizedImage {string imageURL;uint timeStamp;}struct User {string handle;bytes32 city;bytes32 state;bytes32 country;bytes32[] myImages;}function Geekt() {GeektAdmin = msg.sender;}modifier onlyAdmin() {if (msg.sender != GeektAdmin)throw;_;}function removeUser(address badUser) onlyAdmin returns (bool success) {delete Users[badUser];return true;}function removeImage(bytes32 badImage) onlyAdmin returns (bool success) {delete notarizedImages[badImage];return true;}function registerNewUser(string handle, bytes32 city, bytes32 state, bytes32 country) returns (bool success) {address thisNewAddress = msg.sender;if(bytes(Users[msg.sender].handle).length == 0 && bytes(handle).length != 0){Users[thisNewAddress].handle = handle;Users[thisNewAddress].city = city;Users[thisNewAddress].state = state;Users[thisNewAddress].country = country;usersByAddress.push(thisNewAddress);return true;} else {return false;}}function addImageToUser(string imageURL, bytes32 SHA256notaryHash) returns (bool success) {address thisNewAddress = msg.sender;if(bytes(Users[thisNewAddress].handle).length != 0){if(bytes(imageURL).length != 0){if(bytes(notarizedImages[SHA256notaryHash].imageURL).length == 0) {imagesByNotaryHash.push(SHA256notaryHash);}notarizedImages[SHA256notaryHash].imageURL = imageURL;notarizedImages[SHA256notaryHash].timeStamp = block.timestamp;Users[thisNewAddress].myImages.push(SHA256notaryHash);return true;} else {return false;}return true;} else {return false;}}function getUsers() constant returns (address[]) { return usersByAddress; }function getUser(address userAddress) constant returns (string,bytes32,bytes32,bytes32,bytes32[]) {return (Users[userAddress].handle,Users[userAddress].city,Users[userAddress].state,Users[userAddress].country,Users[userAddress].myImages);}function getAllImages() constant returns (bytes32[]) { return imagesByNotaryHash; }function getUserImages(address userAddress) constant returns (bytes32[]) { return Users[userAddress].myImages; }function getImage(bytes32 SHA256notaryHash) constant returns (string,uint) {return (notarizedImages[SHA256notaryHash].imageURL,notarizedImages[SHA256notaryHash].timeStamp);}}"length: 1__proto__: Array[0]__proto__: Object
background.js:65920 DestroyableTransform {_readableState: ReadableState, readable: true, _events: Object, _maxListeners: undefined, _writableState: WritableState…}_destroyed: false_events: Object_maxListeners: undefined_readableState: ReadableState_transform: (chunk, enc, cb)_transformState: TransformState_writableState: WritableStateallowHalfOpen: truereadable: truewritable: true__proto__: Transform
background.js:65921 Web3ProviderEngine {_events: Object, _maxListeners: 30, _blockTracker: RpcBlockTracker, _ready: Stoplight, currentBlock: Object…}_blockTracker: RpcBlockTracker_events: Objectblock: Array[11]error: ()__proto__: Object_maxListeners: 30_providers: Array[7]0: DefaultFixturescurrentBlock: Objectengine: Web3ProviderEngine_blockTracker: RpcBlockTracker_events: Object_maxListeners: 30_providers: Array[7]_ready: StoplightcurrentBlock: Object__proto__: EventEmitterstaticResponses: Object__proto__: FixtureProvider1: NonceTrackerSubprovider2: SanitizerSubprovider3: BlockCacheProvider4: FilterSubprovider5: HookedWalletSubprovider6: RpcSourcelength: 7__proto__: Array[0]_ready: Stoplight_events: Object_maxListeners: undefinedisLocked: false__proto__: EventEmittercurrentBlock: Objectdifficulty: Uint8Array[7]extraData: Uint8Array[15]gasLimit: Uint8Array[3]gasUsed: Uint8Array[3]hash: Uint8Array[32]logsBloom: Uint8Array[256]miner: Uint8Array[20]nonce: Uint8Array[8]number: Uint8Array[3]parentHash: Uint8Array[32]receiptsRoot: Uint8Array[32]sha3Uncles: Uint8Array[32]size: Uint8Array[2]stateRoot: Uint8Array[32]timestamp: Uint8Array[4]totalDifficulty: Uint8Array[9]transactions: Array[20]transactionsRoot: Uint8Array[32]__proto__: Object__proto__: EventEmitter_handleAsync: (payload, finished)_inspectResponseForNewBlock: (payload, resultObj, cb)_setCurrentBlock: (block)addProvider: (source)constructor: Web3ProviderEngine(opts)send: (payload)sendAsync: (payload, cb)start: ()stop: ()__proto__: Object
background.js:65922 Object {id: 580848883641271, jsonrpc: "2.0", result: undefined, error: Object}error: Objectid: 580848883641271jsonrpc: "2.0"result: undefined__proto__: Object
background.js:3977 Error in RPC response:
 Object {message: "Error while compiling code.", code: -32000}

The response is null, "undefined", there's no solc error getting kicked back up, it's just somehow not connecting / running solc anymore.

@Tectract
Copy link
Author

A little more debugging the request / responses.

Heres: the request response against local testRPC, which succeeds:

setupProviderConnection originDomain: localhost
background.js:3974 request : 
background.js:3975 Object {jsonrpc: "2.0", id: 7744448421994809, method: "eth_compileSolidity", params: Array[1]}id: 7744448421994809jsonrpc: "2.0"method: "eth_compileSolidity"params: Array[1]0: "pragma solidity ^0.4.4;contract Geekt {address GeektAdmin;mapping ( bytes32 => notarizedImage) notarizedImages;bytes32[] imagesByNotaryHash;mapping ( address => User ) Users;address[] usersByAddress;struct notarizedImage {string imageURL;uint timeStamp;}struct User {string handle;bytes32 city;bytes32 state;bytes32 country;bytes32[] myImages;}function Geekt() {GeektAdmin = msg.sender;}modifier onlyAdmin() {if (msg.sender != GeektAdmin)throw;_;}function removeUser(address badUser) onlyAdmin returns (bool success) {delete Users[badUser];return true;}function removeImage(bytes32 badImage) onlyAdmin returns (bool success) {delete notarizedImages[badImage];return true;}function registerNewUser(string handle, bytes32 city, bytes32 state, bytes32 country) returns (bool success) {address thisNewAddress = msg.sender;if(bytes(Users[msg.sender].handle).length == 0 && bytes(handle).length != 0){Users[thisNewAddress].handle = handle;Users[thisNewAddress].city = city;Users[thisNewAddress].state = state;Users[thisNewAddress].country = country;usersByAddress.push(thisNewAddress);return true;} else {return false;}}function addImageToUser(string imageURL, bytes32 SHA256notaryHash) returns (bool success) {address thisNewAddress = msg.sender;if(bytes(Users[thisNewAddress].handle).length != 0){if(bytes(imageURL).length != 0){if(bytes(notarizedImages[SHA256notaryHash].imageURL).length == 0) {imagesByNotaryHash.push(SHA256notaryHash);}notarizedImages[SHA256notaryHash].imageURL = imageURL;notarizedImages[SHA256notaryHash].timeStamp = block.timestamp;Users[thisNewAddress].myImages.push(SHA256notaryHash);return true;} else {return false;}return true;} else {return false;}}function getUsers() constant returns (address[]) { return usersByAddress; }function getUser(address userAddress) constant returns (string,bytes32,bytes32,bytes32,bytes32[]) {return (Users[userAddress].handle,Users[userAddress].city,Users[userAddress].state,Users[userAddress].country,Users[userAddress].myImages);}function getAllImages() constant returns (bytes32[]) { return imagesByNotaryHash; }function getUserImages(address userAddress) constant returns (bytes32[]) { return Users[userAddress].myImages; }function getImage(bytes32 SHA256notaryHash) constant returns (string,uint) {return (notarizedImages[SHA256notaryHash].imageURL,notarizedImages[SHA256notaryHash].timeStamp);}}"length: 1__proto__: Array[0]__proto__: Object
background.js:3976 response : 
background.js:3977 Object {id: 7744448421994809, jsonrpc: "2.0", result: Object}id: 7744448421994809jsonrpc: "2.0"result: Objectcode: "0x606060405234610000575b60008054600160a060020a0319166c01000000000000000000000000338102041790555b5b610cc98061003d6000396000f3606060405236156100765760e060020a6000350462ce8e3e811461007b578063124b1789146100d25780636ced1ae9146101465780636f77926b146101cb5780637b7284fc146102a55780637f2a6a5c146102fc57806398575188146103655780639f6c935814610389578063eb6bbd78146103ad575b610000565b3461000057610088610407565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b3461000057610132600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509496505084359460208101359450604001359250610472915050565b604080519115158252519081900360200190f35b346100005761015660043561063d565b60405180806020018381526020018281038252848181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34610000576101db6004356106f7565b6040518080602001866000191681526020018560001916815260200184600019168152602001806020018381038352888181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561025d5780820380516001836020036101000a031916815260200191505b508381038252848181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f15090500197505050505050505060405180910390f35b3461000057610088610834565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b3461000057610132600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650509335935061089592505050565b604080519115158252519081900360200190f35b3461000057610132600435610ac0565b604080519115158252519081900360200190f35b3461000057610132600435610bb3565b604080519115158252519081900360200190f35b3461000057610088600435610c51565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60408051602081810183526000825260048054845181840281018401909552808552929392909183018282801561046757602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610449575b505050505090505b90565b33600160a060020a038116600090815260036020526040812054909190600260018216156101000260001901909116041580156104af5750855115155b1561062e57856003600083600160a060020a031681526020019081526020016000206000019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061051d57805160ff191683800117855561054a565b8280016001018555821561054a579182015b8281111561054a57825182559160200191906001019061052f565b5b5061056b9291505b808211156105675760008155600101610553565b5090565b5050600160a060020a038116600090815260036020819052604090912060018082018890556002820187905591018490556004805491820180825590919082818380158290116105e0576000838152602090206105e09181019083015b808211156105675760008155600101610553565b5090565b5b505050916000526020600020900160005b81546c01000000000000000000000000808602046101009290920a918202600160a060020a039092021916179055506001915061063356610633565b600091505b5b50949350505050565b6040805160208082018352600080835284815260018083528482208082015481548751600260001995831615610100029590950190911693909304601f8101869004860284018601909752868352949592949093909284918301828280156106e65780601f106106bb576101008083540402835291602001916106e6565b820191906000526020600020905b8154815290600101906020018083116106c957829003601f168201915b50505050509150915091505b915091565b6040805160208082018352600080835283518083018552818152600160a060020a038616825260038084528583206001808201546002808401549484015484548b519481161561010002600019011691909104601f8101899004890284018901909a52898352979895978897889794959294929391926004870192918791908301828280156107c75780601f1061079c576101008083540402835291602001916107c7565b820191906000526020600020905b8154815290600101906020018083116107aa57829003601f168201915b505050505094508080548060200260200160405190810160405280929190818152602001828054801561081957602002820191906000526020600020905b815481526020019060010190808311610805575b50505050509050945094509450945094505b91939590929450565b60408051602081810183526000825260028054845181840281018401909552808552929392909183018282801561046757602002820191906000526020600020905b815481526020019060010190808311610876575b505050505090505b90565b33600160a060020a0381166000908152600360205260408120549091906002600182161561010002600019019091160415610a9d57835115610a9d57600083815260016020819052604090912054600261010092821615929092026000190116041515610956576002805480600101828181548183558181151161093e5760008381526020902061093e9181019083015b808211156105675760008155600101610553565b5090565b5b505050916000526020600020900160005b50849055505b8360016000856000191681526020019081526020016000206000019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109ba57805160ff19168380011785556109e7565b828001600101855582156109e7579182015b828111156109e75782518255916020019190600101906109cc565b5b50610a089291505b808211156105675760008155600101610553565b5090565b505060008381526001602081815260408084204290840155600160a060020a0385168452600390915290912060040180549182018082559091908281838015829011610a7957600083815260209020610a799181019083015b808211156105675760008155600101610553565b5090565b5b505050916000526020600020900160005b508490555060019150610ab856610aa6565b60009150610ab8565b60019150610ab856610ab8565b600091505b5b5092915050565b6000805433600160a060020a03908116911614610adc57610000565b6003600083600160a060020a03168152602001908152602001600020600060008201805460018160011615610100020316600290046000825580601f10610b235750610b55565b601f016020900490600052602060002090810190610b5591905b808211156105675760008155600101610553565b5090565b5b506001820160009055600282016000905560038201600090556004820180546000825590600052602060002090810190610ba491905b808211156105675760008155600101610553565b5090565b5b505050600190505b5b919050565b6000805433600160a060020a03908116911614610bcf57610000565b600082815260016020819052604082208054838255909291839160026101009282161592909202600019011604601f819010610c0b5750610c3d565b601f016020900490600052602060002090810190610c3d91905b808211156105675760008155600101610553565b5090565b5b5050600060019182015590505b5b919050565b60408051602081810183526000808352600160a060020a03851681526003825283902060040180548451818402810184019095528085529293929091830182828015610cbc57602002820191906000526020600020905b815481526020019060010190808311610ca8575b505050505090505b91905056"info: Object__proto__: Object__proto__: Object

Now when I switch to mainnet, I get this instead:

setupProviderConnection originDomain: localhost
background.js:3974 request:
background.js:3975 Object {jsonrpc: "2.0", id: 1614631657147620, method: "eth_compileSolidity", params: Array[1]}id: 1614631657147620jsonrpc: "2.0"method: "eth_compileSolidity"params: Array[1]__proto__: Object
background.js:3976 response: 
background.js:3977 Object {id: 1614631657147620, jsonrpc: "2.0", result: undefined, error: Object}error: Objectid: 1614631657147620jsonrpc: "2.0"result: undefined__proto__: Object__defineGetter__: __defineGetter__()__defineSetter__: __defineSetter__()__lookupGetter__: __lookupGetter__()__lookupSetter__: __lookupSetter__()constructor: Object()hasOwnProperty: hasOwnProperty()isPrototypeOf: isPrototypeOf()propertyIsEnumerable: propertyIsEnumerable()toLocaleString: toLocaleString()toString: toString()valueOf: valueOf()get __proto__: __proto__()set __proto__: __proto__()

I wonder if there is some way I can manually test that jsonrpc against a host...

@Tectract
Copy link
Author

web3.eth.getCompilers is failing, returning null against mainnet.

I'm guessing that could be a big part of the issue...

@danfinlay
Copy link
Contributor

Closing as a duplicate of #1493. We never have supported compiler methods, and neither does Infura, our provider. Those methods are being deprecated from the providers, so should not be relied on, you should bring your own compiler in your software, since nobody else knows which compiler to provide.

@danfinlay
Copy link
Contributor

Apparently our providers lost this functionality when it was removed from the major clients:
ethereum/go-ethereum#3793

@danfinlay
Copy link
Contributor

Also: ethereum/EIPs#209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants