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

"Invalid address" error when deploying #146

Closed
vkomenda opened this issue Jan 31, 2019 · 13 comments
Closed

"Invalid address" error when deploying #146

vkomenda opened this issue Jan 31, 2019 · 13 comments
Assignees

Comments

@vkomenda
Copy link

I'm trying to run node deploy.js in the develop branch with the .env provided below. Whatever I do, there are always invalid addresses 0x in the output. What am I doing wrong?

$ node deploy.js
================================
 Invalid environment variables:
    FOREIGN_BRIDGE_OWNER: Invalid address: 0x
    FOREIGN_VALIDATORS_OWNER: Invalid address: 0x
    FOREIGN_UPGRADEABLE_ADMIN: Invalid address: 0x
    VALIDATORS: Invalid address: 0x
    BLOCK_REWARD_ADDRESS: Invalid address: 
 Missing environment variables:
    DEPLOY_REWARDABLE_TOKEN: undefined
    DPOS_VALIDATOR_SET_ADDRESS: undefined

 Exiting with error code 1
================================

Here is my .env:

BRIDGE_MODE=NATIVE_TO_ERC
# ERC20 token account 0x63c7c042cfca29ab43b1b6a7bd33e9267528e78f
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=f4702d2334679ddc164507fe4a5854d751da36b296d533961df314393fe332c8
DEPLOYMENT_GAS_LIMIT=5000000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=3000

BRIDGEABLE_TOKEN_NAME=Test PoS Token
BRIDGEABLE_TOKEN_SYMBOL=TEST
BRIDGEABLE_TOKEN_DECIMALS=18

HOME_RPC_URL=http://127.0.0.1:8541
HOME_BRIDGE_OWNER=0xbbcaa8d48289bb1ffcf9808d9aa4b1d215054c78
HOME_VALIDATORS_OWNER=0xbbcaa8d48289bb1ffcf9808d9aa4b1d215054c78
HOME_UPGRADEABLE_ADMIN=0xbbcaa8d48289bb1ffcf9808d9aa4b1d215054c78
HOME_DAILY_LIMIT=30000000000000000000000000
HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=500000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000

#for bridge erc to native mode
BLOCK_REWARD_ADDRESS=0x63c7c042cfca29ab43b1b6a7bd33e9267528e78f

FOREIGN_RPC_URL=http://127.0.0.1:8542
FOREIGN_BRIDGE_OWNER=0x75df42383afe6bf5194aa8fa0e9b3d5f9e869441
FOREIGN_VALIDATORS_OWNER=0x75df42383afe6bf5194aa8fa0e9b3d5f9e869441
FOREIGN_UPGRADEABLE_ADMIN=0x75df42383afe6bf5194aa8fa0e9b3d5f9e869441
FOREIGN_DAILY_LIMIT=15000000000000000000000000
FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=500000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=8
FOREIGN_GAS_PRICE=10000000000
#for bridge erc_to_erc and erc_to_native mode
ERC20_TOKEN_ADDRESS=

REQUIRED_NUMBER_OF_VALIDATORS=1
#If several validators are used, list them separated by space without quotes
#E.g. VALIDATORS=0x 0x 0x
VALIDATORS=0xbbcaa8d48289bb1ffcf9808d9aa4b1d215054c78 0x75df42383afe6bf5194aa8fa0e9b3d5f9e869441 0x522df396ae70a058bd69778408630fdb023389b2
@patitonar
Copy link
Contributor

I tried running node deploy.js on develop branch using your .env

I only got some of the errors you mentioned:

================================
 Missing environment variables:
    DEPLOY_REWARDABLE_TOKEN: undefined
    DPOS_VALIDATOR_SET_ADDRESS: undefined

 Exiting with error code 1
================================

To fix this, you can add to .env:

DEPLOY_REWARDABLE_TOKEN=false
DPOS_VALIDATOR_SET_ADDRESS=0x0000000000000000000000000000000000000000

@vkomenda
Copy link
Author

vkomenda commented Feb 1, 2019

Today I cannot even reach variable instantiation. node deploy.js fails earlier at the web3 import:

deploy/src/loadEnv.js:5
const { isAddress, toBN } = require('web3').utils
        ^

TypeError: Cannot destructure property `isAddress` of 'undefined' or 'null'.

@patitonar
Copy link
Contributor

Do you have the dependencies from /deploy installed?

Here are steps from a clean install you can test:

  1. git clone git@github.com:poanetwork/poa-bridge-contracts.git

  2. cd poa-bridge-contract

  3. git checkout develop

  4. npm install

  5. npm run compile

  6. cd deploy

  7. npm install

  8. Add .env file

  9. node deploy.js

Node.js version 8.9

@vkomenda
Copy link
Author

vkomenda commented Feb 1, 2019

Sorry, only getting more errors. With the upstream package-lock.json files I'm getting npm compile errors on the package sha3. Without those files npm i finishes OK, but npm run compile fails due to Solidity compiler version mismatch:

poa-bridge-contracts/contracts/ERC677.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.4.25+commit.59dbf8f1.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.4.24;
^---------------------^

@patitonar
Copy link
Contributor

can you try removing node_modules and deploy/node_modules folders before npm i?

@vkomenda
Copy link
Author

vkomenda commented Feb 1, 2019

Yes, I did that. My Node version 10.15.0 might be to blame.

@patitonar
Copy link
Contributor

Right, I think Node.js version could be the problem. Please try using version 8 which is described on deploy/.nvmrc file. You can use nvm to handle different Node.js versions

@DemiMarie
Copy link

@patitonar Can we fix the code to be compatible with node 10? Fedora 29 comes with it.

@akolotov
Copy link
Collaborator

akolotov commented Feb 1, 2019

@DemiMarie can you use docker to deploy contracts? in this case you will not have issues with the JS modules compatibility. I insist of appearing the docker deployment environment exactly for this reason

@DemiMarie
Copy link

DemiMarie commented Feb 1, 2019 via email

@patitonar
Copy link
Contributor

@DemiMarie Sure, a PR to make it work with Node 10 too is welcome

@akolotov
Copy link
Collaborator

Addressed by #154 in the develop branch. @vkomenda please check.

@vkomenda
Copy link
Author

Confirmed. Deployment environment configuration seems to work OK in develop with Node 10.15.1.

@ghost ghost removed the review label Feb 19, 2019
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

5 participants