Skip to content

Gravity bridge integration to a custom chain considerations #345

@iTiky

Description

@iTiky

I've tried to integrate the Gravity bridge into our Cosmos-based chain and did some Ganache-cli local testing.
Overall it worked, but I've faced some issues I'd like to share.

  1. Cosmos Gas limit for Tx

    By default, it is set to 500_000_000u64.
    That is a huge value (we have a default limit of 1M).
    Cosmos errors don't tell you much why the Tx didn't pass through (the only way is to enable debug logs on the Cosmos side), so it took some time to debug.
    I think it would be a good idea to make it configurable on the orchestrator side.

  2. Ganache crashes and VM errors

    All the problems I've faced were about missing / huge Gas limits for Txs to the Ethereum node.

    For example:

    • deploy_erc20 (client)
      • I had to add Gas price, limit and multiplier to the call;
    • estimate_valset_cost, estimate_tx_batch_cost
      • I had to replace the let gas_limit = min((u64::MAX - 1).into(), our_balance.clone()); line to let gas_limit: Uint256 = 100000u64.into();;
      • I didn't dig into the problem, but I assume it is an int64 overflow when Ganache tries to multiply the Gas limit to Gas price;

    I'm not an Ethereum expert and those problems might be only Ganache related, but I thought it might be usefull to share.

  3. Cosmos gRPC protobuf

    Facing gRPC transport errors (orchestrator <-> Cosmos) I had to rebuild and replace the gravity.v1.rs using the orchestrator/proto_build script.
    That one is a bit strange as my quick look through the diff didn't show much of a difference, but it worked.

  4. Custom CosmosERC20 contract deployer

    Two problems here with an existing deployer (Gravity.sol contract and orchestrator/client):

    • _mint(_gravityAddress, MAX_UINT) mints tokens to the Gravity contract address by default, I've changed the constructor argument to msg.Sender;
    • An additional IncreaseAllowance call have to be made to enable the Eth -> Cosmos transfer for a particular Eth account;
  5. Orchestrator startup crash

    As I see, it's been already fixed: not initialized contact variable within the create_rpc_connections func.

  6. Custom Cosmos bech32 prefix

    We're using a custom prefix (not cosmos) for the account address prefix.
    That was fixed a few days ago too.

I hope this report might be helpful. I'd be happy to share more on my future integration attempts if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions