TRUST Summit | Nov 3, 2025 | NYCWhere decision-makers define the next chapter of secure blockchain adoption.
Learn more

Audit name:

[SCA] Kaia | Kaia contracts | May2024

Date:

Jun 28, 2024

Table of Content

Introduction
Audit Summary #1
Audit Summary #2
System Overview #1
System Overview #2
Findings
Appendix 1. Severity Definitions
Appendix 2. Scope
Disclaimer

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the Kaia team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Kaia is a highly optimized, BFT-based public blockchain that aims to meet the enterprise-grade reliability.

Document

NameSmart Contract Code Review and Security Analysis Report for Kaia
Audited ByMax Fedorenko, Kaan Çağlan
Approved ByAtaberk Yavuzer
Websitehttps://kaia.io/
Changelog13/06/2024 - Preliminary Report
28/06/2024 - Final Report
PlatformKlaytn Blockchain
LanguageSolidity
TagsStaking, Bridge
Methodologyhttps://hackenio.cc/sc_methodology
  • Document

    Name
    Smart Contract Code Review and Security Analysis Report for Kaia
    Audited By
    Max Fedorenko, Kaan Çağlan
    Approved By
    Ataberk Yavuzer
    Changelog
    13/06/2024 - Preliminary Report
    28/06/2024 - Final Report
    Platform
    Klaytn Blockchain
    Language
    Solidity
    Tags
    Staking, Bridge

Review Scope

Consensus, Rebalance, Multicall

Repositoryhttps://github.com/kaiachain/kaia
Commite2265cd12fe6d8e62b79f5889a70aa303d70332b
Audited ByMax Fedorenko
  • Review Scope

    Repository

    Consensus, Rebalance, Multicall

    https://github.com/kaiachain/kaia

    Review Scope

    Commit

    Consensus, Rebalance, Multicall

    e2265cd12fe6d8e62b79f5889a70aa303d70332b

    Review Scope

    Audited By

    Consensus, Rebalance, Multicall

    Max Fedorenko

Review Scope

Kaia Bridge, Allocation

Repositoryhttps://github.com/kaiachain/kaia
Commite2265cd12fe6d8e62b79f5889a70aa303d70332b
Audited ByKaan Caglan
  • Review Scope

    Repository

    Review Scope

    Commit

    Kaia Bridge, Allocation

    e2265cd12fe6d8e62b79f5889a70aa303d70332b

    Review Scope

    Audited By

    Kaia Bridge, Allocation

    Kaan Caglan

Audit Summary #1

Audit Summary

The system users should acknowledge all the risks summed up in the risks section of the report

2

2

0

0

Total findings

Resolved

Accepted

Mitigated
  • 2

    Total findings

    2

    Resolved

    0

    Accepted

    0

    Mitigated

Total findings by Severity

Severity

Count

Critical
0

High
0

Medium
0

Low
2
  • Severity

    Critical

    Count

    0

    Severity

    High

    Count

    0

    Severity

    Medium

    Count

    0

    Severity

    Low

    Count

    2

KAIA Contracts Consensus Rebalance Multicall Audit Summary

Documentation quality

  • Functional requirements are provided

  • Technical description is provided.

Code quality

  • Best practices are applied.

Test coverage

Code coverage of the project is 88% (branch coverage).

  • Not all branches covered with tests.

Audit Summary #2

KAIA Contracts Kaia Bridge Allocation Audit Summary

Documentation quality

  • Functional requirements are provided

  • Technical description is provided.

Code quality

  • Best practices are applied.

Test coverage

Code coverage of the project is 81% (branch coverage),

  • Not all branches are covered with tests

System Overview #1

KAIA Contracts

KAIA ContractsConsensus Rebalance Multicall System Overview

