darwinia-network / bridger

Relayer client implementation for Darwinia LCMP protocols.
https://rust-docs.darwinia.network/bridger
GNU General Public License v3.0
11 stars 10 forks source link

New config schema #129

Closed wuminzhe closed 3 years ago

wuminzhe commented 3 years ago
ethereum:
  rpc: https://ropsten.infura.io/v3/60703fcc6b4e48079cfc5e385ee7af80
  contract:
    ring:
      address: 0xb52FBE2B925ab79a821b261C82c5Ba0814AAA5e0
      topics:
        - 0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10
    kton:
      address: 0x1994100c58753793D52c6f457f189aa3ce9cEe94
      topics:
        - 0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10
    bank:
      address: 0x6EF538314829EfA8386Fc43386cB13B4e0A67D1e
      topics:
        - 0xe77bf2fa8a25e63c1e5e29e1b2fcb6586d673931e020c4e3ffede453b830fb12
    issuing:
      address: 0x49262B932E439271d05634c32978294C7Ea15d0C
    relay:
      address: 0xc8d6c331030886716f6e323ACB795077eB530E36
      topics:
        - 0x91d6d149c7e5354d1c671fe15a5a3332c47a38e15e8ac0339b24af3c1090690f
  # the person who will relay darwinia data to ethereum
  relayer:
    private_key: 0x...
  # the person who will ecdsa sign new mmr root or new authority set
  authority:
    private_key: 0x... # the signature will be submitted to Darwinia by darwinia.relayer

darwinia:
  rpc: wss://crab.darwinia.network
  # the person who will relay ethereum data to darwinia
  relayer:
    private_key: 0x...
    # real account public key
    real_account: Optional(0x...)
  beneficiary_account: Optional(0x...(darwinia public key) | 5... (darwinia address))

shadow:
  endpoint: http://106.75.250.136:3000

services:
  ethereum:
    step: 30
  relay:
    step: 60
  redeem:
    step: 90
  guard:
    step: 30
wi1dcard commented 3 years ago
ethereum:
  rpc: 'https://ropsten.infura.io/v3/60703fcc6b4e48079cfc5e385ee7af80'
  contract:
    ring:
      address: '0xb52FBE2B925ab79a821b261C82c5Ba0814AAA5e0'
      topics:
        - '0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10'
    kton:
      address: '0x1994100c58753793D52c6f457f189aa3ce9cEe94'
      topics:
        - '0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10'
    bank:
      address: '0x6EF538314829EfA8386Fc43386cB13B4e0A67D1e'
      topics:
        - '0xe77bf2fa8a25e63c1e5e29e1b2fcb6586d673931e020c4e3ffede453b830fb12'
    issuing:
      address: '0x49262B932E439271d05634c32978294C7Ea15d0C'
    relay:
      address: '0xc8d6c331030886716f6e323ACB795077eB530E36'
      topics:
        - '0x91d6d149c7e5354d1c671fe15a5a3332c47a38e15e8ac0339b24af3c1090690f'

darwinia:
+ rpc: 'wss://crab.darwinia.network'

shadow:
+ endpoint: 'http://106.75.250.136:3000'

e2d: 
  relayer:
-   seed: '0x...'
+   account_private_key: '0x...'
    proxy: false
-   real_account: ''
+   real_account_public_key: ''

d2e:
  relayer:
-   seed: '0x...'
+   account_private_key: '0x...'
-   beneficiary: '0x..'
+   beneficiary_public_key: '0x..'
  authority:
-   seed: '0x...'
+   account_private_key: '0x...'

services:
  ethereum:
+   enabled: true
    step: 30
  relay:
+   enabled: true
    step: 60
  redeem:
+   enabled: true
    step: 90
  guard:
+   enabled: true
    step: 30

Here's my idea:

  1. Use darwinia.rpc instead of darwinia. Use shadow.endpoint instead of shadow. That makes it easier to understand what should I fill in the fields (I believe users can't understand what should they expect with the name darwinia and shadow). It also helps add more fields in the future.
  2. Add _public_key and _private_key suffixes in field names.
  3. Add enabled field to services.
AlexChien commented 3 years ago
ethereum:
  xxx: 

改成

external_chain:
  name: 'Ethereum Mainnet'  #network display name
  chain_id: XXX #identifier
  genesis: YYY #genesis block hash to verify if we are on the correct chain; for a forked chain such as ETC, genesis block can refer to the first block at the forking point

这样是不是更通用些?

下面的e2dd2e倒是不用改,但是意义则发生变化,ExternalChain to DarwiniaDarwinia to ExternalChain

wuminzhe commented 3 years ago

@AlexChien 如果后面加了Substrate2Substrate的链后呢

wuminzhe commented 3 years ago

@wi1dcard The enabled will be added after services management added.

ethereum:
  rpc: 'https://ropsten.infura.io/v3/60703fcc6b4e48079cfc5e385ee7af80'
  contract:
    ring:
      address: '0xb52FBE2B925ab79a821b261C82c5Ba0814AAA5e0'
      topics:
        - '0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10'
    kton:
      address: '0x1994100c58753793D52c6f457f189aa3ce9cEe94'
      topics:
        - '0xc9dcda609937876978d7e0aa29857cb187aea06ad9e843fd23fd32108da73f10'
    bank:
      address: '0x6EF538314829EfA8386Fc43386cB13B4e0A67D1e'
      topics:
        - '0xe77bf2fa8a25e63c1e5e29e1b2fcb6586d673931e020c4e3ffede453b830fb12'
    issuing:
      address: '0x49262B932E439271d05634c32978294C7Ea15d0C'
    relay:
      address: '0xc8d6c331030886716f6e323ACB795077eB530E36'
      topics:
        - '0x91d6d149c7e5354d1c671fe15a5a3332c47a38e15e8ac0339b24af3c1090690f'

darwinia:
  rpc: 'wss://crab.darwinia.network'

shadow:
  endpoint: 'http://106.75.250.136:3000'

e2d: 
  relayer:
    account_private_key: '0x...'
    proxy: false
    real_account_public_key: ''

d2e:
  relayer:
    account_private_key: '0x...'
    beneficiary_public_key: '0x..'
  authority:
    ecdsa_signer_private_key: '0x...' # the result will be submitted to Darwinia by e2d.relayer

services:
  ethereum:
    step: 30
  relay:
    step: 60
  redeem:
    step: 90
  guard:
    step: 30
AlexChien commented 3 years ago

@AlexChien 如果后面加了Substrate2Substrate的链后呢

好像也没什么影响吧,哪部分会不适用?

wuminzhe commented 3 years ago

ExternalChain有可能不是一个,而是多个,此时是跑多个bridger还是一个bridger?我还没有想清楚

AlexChien commented 3 years ago

bridger 应该是可以选择维护桥头堡的一头或者桥的两头,但一定不会要维护所有的桥。所以一个配置文件配置一头或者两头最多了。

wi1dcard commented 3 years ago

real_account_id 不然直接叫 real_account(因为后续可能支持其它格式),然后 beneficiary 改叫 beneficiary_account 这样就不会引入一个新的 beneficiary 的概念了,把这个转嫁成为 account,正好与 real_account 后缀对应。

hackfisher commented 3 years ago

bridger 应该是可以选择维护桥头堡的一头或者桥的两头,但一定不会要维护所有的桥。所以一个配置文件配置一头或者两头最多了。

This can be archived by splitting the tasks after refactor, and config can split as result.