omni / poa-bridge

POA <-> Ethereum bridge for self transfers of POA native token to POA20 (ERC20 representation). Not supported. Use TokenBridge instead
https://github.com/poanetwork/token-bridge
GNU General Public License v3.0
80 stars 38 forks source link

Simplify bridges deployment by creation contracts with the same address #10

Closed akolotov closed 6 years ago

akolotov commented 6 years ago

Currently it is assumed that in order to achieve more security at least 3 bridge instances need to be deployed on different independent systems.

The deployment process of several bridges now is the following:

  1. Configure and run the first instance of the bridge.
  2. Distribute the database toml-file created by the first bridge to other nodes. This file contains addresses of bridge contracts deployed by the first instance, so other instances needs to work with these contracts as well.
  3. As soon as the database file is the same on every nodes, they could be run.

Proposal for changes:


Simplfy deployment process with creation of the bridge contracts with the same address in Home and Foreign networks. It could be achived by using the same address and the same NOnce for the contracts deployment in both networks. Since in most cases it requires to create new account with new keystore/private key, so, there is a neccessity to manage this keystore/private key. That's why another approach could be to use deployment transactions with hardcoded signature as it is implemented here: https://github.com/jbaylina/eip820/blob/master/js/deployment.js#L7-L25 (ability to do this in different networks confirmed in https://gist.github.com/akolotov/7b27902d196da15fde63fd4a484cb407).

It will allow:

Automatic generation of the database file and changes in the contracts will be covered in separate issues.

Changes required:


  1. Modify cli/src/main.rs to support command deploy to send contracts deployment transactions to the networks and exit. The database toml-file must be generated after the command execution.
  2. Modify bridge/src/bridge/deploy.rs to deploy contracts with the same address.
akolotov commented 6 years ago

not applicable since the contract deployment is not responsibility of Rust code any more.