-
Notifications
You must be signed in to change notification settings - Fork 13
Initialize user accounts for block generators / Fees in sidechains #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far looks good. But I suppose we are waiting for the conclusion on the GitHub discussion.
Also, in my opinion, it would be nice to do the cosmetic changes in a separate PR (if they are a lot) to avoid the large diff.
@vjaiman @gkoumout As I already informed Greg, I didn't know how to make the new Token module method |
This reverts commit f5f929c.
…ekd for LIP71 added" This reverts commit b0ae9f9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job Miroslav. I have left few changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job Miroslav! I left some comments here and there that could be improved, but I think we are in a good stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions. I will update the PR with a new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done Miroslav! Just few minor comments. The only thing remaining to finalize is the initialization of ADDRESS_FEE_POOL
account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, Miroslav!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found also one broken link, need to fix it before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done Miroslav!
This PR aims at solving the following issues:
Initialize user accounts for block generators
Problem statement
It is possible for sidechains that, while assigning rewards to block generator (either block rewards or unburned transaction fees), a user account for the corresponding token (reward/ fee token) does not exist for the generator, leading to this generator being unable to add blocks.
Proposed solution
In LIP 0042 and LIP 0071: In
afterTransactionsExecute
, only mint tokens if the corresponding block generator account is initialized (either forTOKEN_ID_REWARD
orTOKEN_ID_DYNAMIC_BLOCK_REWARD
). If not, emit the event stating that no account is initialized.In LIP 0048: In
afterCommandExecute
, distinguish the following cases:generatorAddress
initializedgeneratorAddress
not initializedADDRESS_FEE_POOL
exists and is initialized
ADDRESS_FEE_POOL
existsADDRESS_FEE_POOL
ADDRESS_FEE_POOL
does not exist or is not initialized
ADDRESS_FEE_POOL
does not existFees in sidechains
Problem statement
Solve the problems related to using LSK as default token for fees in a sidechain, e.g:
Is it actually possible to use LSK as default token for fees in a sidechain? To bring LSK tokens to the sidechain to begin with you have in general to pay the transaction fee of the CCU.
As discussed, the following issues were detected:
The
verify
hook in the block processing of the Fee module would fail ifMIN_FEE_PER_BYTE > 0
,TOKEN_ID_FEE
is the LSK token ID and the trs sender does not yet have any LSK on the sidechain.The account initialization in the CCU execution for the relayer may fail if the relayer account is not initialized and the account does not hold enough LSK (see
if ccu.params.inboxUpdate is not empty
check in LIP53).Proposed solution
In Lip 0048, in the block processing
verify
hook: Allow forMIN_FEE_PER_BYTE = 0
for aMAX_BLOCK_HEIGHT_ZERO_FEE_PER_BYTE
number of blocks after the genesis block.This is not a protocol-related issue and would only be documented in the guidances for sidechains as something to keep in mind when creating the genesis block (e.g., "Set the LSK balance to 0 for all initial validators, so they can act as initial relayers").