Upgrade Module
Upgrades can occur as either Hard Forks or Soft Forks. Hard Forks are executed when the new SEKAI version is incompatible with the current state storage, requiring launching from a new genesis with a new chain ID to prevent double signing. On the other hand, Soft Forks are executed when no impact on the SEKAI state is expected, allowing the network to continue with the same chain ID without exporting and generating a new genesis file.
If a consensus node casts a negative vote on an upgrade proposal that is later approved, it will automatically be paused
at the beginning of the upgrade.
Upgrade Configuration Examples
- Hard Fork with no change made in
sekaid
binary - used to upgrade other binaries such as INTERX or infrastructure manager, and wiping old database state (e.g. to save disk space)instate_upgrade
-false
skip_handler
-true
new_chain_id
- MUST be different thenold_chain_id
- Hard Fork with changes in
sekaid
binary - used to upgrade network in the case where old database state is incompatible with new releaseinstate_upgrade
-false
skip_handler
-false
new_chain_id
- MUST be different thenold_chain_id
- Soft Fork without changes in
sekaid
binary - used to upgrade other binaries, but preserve old database stateinstate_upgrade
- TBDskip_handler
- TBDnew_chain_id
- MUST be the same asold_chain_id
Example of Upgrade Proposal Plan
{
"proposal_id": "1",
"title": "HARD UPGRADE to ver v0.12.24",
"description": "Upgrade the network",
"content": {
"@type": "/kira.upgrade.ProposalSoftwareUpgrade",
"name": "to-chaosnet-2",
"resources": [
{
"id": "kira",
"url": "https://github.com/KiraCore/kira/releases/download/v0.12.25/kira.zip",
"version": "v0.12.25",
"checksum": "6c021d91c53b1ee611715aaeeccdf22229e721d6532233db11f15dc45a3b325a"
}
],
"upgrade_time": "1714400646",
"old_chain_id": "chaosnet-1",
"new_chain_id": "chaosnet-2",
"rollback_checksum": "1",
"max_enrolment_duration": "1",
"memo": "Upgrade to chaosnet-2",
"instate_upgrade": false,
"reboot_required": true,
"skip_handler": false
},
"submit_time": "2024-04-29T13:52:25.605037930Z",
"voting_end_time": "2024-04-29T13:57:25.605037930Z",
"enactment_end_time": "2024-04-29T14:02:25.605037930Z",
"min_voting_end_block_height": "1602",
"min_enactment_end_block_height": "1603",
"result": "VOTE_PENDING",
"exec_result": ""
}
Upgrade Process
The KIRA network can be upgraded through an off-chain mechanism executed by the daemon service of the KIRA Manager (KM). However, it is not mandatory to use KM to upgrade the network, and node operators can set up their own dedicated CD/CI pipeline tools, such as Jenkins or Teamcity.
To keep up-to-date with upcoming upgrades, operators can obtain information from two INTERX endpoints:
/<ip>:11000/api/kira/upgrade/current_plan
: The “current” plan contains information and resources regarding the current release./<ip>:11000/api/kira/upgrade/next_plan
: The “next” plan contains information and resources regarding the upcoming release. Nodes can also obtain resource references, such as GitHub links and branches, specified in the “current” plan endpoint of a trusted node while joining the network for the very first time.
Manual Hard Fork
If a new genesis file is required for a hard fork, and KM is not used, node operators must create it by first exporting genesis at the block height where the network stopped (node daemon should be shut down), and then passing it through a dedicated new-genesis-from-exported
command. It should be noted that the sekaid
application must be upgraded prior to executing the new-genesis-from-exported
command. Otherwise, it might not be able to interpret and convert the old genesis to the new.
Node operators can execute the following steps to manually hard fork the network:
SEKAI="/home/go/src/github.com/kiracore/sekai"
EXPORTED_GENESIS="/tmp/exported-genesis.json"
NEW_GENESIS="/tmp/new-genesis.json"
# Cleanup old files
rm -fv $EXPORTED_GENESIS $NEW_GENESIS
# Ensure sekaid process is killed gracefully
pkill -15 sekaid || echoWarn "WARNING: Failed to kill sekaid, process might already be dead"
# Export current genesis
sekaid export --home=$SEKAID_HOME > $EXPORTED_GENESIS
# Update repository
cd $SEKAI
git fetch --all
git checkout $BRANCH_TO_CHECKOUT
make install
# Convert exported genesis to a new compatible version
sekaid new-genesis-from-exported $EXPORTED_GENESIS $NEW_GENESIS
Parameters
Parameter | Type | Example | Description |
---|---|---|---|
name | string | to-chaosnet-2 | Name of the plan |
max_enrolment_duration | integer | 1 | Expected duration of upgrade in seconds |
new_chain_id | string | chaosnet-1 | Identifier of the new chain |
old_chain_id | string | chaosnet-2 | Identifier of the current chain |
proposalID | string | 668 | ID of the update proposal. It is set automatically. |
reboot_required | boolean | true | Defines if nodes require OS reboot |
resources | resources[] | List of resources related to each stack to be upgrade in this proposal. | |
rollback_checksum | string | upgrade-118-roll | Checksum to use when rolling back the chain |
skip_handler | boolean | false | Defines if sekaid on-chain handlers of the upgrade process should be skipped. If true , sekaid version changes will be omitted and the network will continue running. If false , the network will halt at the upgrade_time and remain stopped until sekaid binary is upgraded |
instate_upgrade | boolean | false | Defines if database state should be deleted or persisted. If set to true then a Hard Fork will be executed and the new_chain_id and old_chain_id must be different. If set to false , a Soft Fork will be executed and the database does not have to be erased. |
upgrade_time | integer | 1641573000 | Unix timestamp of the exact time the update should be executed |
Resources
Parameter | Type | Example | Description |
---|---|---|---|
id | string | sekai | Identify the stack to be updated, for instance, SEKAI, MIRO, INTERX, etc. |
url | string | https://github.com/KiraCore/kira/releases/download/v0.12.25/kira.zip | Url source of the upgrade archive |
version | string | v0.12.25 | Version to be upgraded to. |
checksum | string | 6c021d91c53b1ee611715aaeeccdf22229 | Checksum of the archive of the upgrade binaries |
CLI Syntax & Examples
Each CLI command and proposal process in KIRA requires specific permissions. These permissions must be added to the account's whitelist or obtained as sudo permissions for direct changes. Refer to the Roles & Permissions documentation for more details. $SIGNER
represents the transaction signer's account name or address. For instructions on setting common flags as environment variables, such as $FLAGS_TX
and $FLAGS_QR
__, see the section
- Transactions
- Queries
- Governance
Transactions
There is no transactions other than the governance proposals for this sub-module.
Queries
current-plan | Query the current network upgrade plan. |
---|---|
next-plan | Query the next network upgrade plan. |
Display the Current Plan
Use the current-plan
command to retrieve the current network upgrade plan.
sekaid query upgrade current-plan $FLAGS_QR | jq
Display the Next Plan
To query the next network upgrade plan, use the next-plan
command.
sekaid query upgrade next-plan $FLAGS_QR | jq
Governance
proposal-set-plan | Create a proposal to set a network upgrade plan. |
---|---|
proposal-cancel-plan | Create a proposal to cancel an existing upgrade plan. |
Set Network Upgrade Plan Proposal
If a consensus node casts a negative vote on an upgrade proposal that is later approved, it will automatically be paused
at the beginning of the upgrade.
The CLI command, proposal-set-plan
, is used to create a proposal to set an upgrade plan for the network. If voted, the upgrade plan is saved and will be overwritten by any subsequent proposals voted before the $MIN_UPGRADE_TIME
. The command accepts the following flags:
Flags
$TITLE
: Title of the proposal.$DESCRIPTION
: Description of the proposal.$UPGRADEMEMO
: Upgrade proposal memo.$NAME
: Upgrade name.$INSTATEUPGRADE
: Boolean indicating instate upgrade (true for hard fork with new genesis file/soft fork).$SKIPHANDLER
: Boolean indicating if handler should be skipped (true if change in sekaid version).$OLDCHAINID
: Old chain id.$NEWCHAINID
: New chain id.$MINUPGRADETIME
: Unix timestamp of the exact time the update should be executed.$RESOURCES
: List of resources to be used in the pipeline.$ROLLBACKMEMO
: Checksum to use when rolling back the chain.$MAXENROLLMENTDURATION
: Expected duration of upgrade in seconds.$REBOOTREQUIRED
: Node reboot requirement (true if required).
sekaid tx customgov proposal-set-plan \
--from=$SIGNER $FLAGS_TX \
--title=$TITLE --description=$DESCRIPTION \
--name=$NAME --resources=$RESOURCES \
--min-upgrade-time=$MIN_UPGRADE_TIME \
--old-chain-id=$OLD_CHAIN_ID \
--new-chain-id=$NEW_CHAIN_ID \
--rollback-memo=$ROLLBACK_MEMO \
--max-enrollment-duration=$MAX_ENROLLMENT_DURATION \
--upgrade-memo=$UPGRADE_MEMO \
--instate-upgrade=$INSTATE_UPGRADE \
--reboot-required=$REBOOT_REQUIRED \
--skip-handler=$SKIP_HANDLER
# Example
sekaid tx upgrade proposal-set-plan \
--from=genesis --keyring-backend=test --home=/home/chaos/sekai --chain-id=chaosnet-1 --fees=100ukex --yes --broadcast-mode=block
--name="to-chaosnet-2" \
--instate-upgrade=false --skip-handler=false \
--resources="[{\"id\":\"kira\",\"url\":\"https://github.com/KiraCore/kira/releases/download/v0.12.25/kira.zip\",\"checksum\":\"6c021d91c53b1ee611715aaeeccdf22229e721d6532233db11f15dc45a3b325a\",\"version\":\"v0.12.25\"}]" \
--min-upgrade-time=$(($(date -u +%s) + 1900)) --old-chain-id=chaosnet-1 --new-chain-id=chaosnet-2 --rollback-memo=1 --max-enrollment-duration=1 --upgrade-memo="Upgrade to chaosnet-2"
Cancel Network Upgrade Plan Proposal
The CLI command, proposal-cancel-plan
, is used to create a proposal to cancel an existing upgrade plan for the network. This proposal is not necessary if the goal is the replace an upgrade plan as the proposal-set-plan
command overwrite any existing upgrade plan. The command accepts the following flags:
Flags
$TITLE
: The title of the proposal.$DESCRIPTION
: The description of the proposal.$NAME
: The name of the upgrade plan to be cancelled.
sekaid tx customgov proposal-cancel-plan \
--from=$SIGNER $FLAGS_TX \
--title=$TITLE --description=$DESCRIPTION \
--name=$NAME