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

Metadata V15: Add Runtime API metadata #13302

Merged
merged 84 commits into from
Apr 11, 2023
Merged
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a730fe1
impl_runtime_apis: Generate getters for `metadata_at` functions
lexnv Jan 30, 2023
bc1fed4
runtime: Implement new `Metadata` runtime trait
lexnv Jan 30, 2023
46681dd
runtime: Move `metadata_at` functions to construct_runtime macro
lexnv Jan 31, 2023
d03dd7d
contruct_runtime: Use `OpaqueMetadata` from hidden imports
lexnv Jan 31, 2023
441b7ad
Adjust testing
lexnv Jan 31, 2023
555ccfb
frame/tests: Add tests for the new API
lexnv Jan 31, 2023
b43038f
Merge remote-tracking branch 'origin/master' into lexnv/md15_expose_m…
Feb 2, 2023
d19bbcd
primitives/proc-macro: Helper to extract documentation literals
lexnv Feb 2, 2023
d6d2868
primitives/proc-macro: Helper to filter all `cfg` attributes
lexnv Feb 2, 2023
10a2cc5
primitives/proc-macro: Generate documentation getters for metadata
lexnv Feb 2, 2023
a345ece
primitives/proc-macro: Avoid trait collision with snake case methods
lexnv Feb 2, 2023
397eaa0
proc-macro/tests: Check doc getters
lexnv Feb 2, 2023
04b0c38
primitives/proc-macro: Generate metadata for runtime methods
lexnv Feb 2, 2023
a87dd22
primitives/api: Export scale-info and frame-metadata
lexnv Feb 2, 2023
874cf6e
primitives/proc-macro: Generate metadata for runtime traits
lexnv Feb 2, 2023
dad0980
frame/runtime: Expose metadata v15 internally
lexnv Feb 2, 2023
df770ec
test: Use metadata v15 from `lexnv/md_v15_test` branch
lexnv Feb 2, 2023
c33d3ca
primitives/proc-macro: Generate crate access one module up
lexnv Feb 2, 2023
e4782de
frame: Implement `runtime_metadata` for mocks and tests
lexnv Feb 3, 2023
3e9f5d4
primitives/proc-macro: Fix warnings
lexnv Feb 3, 2023
417fb8d
primitives/proc-macro: Add no-docs flag
lexnv Feb 3, 2023
de1352c
frame: Adjust more tests
lexnv Feb 3, 2023
3bf46aa
frame/tests: Check runtime metadata correctness
lexnv Feb 3, 2023
ae85bbe
frame/benchmarking: Adjust benchmarks
lexnv Feb 3, 2023
d37aa22
frame/benchmarks: Adjust more benchmarks
lexnv Feb 3, 2023
0d09ae6
primitives/api: Fix clippy
lexnv Feb 3, 2023
e8969d6
primitives/proc-macro: Generate runtime metadata on the `decl_runtime…
lexnv Feb 7, 2023
6239543
frame: Abuse Deref to resolve `runtime_metadata`
lexnv Feb 6, 2023
6822962
Revert "frame: Implement `runtime_metadata` for mocks and tests"
lexnv Feb 6, 2023
b1c3dd9
primitives/proc-macro: Remove unused imports and function
lexnv Feb 7, 2023
5ddfc55
frame/support: Adjust runtime metadata test
lexnv Feb 7, 2023
6511a2f
primitives/tests: Remove doc getter test
lexnv Feb 7, 2023
aeb125f
frame/support: Enable `no-metadata-docs` feature from `sp-api`
lexnv Feb 7, 2023
cb05db6
primitives/tests: Add `TypeInfo` for test::extrinsic
lexnv Feb 7, 2023
d1d8cbc
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
lexnv Mar 15, 2023
4c8287d
primitives/api: Expose scale-info and frame-metadata
lexnv Mar 16, 2023
e894ab0
Update frame-metadata to include v15
lexnv Mar 16, 2023
a6bfa9a
Fix merge conflicts
lexnv Mar 16, 2023
bd9be6d
frame/metadata_ir: Add IR for runtime API metadata
lexnv Mar 16, 2023
a7a5460
frame/metadata_ir: Convert IR to V15
lexnv Mar 16, 2023
c99200b
primitives/api: Collect IR metadata for runtime API
lexnv Mar 16, 2023
bc801f9
primitives/api: Move `metadata_ir` from frame/support
lexnv Mar 16, 2023
a069503
frame/tests: Adjust testing
lexnv Mar 16, 2023
436a3e2
frame/tests: Adjust `metadata_versions` test
lexnv Mar 16, 2023
24cfec5
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Mar 16, 2023
081fbc0
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Mar 17, 2023
5e841c1
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Mar 20, 2023
e1cd816
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Mar 21, 2023
112ea17
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Mar 21, 2023
24dfc28
primitives/runtime_metadata: Exclude default type parameters from met…
lexnv Mar 21, 2023
3787289
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
b64cfe5
Update primitives/api/src/metadata_ir/types.rs
lexnv Mar 29, 2023
36519ca
Update primitives/api/src/metadata_ir/mod.rs
lexnv Mar 29, 2023
c6c5336
Update primitives/api/proc-macro/src/utils.rs
lexnv Mar 29, 2023
e48afb1
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
4f5ae6d
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
8b1b3cf
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
6ee1a09
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
f0d857a
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
24f8c64
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 29, 2023
fa2a517
primitives: Fix build
lexnv Mar 29, 2023
e6888b9
primitives/metadata-ir: Move IR to dedicated crate
lexnv Mar 29, 2023
4c92435
primitives: Reexport metadata-ir and frame-metadata
lexnv Mar 29, 2023
e496815
frame: Use apis field instead of runtime
lexnv Mar 29, 2023
ca77baa
Better documentation for the `Deref` abstraction
lexnv Mar 29, 2023
cf78a71
ui-tests: Check empty `impl_runtime_apis`
lexnv Mar 30, 2023
5178e38
primitives: Remove unneeded bounds on generic params
lexnv Mar 30, 2023
be55193
primitives: Rename `collect_where_bounds` to `get_argument_type_param`
lexnv Mar 30, 2023
9e1fc77
primitives: Generate crate access per fn call
lexnv Mar 30, 2023
e281bc9
Revert "primitives: Remove unneeded bounds on generic params"
lexnv Mar 30, 2023
c850d2b
metadata-ir: Add no-std
lexnv Mar 30, 2023
df4d33d
primitives: Adjust where bounds
lexnv Mar 30, 2023
a3b5a4c
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
lexnv Mar 30, 2023
beada2c
Change `frame-metadata` branch to "origin/main"
lexnv Mar 30, 2023
bae34a7
Update to `main` from origin
lexnv Mar 30, 2023
0d9aad1
Update frame-metadata to crates.io v15.1
lexnv Mar 30, 2023
2d76e6d
Revert "ui-tests: Check empty `impl_runtime_apis`"
lexnv Mar 30, 2023
3bafb29
Move ui test to primitives/ui
lexnv Mar 30, 2023
27d8044
Update frame/support/test/tests/runtime_metadata.rs
lexnv Mar 30, 2023
f551830
Update primitives/api/proc-macro/src/runtime_metadata.rs
lexnv Mar 30, 2023
b558af5
Test already covered by `empty_impl_runtime_apis_call.stderr`
lexnv Mar 30, 2023
6f7675b
Retriger CI
lexnv Mar 30, 2023
add36ef
Merge remote-tracking branch 'origin/master' into lexnv/md15_runtime_…
Apr 10, 2023
8d582bf
Import `TokenStream` as `TokenStream2`
lexnv Apr 11, 2023
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
Prev Previous commit
Next Next commit
ui-tests: Check empty impl_runtime_apis
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv committed Mar 30, 2023
commit cf78a7190ad9cba3c3bb2e78dc3d0dc382b2fea9
35 changes: 35 additions & 0 deletions frame/support/test/tests/impl_runtime_apis_ui.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// This file is part of Substrate.

// Copyright (C) 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.

#[rustversion::attr(not(stable), ignore)]
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn impl_runtime_apis_ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}

// As trybuild is using `cargo check`, we don't need the real WASM binaries.
std::env::set_var("SKIP_WASM_BUILD", "1");

// Deny all warnings since we emit warnings as part of a Pallet's UI.
std::env::set_var("RUSTFLAGS", "--deny warnings");

let t = trybuild::TestCases::new();
t.compile_fail("tests/impl_runtime_apis_ui/*.rs");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use frame_support::impl_runtime_apis;

// Do not use `construct_runtime!`.
struct Runtime;

// Empty `impl_runtime_apis!` cannot deduce the Runtime name
// and should not implement the `runtime_metadata()` method.
impl_runtime_apis! {}

// Expect the test to compile because this has the effect of
// not calling `construct_runtime!` nor `impl_runtime_apis!`
// for the Runtime.
fn main() {}