pchain_runtime/contract/version.rs
1/*
2 Copyright © 2023, ParallelChain Lab
3 Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
4*/
5
6//! Defines versioning of Contract Binary Interface.
7
8/// Contract Binary Interface is a specification that a smart contract should follow,
9/// in terms of implementing strictly same function signature of the host functions.
10pub const CBI_VERSION: u32 = CBIVER_ADAM;
11
12/// CBI versions defined in Protocol Adam.
13const CBIVER_ADAM: u32 = 0;
14
15/// Check if version is compatible to runtime. Current CBI version = [CBI_VERSION].
16#[allow(clippy::absurd_extreme_comparisons)]
17pub(crate) const fn is_cbi_compatible(version: u32) -> bool {
18 version <= CBI_VERSION
19}