Skip to content

Peggy & Peggo Testing

Aleksandr Bezobchuk edited this page Oct 28, 2021 · 9 revisions

Peggy and Peggo Testing

This document outlines a high level overview of testing the integration of Peggy, the Gravity Bridge variant by InjectiveLabs, and Peggo, the Golang-based Peggy orchestrator.

We'll outline this document in three core areas:

  1. Bootstrapping the network as a validator
  2. Joining an already bootstrapped network
  3. A general FAQ

NOTE: Peggy was forked from InjectiveLabs and is still under heavy development and refactoring. CLI arguments and other logic is subject to change.

Bootstrapping as a Validator

  1. Install the latest v0.4.x version of umeed. At the time of this writing, only

  2. RC1 exists.

  3. Compile and build from source our forked version of Peggo via $ make install

  4. Ensure you have the following:

    1. A connection to a Goerli Ethereum RPC node (e.g. https://goerli.infura.io/v3/c50fadef84e24055a2e003d2389466c0)
    2. A Goerli Ethereum account and the associated private key (in HEX)
    3. A umeed keyring setup with an account that will operate as the validator operator.
  5. A designated coordinator must deploy the Peggy contract:

    $ peggo bridge deploy-peggy --eth-pk=$ETH_PK --eth-rpc=$ETH_RPC
  6. Observe the output of the previous command. It will display the Ethereum transaction and the Peggy contract address. Wait until the Ethereum transaction is committed and observe the height at which it was committed.

  7. Once the Peggy transaction is committed, the designated coordinator updates or creates the Umee genesis file. In the context of Peggy, the following fields should be populated:

    "params": {
       "bridge_ethereum_address": "...",
       "bridge_contract_start_height": "...",
       "bridge_chain_id": ""
    }
  8. Once the Umee genesis file is finalized. The Umee chain can start.

  9. After starting the Umee chain, each bootstrapping validator must register their Ethereum key:

    $ peggo tx register-eth-key \
      --cosmos-chain-id="..." \
      --cosmos-grpc="tcp://..." \
      --tendermint-rpc="http://..." \
      --cosmos-keyring=... \
      --cosmos-keyring-dir=... \
      --cosmos-from=... \
      --eth-pk=$ETH_PK
  10. Once each validator has registered their Ethereum key, the designated coordinator must initialize the Peggy contract:

    $ peggo bridge init-peggy --eth-pk=$ETH_PK --eth-rpc=$ETH_RPC
  11. At this point, each validator can start their Peggo orchestrator process:

$ peggo orchestrator \
  --eth-pk=$ETH_PK \
  --eth-rpc=$ETH_RPC \
  --relay-batches=true \
  --relay-valsets=true \
  --eth-chain-id=... \
  --cosmos-chain-id=... \
  --cosmos-grpc="tcp://..." \
  --tendermint-rpc="http://..." \
  --cosmos-keyring=... \
  --cosmos-keyring-dir=... \
  --cosmos-from=...

NOTE: Before any token is transferred, the designated coordinator must first send and ERC20 transfer to an Umee address. This is so the Peggy module sees an Ethereum event for the first time.

See $ peggo bridge send-to-cosmos for help.

Any ERC20 token can be used for this step. But prior to sending the token, the ERC20 contract must have the Peggy contract address approved with the appropriate WAP populated (e.g. max UINT256).

Example: https://goerli.etherscan.io/token/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6?a=0x4e13C68C22b46C47fb4cFB12492A56a2124902d3#writeContract

Joining a Bootstrapped Network

Assuming a network has already been bootstrapped and you've already created your validator, you only need to register your Ethereum key and start the Peggo orchestrator. Perform steps (9) and (11) from above.

Peggo should notice changes in the validator set and relay these to the Peggy contract on Ethereum.

FAQ

  1. Can any Cosmos naive or Ethereum ERC20 token be transferred?

    Yes, but the Peggy module must be initialized first. Please see the note from the bootstrapping section. Once this happens, any ERC20 can be transferred to and from Umee.

    See $ peggo bridge send-to-cosmos --help for help on how to send tokens from Ethereum to Cosmos.

    Any Cosmos native can be transferred to and from Ethereum, but the Cosmos native asset must be first deployed as an ERC20.

    See $ umeed tx peggy send-to-eth --help for help on how to send tokens from Cosmos to Ethereum.

Clone this wiki locally