runtime_eden/
version.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * This file is part of the Nodle Chain distributed at https://github.com/NodleCode/chain
 * Copyright (C) 2020-2022  Nodle International
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use crate::RUNTIME_API_VERSIONS;
use sp_runtime::create_runtime_str;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

/// This runtime version.
/// This should not be thought of as classic Semver (major/minor/tiny).
/// This triplet have different semantics and mis-interpretation could cause problems.
/// In particular: bug fixes should result in an increment of `spec_version` and possibly
/// `authoring_version`, absolutely not `impl_version` since they change the semantics of the
/// runtime.
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
	spec_name: create_runtime_str!("nodle-para"),
	impl_name: create_runtime_str!("nodle-para"),

	// `authoring_version` is the version of the authorship interface. An authoring node
	// will not attempt to author blocks unless this is equal to its native runtime.
	authoring_version: 1,

	// Version of the runtime specification. A full-node will not attempt to use its native
	// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
	// `spec_version` and `authoring_version` are the same between Wasm and native.
	spec_version: 33,

	// Version of the implementation of the specification. Nodes are free to ignore this; it
	// serves only as an indication that the code is different; as long as the other two versions
	// are the same then while the actual code may be different, it is nonetheless required to
	// do the same thing.
	// Non-consensus-breaking optimizations are about the only changes that could be made which
	// would result in only the `impl_version` changing.
	impl_version: 0,

	// Used for hardware wallets. This typically happens when `SignedExtra` changes.
	transaction_version: 12,

	apis: RUNTIME_API_VERSIONS,
	state_version: 0,
};

/// The version infromation used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
	NativeVersion {
		runtime_version: VERSION,
		can_author_with: Default::default(),
	}
}

#[test]
fn test_native_version() {
	let x = native_version();
	assert_eq!(x.runtime_version, VERSION);
	assert!(x.can_author_with.is_empty());
}