How do I select a hard fork of my environment?

You may perform an upgrade of your environment that adds new EIPs (hard fork) to your chain at a future block using the API. The request must specify the EIPs in the body of the API request. To check the list of EIPs available to introduce via a hard fork, refer to the optional_chain_config section of environment status response.

Kaleido orchestrates the EIPs on all the running nodes in the chain by picking a future block with respect to the maximum block height among the nodes in the chain, at the time the upgrade API request is issued.

The following are the steps involved in hard fork upgrading an environment:

Get the environment /status. The chain_config field is available from release 1.0.27. It lists the EIPs that are currently active in the environment, along with the block number from which they are active. The missing_chain_config shows the list of EIPs that will automatically be added in this new release upgrade. The optional_chain_config field shows the list of new EIPs that you can add to your environment.

# replace the placeholders with the actual values for your Kaleido resources
curl -X GET -H "$HDR_AUTH" -H "$HDR_CT" "$APIURL/consortia/{consortia_id}/environments/{environment_id}/status" | jq

The following is a sample response. Here constantinopleBlock is the new EIP that is available to add to the environment.

{
    "state": "live",
    "node_list": [
        "zzmzk4tuil",
        "zznlavdexi"
    ],
    "service_list": [],
    "upgrade": {
        "available": true,
        "hard_fork": false,
        "chain_config": {
            "chainId": 812882247,
            "homesteadBlock": 0,
            "eip150Block": 0,
            "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "eip155Block": 0,
            "eip158Block": 0,
            "byzantiumBlock": 0,
            "petersburgBlock": 0,
            "clique": {
                "period": 5,
                "epoch": 30000
            }
        },
        "missing_chain_config": [],
        "optional_chain_config": [
            "constantinopleBlock"
        ],
        "current_release": {
            ...
        },
        "target_release": {
            ...
        }
    },
    "health": {
        "all_nodes_up": true,
        "nodes_up": 2,
        "nodes_down": 0,
        "nodes_stopped": 0,
        "highest_block_height": 10,
        "lowest_block_height": 10
    }
}

Use the /upgrade api and specify the new EIP(s) from the optional_chain_config in the hard_fork section of the payload to add it to the environment via a hard fork. Note that, you need not add the EIPs in the missing_chain_config to the payload, as they will be automatically added during the upgrade.

# replace the placeholders with the actual values for your Kaleido resources
curl -X POST -H "$HDR_AUTH" -H "$HDR_CT" "$APIURL/consortia/{consortia_id}/environments/{environment_id}/upgrade" -d '{"hard_fork": {"requested_eips":["constantinopleBlock"]}}' | jq

You'll get a 200 OK response with the environment state as upgrading. Once, the environment comes back to live state, you can check the environment /status and now since constantinopleBlock is added to the environment, you'll find that it is present in the chain_config section and removed from the optional_chain_config section. The following is a sample response:

{
    "state": "live",
    "node_list": [
        "zzmzk4tuil",
        "zznlavdexi"
    ],
    "service_list": [],
    "upgrade": {
        "available": false,
        "hard_fork": false,
        "chain_config": {
            "chainId": 812882247,
            "homesteadBlock": 0,
            "eip150Block": 0,
            "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "eip155Block": 0,
            "eip158Block": 0,
            "byzantiumBlock": 0,
            "constantinopleBlock": 130,
            "petersburgBlock": 0,
            "clique": {
                "period": 5,
                "epoch": 30000
            }
        },
        "missing_chain_config": [],
        "optional_chain_config": [],
        "current_release": {
            ...
        },
        "target_release": {
            ...
        }
    },
    "health": {
        "all_nodes_up": true,
        "nodes_up": 2,
        "nodes_down": 0,
        "nodes_stopped": 0,
        "highest_block_height": 15,
        "lowest_block_height": 15
    }
}

Note that constantinopleBlock has been set to a block that is further than the highest_block_height in the initial environment /status call, i.e, the new EIP is forked to your chain at a future block.