pyquarkchain icon indicating copy to clipboard operation
pyquarkchain copied to clipboard

Support collecting root block coinbase in other native tokens

Open ninjaahhh opened this issue 5 years ago • 7 comments

which is not supported right now (using hard-coded genesis token):

https://github.com/QuarkChain/pyquarkchain/blob/c3a76bc0527387a606b87a87b0706b929d88c95b/quarkchain/cluster/shard_state.py#L94-L123

that's why even this root block has QTSLA token in coinbase (which comes from tx fee), the root block miner didn't collect it

ninjaahhh avatar Apr 11 '19 02:04 ninjaahhh

ahh, right, now I remember missing this part... looks to me CrossShardTransactionDeposit shall encode a map of tokens. But this map mostly would contain just one entry (from x-shard transactions) and just rarely contain multiple tokens as a result of tokens in coinbase like in the example above

qcdll avatar Apr 11 '19 17:04 qcdll

This will be a problem for current code with multiple tokens, but since we only support one token (QKC) at the monent, we should be fine.

In the future, we will implement PoSW in rootchain, which means

  • all coinbase rewards will be stored on roothchain db,
  • a user of rootchain must explicitly transfer its balance (one token) to a shard which automatically address the problem.

qizhou avatar Apr 11 '19 23:04 qizhou

@qizhou should we re-prioritize this task to post-1.1 or even post-1.2? since in the near future we only have QKC token

ninjaahhh avatar Jun 12 '19 22:06 ninjaahhh

Agree.

qizhou avatar Jun 13 '19 14:06 qizhou

we should make CrossShardTransactionDeposit use token balance map to fix this issue

https://github.com/QuarkChain/pyquarkchain/blob/master/quarkchain/core.py#L1100

ninjaahhh avatar Aug 21 '19 08:08 ninjaahhh

We may just have the cursor to return multiple deposits with different transfer token IDs.

qizhou avatar Aug 21 '19 16:08 qizhou

We may just have the cursor to return multiple deposits with different transfer token IDs.

agree. in this way it will not be a breaking change (because we don't have other tokens for now)

ninjaahhh avatar Sep 30 '19 18:09 ninjaahhh