The KAIA Blockchain Ecosystem is a comprehensive set of smart contracts designed to facilitate secure and efficient blockchain-based operations. These operations include Staking, Treasury rebalancing, Multicall aggregation.

  • Staking - is an advanced staking system designed for managing both locked and delegated stakes within a network. It integrates various functionalities that enable detailed management of staking operations, lockup conditions, re-delegation processes, and interaction with public delegation systems

  • Treasury rebalancing - is to manage the rebalancing of treasury funds within a defined system. The contract records the addresses holding treasury funds before and after a rebalancing process, and facilitates the approval and redistribution of these funds to new addresses.

  • Multicall aggregation - is designed to aggregate and provide staking information for client-side applications, for the “Kaia client”.

Privileged roles

  • ADMIN_ROLE (Staking) - This role has the highest level of access and is responsible for initial setup and configuration tasks. These include setting the staking tracker address and initializing public delegation settings.

  • OPERATOR_ROLE (Staking) - Operators manage ongoing contract functions such as updating critical addresses (like staking trackers and voter addresses), managing redelegation settings, and handling lockup stakes withdrawals.

  • STAKER_ROLE (Staking) - This role is allowed to delegate stakes to the contract, either through direct transactions or fallback methods when KAIA is sent to the contract address.

  • UNSTAKING_APPROVER_ROLE, UNSTAKING_CLAIMER_ROLE (Staking) - These roles are essential for managing the liquidity and integrity of the staking pool, providing checks and balances on how funds are moved in and out of the contract.

  • Owner (Treasury Rebalance) - The owner sets the initial parameters, modifies contract state, manage entries, responsible for execution of rebalancing, controls the reset functionality.

System Overview #2

KAIA Contracts Kaia Bridge Allocation System Overview

The KAIA Blockchain Ecosystem is a comprehensive set of smart contracts designed to facilitate secure and efficient blockchain-based operations. These operations include Bech32 encoding/decoding, cross-chain asset transfers through a bridge, multi-signature transaction management by guardians, judicial oversight by judges, and asset lockup management.

Attributes:

Bech32

  • Implements Bech32 encoding/decoding.

  • Attributes:

    • charset: "qpzry9x8gf2tvdw0s3jn54khce6mua7l"

    • linkHash: keccak256("link")

KAIABridge

  • Manages cross-chain asset transfers.

  • Attributes:

    • minLockableKAIA: 5 KAIA

    • maxLockableKAIA: 1,000,000 KAIA

    • TRANSFERLOCK: 30 minutes

Lockup

  • Manages asset lockup and delegation.

  • Attributes:

    • totalDelegatedAmount

    • isInitialized

Privileged Roles:

Owner (KAIABridge):

  • Can modify bridge parameters.

  • Can manage provisions and transfers.

Guardian (Guardian):

  • Can add, remove, and replace guardians.

  • Can authorize upgrades and manage transaction confirmations.

Judge (Judge):

  • Can add, remove, and replace judges.

  • Can authorize upgrades and manage judicial oversight.

Operator (Operator):

  • Can add, remove, and replace operators.

  • Can manage bridge operations and provision transactions.

Admin (Lockup):

  • Can propose acquisitions and request delegated transfers.

  • Can manage role assignments.

Secretary (Lockup):

  • Can confirm and reject acquisitions and delegated transfers.

Findings

Code
Title
Status
Severity
F-2024-3755Missing Controls In Replace Functions For High Level Operators
fixed

Low
F-2024-3754Self-Removal of Guardian Leading to Potential Guardianless State
fixed

Low
F-2024-3873Not Standardised External Calls
fixed

Observation
F-2024-3870Unused Local Variable
accepted

Observation
F-2024-3869Redundant _msgSender(), Meta-Transactions Not Implemented
fixed

Observation
F-2024-3753Missing Reentrancy Modifier
fixed

Observation
F-2024-3592Lack of two-step ownership transfer
accepted

Observation
F-2024-3591Unneeded initializations of uint256 and bool variable to 0/false
accepted

Observation
F-2024-3590Floating Pragma
fixed

Observation
F-2024-3589Solidity version 0.8.20 might not work on all chains due to PUSH0
fixed

Observation
1-10 of 12 findings

Identify vulnerabilities in your smart contracts.

