thehubbleproject / hubble-contracts

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

Proposer adds new fee reciever when token is registered. #608

Open jacque006 opened 3 years ago

jacque006 commented 3 years ago

What's wrong

When a proposer is running, it will have a list of tokenIDs to stateIDs indicating where transaction fees are sent. However, if a new token is registered while it is running, it will not be able to handle that token until a new state leaf is added on L1 and its config is updated.

How can we fix it?

Have proposers listen for the TokenRegistry's RegisteredToken event (https://github.com/thehubbleproject/hubble-contracts/blob/master/contracts/TokenRegistry.sol#L75) and have the proposer deposit a new state leaf for that tokenID. The proposer should then update its internal configuration with the new fee receiver.

This proposer feature should be hidden behind a configuration flag in case a node operator does not want to automatically update their token list and wishes to do so manually.