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(operator): load genesis state #27

Merged
merged 10 commits into from
Apr 9, 2024

Conversation

MaxMustermann2
Copy link
Contributor

@MaxMustermann2 MaxMustermann2 commented Apr 3, 2024

This PR subsumes #25 within itself, and therefore should be merged after that one. For ease of review, this PR may be reviewed after the merge of #25 happens and this PR is rebased.

The x/operator 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:

{
    "operators": [
          {...}, {...}
    ],
    "operator_records": [
        {
            "operator_address": "exo1...",
            "chains": [
                {
                    "chain_id": "exocoretestnet_233-1",
                    "consensus_key": "0xFFFFAAA...."
                }, {...}
             ]
        }, {...}
    ]
}

At genesis, the module should:

  • Register all of the operators
  • Opt them into the chains (for which the consensus key is provided)
  • Store the provided consensus keys against the operator address + chainID combination

The stateful validations performed are the same as the validations on a live chain, since all the calls are routed to those very functions.

The stateless validations are listed below.

  • The operator addresses in operators list are of the correct bech32 format.
  • The client chain earnings addresses, if provided, have unique LayerZero chain ids (for that operator), and the value of those addresses is an Ethereum hex-address (TODO: make this format dependent on the lzID).
  • The operator addresses in operator_records list are correctly bech32 encoded.
  • The operator in operator_records exists in operators.
  • The provided consensus keys are unique for the chainID.
  • The consensus keys can be parsed from hex (Solidity's bytes32).

Copy link
Contributor

@TimmyExogenous TimmyExogenous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

do not check for any bootstrapping related validations, since that is
something for the dogfood module to check.
@MaxMustermann2 MaxMustermann2 merged commit d9ebf0b into imua-xyz:develop Apr 9, 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