The x/assets module should load the genesis state from disk for the network to successfully bootstrap with the rPOS process. This pull request makes that happen.
The client chain tokens (with 0 deposit value, since deposits are handled in the next bullet item)
The deposits (delegated and available-to-delegate both) by each staker for each registered token (or assumed 0 otherwise).
The stateless validation follows this algorithm:
There are no duplicate client chains.
There are no tokens for which we don't have a client chain.
The basic info for a token (everything but the amount deposited) is not nil.
The tokens have an Ethereum-style case-insensitive hex address (this check could be removed in the future). From this address, we derive the assetID which is always in lower case.
There are no duplicate entries for the tokens.
The token entries have no deposit value (but the staker entries may, which are added to the 0 value for that asset).
The token supply is not nil and is positive.
For each staker deposit entry, we check:
The stakerID is valid: lowercase, exactly one underscore, with the left side of the underscore non-empty and a hex address, and the right side a hex uint64.
There are no duplicate entries for a stakerID
Within each list of deposits indexed by assetID per stakerID, we check for each assetID:
There are no duplicate entries for an assetID within the list of deposits for said stakerID.
The assetID is registered previously in the tokens list.
All the values (deposited, withdrawable and pending unbonding) are supplied
The amount pending unbonding is zero (which is true for a genesis chain).
The supplied amounts of deposit and withdrawable values are not negative.
The withdrawable amount is less than or equal to the deposit amount.
The deposit amount does not exceed the max supply of the token previously provided.
The
x/assets
module should load the genesis state from disk for the network to successfully bootstrap with the rPOS process. This pull request makes that happen.The genesis state is structured as follows:
At genesis, the module should load:
The stateless validation follows this algorithm:
assetID
which is always in lower case.For each staker deposit entry, we check:
stakerID
is valid: lowercase, exactly one underscore, with the left side of the underscore non-empty and a hex address, and the right side a hex uint64.stakerID
Within each list of deposits indexed by
assetID
perstakerID
, we check for eachassetID
:assetID
within the list of deposits for saidstakerID
.assetID
is registered previously in the tokens list.