ensdomains / ens

Implementations for ENS core functionality: The registry, registrars, and public resolvers.
https://ens.domains/
BSD 2-Clause "Simplified" License
1.16k stars 511 forks source link

Unable to deploy DefaultReverseResolver and ReverseRegistrar #291

Open ngyam opened 6 years ago

ngyam commented 6 years ago

OS: Ubuntu 16.04.5 LTS
node: v8.11.3
npm: 6.2.0
Truffle: v4.1.13
solc: 0.4.24+commit.e67f0147.Linux.g++
Parity: v2.1.0-nightly-4848c38-20180723

Problem

I was trying to deploy the ENS contracts on Tobalaba network (Parity client, PoA) using Truffle. Deployment goes well up until the point it gets to the DefaultReverseResolver, then it fails:

  Deploying DefaultReverseResolver...
  ... 0x9be46cdae48bf1d427c471e33acf634472fbc3f0cb3898581a694279b0d57900
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:147:1)
    at /home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:225:1
    at /home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/home/aznagy/.npm-global/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

What did I do

  1. cloned github repo
  2. modified the deployment procedure in 2_deploy_contracts.js with the following (owner is my account address):
// Deploy the ENS first
deployer.deploy(ENS)
.then(() => {
    // Deploy the FIFSRegistrar and bind it with ENS
    return deployer.deploy(FIFSRegistrar, ENS.address, rootNode.namehash);
})
.then(function() {
    // Transfer the owner of the `rootNode` to the FIFSRegistrar
    return ENS.at(ENS.address).setSubnodeOwner('0x0', rootNode.sha3, FIFSRegistrar.address, {from: owner});
})
.then(() => {
    // Deploy public resolver
    return deployer.deploy(PublicResolver, ENS.address);
})
.then(() => {
    // Deploy reverse resolver
    return deployer.deploy(DefaultReverseResolver, ENS.address);
})
.then(() => {
    // Deploy reverse registrar
    return deployer.deploy(ReverseRegistrar, ENS.address, PublicResolver.address, {from: owner});
})
.then(() => {
    // Set up owners
    return ENS.at(ENS.address).setSubnodeOwner('0x0', reverseNode.sha3, owner, {from: owner});
})
.then(() => {
    return ENS.at(ENS.address).setSubnodeOwner(reverseNode.namehash, addrNode.sha3, ReverseRegistrar.address, {from: owner});
});
  1. Then:

    truffle migrate --network dev.fifs --reset

What else did I try

Am I missing something important? Not sure if I did everything right, since I get the same issue on all these networks.

ghost commented 6 years ago

@ngyam Hello, may I ask which function do you use for reverseNode??

ngyam commented 6 years ago

Hi @eosclassicteam sorry for not replying for so long I was using getRootNodeFromTLD which was already there.

/**
 * Calculate root node hashes given the top level domain(tld)
 *
 * @param {string} tld plain text tld, for example: 'eth'
 */
function getRootNodeFromTLD(tld) {
  console.log(web3.utils.sha3(tld))
  return {
    namehash: namehash(tld),
    sha3: web3.utils.sha3(tld)
  };
}

...

var reverseNode = getRootNodeFromTLD('reverse');
var addrNode = getRootNodeFromTLD('addr');
ngyam commented 6 years ago

Strangely enough, the deployment was successful for a colleague who had

Parity 1.11.6 Beta
Truffle 4.1.3 (solc 0.4.19)

installed. I also reverted my Parity version to this older one and the deployment magically worked.

I guess it is was a Parity client issue then, but curious if anyone had similar experiences.