Appendix 1. Severity Definitions

When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.

Reference on how risk scoring is done is available through the repository in our Github organization:

Severity

Description

Critical
Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.

High
High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.

Medium
Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.

Low
Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.
  • Severity

    Critical

    Description

    Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.

    Severity

    High

    Description

    High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.

    Severity

    Medium

    Description

    Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.

    Severity

    Low

    Description

    Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.

Appendix 2. Scope

The scope of the project includes the following smart contracts from the provided repository:

Scope Details

Consensus, Rebalance, Multicall

Repositoryhttps://github.com/kaiachain/kaia
Commite2265cd12fe6d8e62b79f5889a70aa303d70332b
WhitepaperN/A
Requirementshttps://github.com/kaiachain/kaia/docs
Technical Requirementshttps://github.com/kaiachain/kaia/docs

Contracts in Scope

./contracts/contracts/system_contracts/consensus/Kip163.sol
./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3.sol
./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3MultiSig.sol
./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3MultiSigStorage.sol
./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3Storage.sol
./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegation.sol
./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegationFactory.sol
./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegationStorage.sol
./contracts/contracts/system_contracts/multicall/MultiCallContract.sol
./contracts/contracts/system_contracts/rebalance/TreasuryRebalanceV2.sol
./contracts/contracts/system_contracts/consensus/CnV3/ICnStakingV3.sol
./contracts/contracts/system_contracts/consensus/CnV3/ICnStakingV3MultiSig.sol
./contracts/contracts/system_contracts/consensus/IAddressBook.sol
./contracts/contracts/system_contracts/consensus/IStakingTracker.sol
./contracts/contracts/system_contracts/consensus/PublicDelegation/IKIP163.sol
./contracts/contracts/systemcontracts/consensus/PublicDelegation/IPublicDelegation.sol; ./contracts/contracts/systemcontracts/consensus/PublicDelegation/IPublicDelegationFactory.sol
  • Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/Kip163.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3MultiSig.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3MultiSigStorage.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/CnStakingV3Storage.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegation.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegationFactory.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/PublicDelegation/PublicDelegationStorage.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/multicall/MultiCallContract.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/rebalance/TreasuryRebalanceV2.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/ICnStakingV3.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/CnV3/ICnStakingV3MultiSig.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/IAddressBook.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/IStakingTracker.sol

    Contracts in Scope

    ./contracts/contracts/system_contracts/consensus/PublicDelegation/IKIP163.sol

    Contracts in Scope

    ./contracts/contracts/systemcontracts/consensus/PublicDelegation/IPublicDelegation.sol; ./contracts/contracts/systemcontracts/consensus/PublicDelegation/IPublicDelegationFactory.sol

Scope Details

Kaia bridge, Allocation

Repositoryhttps://github.com/kaiachain/kaia
Commite2265cd12fe6d8e62b79f5889a70aa303d70332b
WhitepaperN/A
Requirementshttps://github.com/kaiachain/kaia/docs
Technical Requirementshttps://github.com/kaiachain/kaia/docs

Contracts in Scope

contracts
contracts
system_contracts
allocation
Lockup.sol - contracts › contracts › system_contracts › allocation › Lockup.sol
Airdrop.sol - contracts › contracts › system_contracts › allocation › Airdrop.sol
kaiabridge
Guardian.sol - contracts › contracts › system_contracts › kaiabridge › Guardian.sol
EnumerableSetUint64.sol - contracts › contracts › system_contracts › kaiabridge › EnumerableSetUint64.sol
ReentrancyGuardUpgradeable.sol - contracts › contracts › system_contracts › kaiabridge › ReentrancyGuardUpgradeable.sol
Bridge.sol - contracts › contracts › system_contracts › kaiabridge › Bridge.sol
Operator.sol - contracts › contracts › system_contracts › kaiabridge › Operator.sol
Judge.sol - contracts › contracts › system_contracts › kaiabridge › Judge.sol
Bech32.sol - contracts › contracts › system_contracts › kaiabridge › Bech32.sol

Disclaimer