cli
cli copied to clipboard
`network`: add genesis verification for special allocations
Depends on https://github.com/tendermint/spn/issues/790
Is your feature request related to a problem? Please describe.
Mainnets can have special allocations: shares of the campaign allocated for a specific purposes other than redeemed vouchers When a special allocation is defined for a mainnet, the client must verify the initial genesis of the chain is valid regarding the special allocation. The chain genesis shouldn't be generated if the initial genesis is invalid
There are two types of special allocations:
- GenesisDistribution
- ClaimableAirdrop
The query SpecialAllocationsBalance from campaign from spn allows to get the final tokens allocated for each special allocations
The client must perform the following verifications in the initial genesis of the chain:
If genesis distribution defined:
bank.supplymust be equal toGenesisDistribution
If genesis distribution is not defined:
bank.balancesmust be empty
If claimable airdrop defined:
claim.airdropSupplymust be equal toClaimableAirdrop
If one of the checks above doesn't pass, the initial genesis of the chain is invalid and the chain can't be launched from it
Describe the solution you'd like
The routine initGenesis in networkchain/init.go generates the initial genesis of the chain.
I suggest having this check in this routine when the chain is a mainnet. If the special allocations is invalid initGenesis
returns an error.
We should pass the information that the chain is a mainnet and the special allocations into the Chain object.
After GenesisDistribution verification is completed. bank.supply should be removed from the genesis. The initial genesis is valid, other accounts will be added during genesis generation, therefore the final genesis will not be valid if we keep bank.supply