Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dogfood): load genesis state #28

Merged
merged 23 commits into from
Apr 10, 2024

Conversation

MaxMustermann2
Copy link
Contributor

@MaxMustermann2 MaxMustermann2 commented Apr 5, 2024

The x/dogfood 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 of this module is described as the parameters of the module as well as an initial list of consensus public keys with their vote powers. This list is forwarded to Tendermint.

The genesis state is structured as follows:

{
    "params": {...},
    "initial_val_set" [
        {
            "public_key": "0x...",
            "power": "123456"
        }, {...}
    ]
}

The stateful validations performed are:

  • The epochs parameter is registered in the epochs keeper
  • The list of asset IDs provided as a param are registered staking assets.
  • There is a registered operator for each consensus public key in the initial validator set.

The stateless validations are listed below.

  • The number of initial validators does not exceed the max. (If the number of validators provided is 0, the validation does not fail; rather, an empty validator set is forwarded to Tendermint which complains instead).
  • There are no duplicate public keys in the provided validator set.
  • The public keys provided are valid and can be converted from the bytes32 format to the Tendermint public key.
  • The vote power for each public key is non-negative.

Since Cosmos uses an IAVL+ tree to store the state, the order of
execution matters in the calculation of the state root. This means that
map iterations cannot be used (although map serialization using protobuf
is still possible).
Since the interfaces of events are now well defined in the corresponding
modules, we can move our interface guards to validate them. For example,
the implementation of delegation hooks in the dogfood module was guarded
by `types.DelegationHooks`, which has now been changed to
`delegationtypes.DelegationHooks`. This ensures the full compatibility
of the interface from the get-go.
...let Tendermint do that instead.
@MaxMustermann2 MaxMustermann2 merged commit 2451f42 into imua-xyz:develop Apr 10, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants