Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Runtime API versioning #11779

Merged
merged 37 commits into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8db9c9f
Runtime API versioning
tdimitrov Jun 30, 2022
a773002
Update primitives/api/proc-macro/src/impl_runtime_apis.rs
tdimitrov Jul 25, 2022
89aa9fb
Code review feedback
tdimitrov Jul 30, 2022
5b216a1
fmt
tdimitrov Jul 30, 2022
39c645e
Apply suggestions from code review
tdimitrov Jul 30, 2022
8ede4f5
Code review feedback
tdimitrov Jul 30, 2022
ae545ee
dummy trait -> versioned trait
tdimitrov Jul 31, 2022
3d6c1f2
Implement only versioned traits (not compiling)
tdimitrov Aug 3, 2022
47d0b5a
Remove native API calls (still not compiling)
tdimitrov Aug 3, 2022
779c12f
fmt
tdimitrov Aug 4, 2022
a5b58ee
Fix compilation
bkchr Aug 4, 2022
01fbf97
Comments
tdimitrov Aug 4, 2022
13a9c5b
Remove unused code
tdimitrov Aug 4, 2022
ff57c73
Remove native runtime tests
tdimitrov Aug 4, 2022
12552c7
Remove unused code
tdimitrov Aug 4, 2022
b0d671e
Fix UI tests
tdimitrov Aug 4, 2022
a14970d
Code review feedback
tdimitrov Aug 4, 2022
694c802
Code review feedback
tdimitrov Aug 4, 2022
2e28503
attribute_names -> common
tdimitrov Aug 4, 2022
6e1e47a
Rework `append_api_version`
tdimitrov Aug 5, 2022
3bfa940
Code review feedback
tdimitrov Aug 8, 2022
3c4a80f
Apply suggestions from code review
tdimitrov Aug 8, 2022
9b7fcff
Code review feedback
tdimitrov Aug 8, 2022
845ecf1
Code review feedback
tdimitrov Aug 9, 2022
c9ea350
Code review feedback
tdimitrov Aug 9, 2022
acb7ce9
Use type alias for the default trait - doesn't compile
tdimitrov Aug 9, 2022
9a25165
Fixes
bkchr Aug 9, 2022
5d8f88f
Better error for `method_api_ver < trait_api_version`
tdimitrov Aug 10, 2022
4abe5bb
fmt
tdimitrov Aug 10, 2022
6e5e46e
Rework how we call runtime functions
bkchr Aug 11, 2022
99a69c9
Update UI tests
tdimitrov Aug 11, 2022
5a6b8b4
Fix warnings
tdimitrov Aug 11, 2022
693ebe3
Fix doctests
tdimitrov Aug 11, 2022
c45b763
Apply suggestions from code review
tdimitrov Aug 12, 2022
6803b29
Apply suggestions from code review
tdimitrov Aug 12, 2022
6a0b8e8
Fix formatting and small compilation errors
tdimitrov Aug 12, 2022
91ce8b1
Update primitives/api/proc-macro/src/impl_runtime_apis.rs
tdimitrov Aug 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions primitives/api/proc-macro/src/common.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This file is part of Substrate.

// Copyright (C) 2018-2024 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// The ident used for the block generic parameter.
pub const BLOCK_GENERIC_IDENT: &str = "Block";

/// Unique identifier used to make the hidden includes unique for this macro.
pub const HIDDEN_INCLUDES_ID: &str = "DECL_RUNTIME_APIS";

/// The `core_trait` attribute.
pub const CORE_TRAIT_ATTRIBUTE: &str = "core_trait";
/// The `api_version` attribute.
///
/// Is used to set the current version of the trait.
pub const API_VERSION_ATTRIBUTE: &str = "api_version";
/// The `changed_in` attribute.
///
/// Is used when the function signature changed between different versions of a trait.
/// This attribute should be placed on the old signature of the function.
pub const CHANGED_IN_ATTRIBUTE: &str = "changed_in";
/// The `renamed` attribute.
///
/// Is used when a trait method was renamed.
pub const RENAMED_ATTRIBUTE: &str = "renamed";
/// All attributes that we support in the declaration of a runtime api trait.
pub const SUPPORTED_ATTRIBUTE_NAMES: &[&str] =
&[CORE_TRAIT_ATTRIBUTE, API_VERSION_ATTRIBUTE, CHANGED_IN_ATTRIBUTE, RENAMED_ATTRIBUTE];
Loading