thehubbleproject / hubble-contracts

Hubble optimistic rollup
https://thehubbleproject.github.io/docs/
MIT License
133 stars 28 forks source link

Add tokenID to feeReceiverID mapping config #557

Closed ChihChengLiang closed 3 years ago

ChihChengLiang commented 3 years ago

What's wrong

To serve tokenA, the coordinator needs to own a state leaf of tokenA to collects the fees. When running the coordinator client, the client should be configured with a mapping of what tokenID to what stateID.

How can we fix it?

Create an interface (Feel free to rename)

interface FeeReceiverConfig {
   getFeeReceiver(tokenID: number): number
}

Which belongs to ClientConfigs

interface ClientConfigs {
    feeReceiverConfig: FeeReceiverConfig
    ...
}

Create a config that can be loaded by the nodes. (We could defer this if we want to hardcode everything)

{
  #tokenID: stateID
  0: 1,
  1: 100,
}
jacque006 commented 3 years ago

Note, more general configuration is also likely needed for RPC port, ETH client ip/port/url/connection, and other options. This will also be needed for any assets we release (Docker, npm, etc.)

jacque006 commented 3 years ago

As part of this work, we should also validate that the config is correct and throw a very specific error is a config option is missing or malformed.

jacque006 commented 3 years ago

After completing this and confirming Docker based image can run successfully, update DockerHub Overview at https://hub.docker.com/r/thehubbleproject/node (and potentially automate syncing with GitHub README.md) with instructions on how to run container.