Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Cannot migrate to custom blockchain since [email protected] #3957

Closed
1 task
thecodingshrimp opened this issue Mar 31, 2021 · 11 comments
Closed
1 task

Cannot migrate to custom blockchain since [email protected] #3957

thecodingshrimp opened this issue Mar 31, 2021 · 11 comments

Comments

@thecodingshrimp
Copy link

thecodingshrimp commented Mar 31, 2021


Issue

When trying to migrate via truffle to a custom blockchain (using openethereum) I get an error saying:

Error:  *** Deployment Failed ***

"Migrations" received: Returned error: Invalid params: unknown field `chainId`, expected one of `type`, `from`, `to`, `gasPrice`, `gas`, `value`, `data`, `nonce`, `condition`, `accessList`..
   * This error is common when Infura is under heavy network load.
   * Try: setting the 'confirmations' key in your network config
          to wait for several block confirmations between each deployment.

    at /home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Migration._deploy (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
    at Migration._load (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
    at Migration.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:228:1)
    at Command.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)

Steps to Reproduce

  • truffle init
  • start custom blockchain docker container with the config files here with docker-compose up
  • truffle migrate with the network configuration pointing to custom blockchain, e.g. in truffle-config.js:
    ....
    chain: {
        host: "127.0.0.1",
        port: 8545,
        network_id: "*"
    },
    ....
    

Expected Behavior

Successful migration of Migrations.sol

Actual Results

migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'development'
> Network id:      17
> Block gas limit: 8000000 (0x7a1200)


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------

Error:  *** Deployment Failed ***

"Migrations" received: Returned error: Invalid params: unknown field `chainId`, expected one of `type`, `from`, `to`, `gasPrice`, `gas`, `value`, `data`, `nonce`, `condition`, `accessList`..
   * This error is common when Infura is under heavy network load.
   * Try: setting the 'confirmations' key in your network config
          to wait for several block confirmations between each deployment.

    at /home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Migration._deploy (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
    at Migration._load (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
    at Migration.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:228:1)
    at Command.run (/home/leo/Desktop/test_folder/test_folder/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)

Environment

  • Operating System: Ubuntu 18.04
  • Ethereum client: Openethereum
  • Truffle v5.2.6 (core: 5.2.6)
  • Node v14.15.4
  • npm 6.14.10
@gnidan
Copy link
Contributor

gnidan commented Mar 31, 2021

Thanks for reporting this! Could you try upgrading to Truffle v5.3.0 to see if this release fixes the issue for you?

@thecodingshrimp
Copy link
Author

Thanks for the fast reply!

Unfortunately the new release doesn't fix the issue. I'm getting the same error when trying to migrate.

@eggplantzzz
Copy link
Contributor

eggplantzzz commented Apr 2, 2021

Ok thanks very much @thecodingshrimp! I'll try and reproduce your error on my side and figure out what's going on.

I wonder why your error message includes something about Infura...

@eggplantzzz
Copy link
Contributor

I think there may be some more configuration necessary...the docker-compose.yml that you listed has some absolute paths that imply that there are extra setup steps? I get an error when trying to run docker-compose up in that directory. Will you advise?

@thecodingshrimp
Copy link
Author

thecodingshrimp commented Apr 3, 2021

Under volumes I map the current directory (where the docker-compose.yml file is located) to the absolute path /home/openethereum/.local/share/openethereum inside the openethereum container, which should be present. It shouldn't use any absolute path on your system.

Did you make sure that you have config.toml, keys and verismart-spec.json present in the current directory?

I just tested it by copying the whole folder chain from the provided link above (also here to a new location and starting it and it works.

I also provide you with a zip of the directory for an easier download experience: chain.zip

If the error persists, could you provide the error message so that I can provide better feedback?

@eggplantzzz
Copy link
Contributor

Ok I was able to get it working and reproduce your error! Thanks again for the steps.

So this is kind of problematic because chainId was added in order to make Truffle send transactions that were EIP-155 compliant. Geth recently made updates that disallowed transactions that weren't compliant. Without the chain id being available when sending transactions, Truffle will not play well with Geth out of the box. I wonder if there is some soret of option for ignoring options it doesn't expect... Passing chainId to web3 I believe is a bit non-standard (which is what openethereum is complaining about), offhand I'm not sure how web3 wants you to pass that info along.

I'm not sure what we need to do about this at present, let me talk with some teammates. Some more research may be needed to find the proper solution for this.

@thecodingshrimp
Copy link
Author

Thanks for the update!

Yeah it really felt like the communication between truffle/web3 and openethereum was the problem.

Since openethereum is based on parity, do you think that the issue could be that parity didn't implement EIP 155 and doesn't know how to handle the request from web3?

I assume that truffle already uses different handlers for different Ethereum clients since it supports multiple clients and that there are also tests for that. But maybe the issue is that truffle treats openethereum as a geth client instead of a parity one? Is infura based on geth? Because then it would makes sense why the error message mentions infura.

If thats the issue, then maybe the solution shouldn't be that bad right?

Just my thoughts on this.

@eggplantzzz
Copy link
Contributor

No, Truffle treats all Nodes equally. They do have different behavior but share a common interface so that client computers can communicate with them (JSON RPC).

I think Infura Nodes mostly run Geth? We'll have to do some more research on this like I mentioned. I'm still puzzled as to why the error message received here mentions Infura - very strange. Is it somehow interacting with Infura somehow?

@thecodingshrimp
Copy link
Author

Not to my knowledge. Our chain should be local only - no connection to the outside world. We use this chain only to test our code independently.

@eggplantzzz
Copy link
Contributor

Ok, after doing some research I think I found the proper fix for this. It runs successfully against your docker image with OpenEthereum. I'll try to get it in next week's release!

@haltman-at
Copy link
Contributor

The fix for this should be out now, closing.

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

No branches or pull requests

4 participants