This PR subsumes #27 within itself, and therefore should be merged after that one. For ease of review, this PR may be reviewed after the merge of #27 happens and this PR is rebased.
The x/delegation module needs to load the genesis state of delegations (for each possible combination of staker, asset and operator) for the network to successfully bootstrap with the rPOS process.
At genesis, the module should perform these delegations as it would if the chain were live. To do this, we call the exact same DelegateTo function that is called by the precompile and use a flag to skip (1) the operator frozen check, (2) the operator module update and (3) the delegation hooks.
The stateless validation uses this algorithm:
There are no repeat stakers.
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.
For each stakerID, there is no repeating assetID.
Each assetID is valid (defined above).
The LayerZeroID derived from the stakerID equals that derived from the assetID for each provided stakerID + assetID combination.
The per-operator amount, for each operator, is non-nil and non-negative.
The provided operator address is bech32 encoded appropriately.
This PR subsumes #27 within itself, and therefore should be merged after that one. For ease of review, this PR may be reviewed after the merge of #27 happens and this PR is rebased.
The
x/delegation
module needs to load the genesis state of delegations (for each possible combination of staker, asset and operator) for the network to successfully bootstrap with the rPOS process.The genesis state is structured as follows.
At genesis, the module should perform these delegations as it would if the chain were live. To do this, we call the exact same
DelegateTo
function that is called by the precompile and use a flag to skip (1) the operator frozen check, (2) the operator module update and (3) the delegation hooks.The stateless validation uses this algorithm:
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 hexuint64
.stakerID
, there is no repeatingassetID
.assetID
is valid (defined above).LayerZeroID
derived from thestakerID
equals that derived from theassetID
for each providedstakerID
+assetID
combination.