Unverified Commit d99ea915 authored by Andrew Jones's avatar Andrew Jones Committed by GitHub
Browse files

[metadata] update to scale-info 0.3, removes string interning (#467)

* WIP

* WIP

* Iterating on InkProject types

* Extract InkProject to its own file

* More iteration on contract metadata

* Compiles...ship it

* Fmt

* Add optional fields and doc test

* Add custom serializer impls for compiler/lang

* Fmt

* Clippy

* Update to scale-info 0.3

* Use &'static str instead of compact string (scale-info 0.3)

* Reexport Url and Version

* Fix missing semicolon

* Fix up metadata exports and codegen

* Serialize hash as byte string

* Remove spec nesting

* Remove name from contract spec

* Add name to storage struct

* Flatten SourceCompiler

* Implement ToTokens for Extension metadata

Allows converting an instance into code that can construct that instance. For use from `cargo-contract`.

* User and Version

* Fix up builder ToTokens and other errs/warns

* Fmt

* Url wrapper

* Comment and Version/Url intos

* Fmt

* Fix U

* Promote extension to module dir

* Moved InkProjectExtension to cargo-contract

* Fix doc gen

* Fix json tests

* Use pretty assertions and fix layout json tests

* Remove storage name from layout (ink specific)

* StorageLayout -> Layout

* Remove redundant contract_ident_lit

* Remove redundant dependencies

* Use Self instead of InkProject
parent 5a944ca2
Pipeline #100563 passed with stages
in 10 minutes and 47 seconds
...@@ -255,7 +255,7 @@ publish-docs: ...@@ -255,7 +255,7 @@ publish-docs:
- git fetch origin gh-pages - git fetch origin gh-pages
# Generating Docs # Generating Docs
- time cargo doc --no-deps --all-features - time cargo doc --no-deps --all-features
-p scale-info -p ink_metadata -p ink_metadata_derive -p ink_core -p ink_core_derive -p scale-info -p ink_metadata -p ink_core -p ink_core_derive
-p ink_primitives -p ink_prelude -p ink_lang -p ink_lang_macro -p ink_primitives -p ink_prelude -p ink_lang -p ink_lang_macro
# saving README and docs # saving README and docs
- mv target/doc/ /tmp/ - mv target/doc/ /tmp/
......
...@@ -39,7 +39,7 @@ blake2 = { version = "0.9", optional = true } ...@@ -39,7 +39,7 @@ blake2 = { version = "0.9", optional = true }
# Sadly couldn't be marked as dev-dependency. # Sadly couldn't be marked as dev-dependency.
# Never use this crate outside of the off-chain environment! # Never use this crate outside of the off-chain environment!
rand = { version = "0.7", default-features = false, features = ["alloc"], optional = true } rand = { version = "0.7", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
# Workaround: we actually just need criterion as a dev-dependency, but # Workaround: we actually just need criterion as a dev-dependency, but
# there is an issue with a doubly included std lib when executing # there is an issue with a doubly included std lib when executing
......
...@@ -15,7 +15,7 @@ scale = { package = "parity-scale-codec", version = "1.3", default-features = fa ...@@ -15,7 +15,7 @@ scale = { package = "parity-scale-codec", version = "1.3", default-features = fa
adder = { version = "2.1.0", path = "adder", default-features = false, features = ["ink-as-dependency"] } adder = { version = "2.1.0", path = "adder", default-features = false, features = ["ink-as-dependency"] }
subber = { version = "2.1.0", path = "subber", default-features = false, features = ["ink-as-dependency"] } subber = { version = "2.1.0", path = "subber", default-features = false, features = ["ink-as-dependency"] }
accumulator = { version = "2.1.0", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "2.1.0", path = "accumulator", default-features = false, features = ["ink-as-dependency"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "delegator" name = "delegator"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../../core", default-features = false ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../../core", default-features = false
ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "accumulator" name = "accumulator"
......
...@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false ...@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false
accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "adder" name = "adder"
......
...@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false ...@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false
accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "subber" name = "subber"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "dns" name = "dns"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "erc20" name = "erc20"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "erc721" name = "erc721"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "flipper" name = "flipper"
......
...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "incrementer" name = "incrementer"
......
...@@ -12,7 +12,7 @@ ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ...@@ -12,7 +12,7 @@ ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
ink_prelude = { version = "2.1.0", path = "../../prelude", default-features = false } ink_prelude = { version = "2.1.0", path = "../../prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "multisig_plain" name = "multisig_plain"
......
...@@ -12,7 +12,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false } ...@@ -12,7 +12,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false } ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "runtime_storage" name = "runtime_storage"
......
...@@ -36,7 +36,7 @@ ink_lang = { version = "2.1.0", path = ".." } ...@@ -36,7 +36,7 @@ ink_lang = { version = "2.1.0", path = ".." }
trybuild = "1.0.24" trybuild = "1.0.24"
pretty_assertions = "0.6.1" pretty_assertions = "0.6.1"
scale-info = { version = "0.2", default-features = false, features = ["derive"] } scale-info = { version = "0.3", default-features = false, features = ["derive"] }
[lib] [lib]
name = "ink_lang_macro" name = "ink_lang_macro"
......
...@@ -242,15 +242,13 @@ impl GenerateMetadata<'_> { ...@@ -242,15 +242,13 @@ impl GenerateMetadata<'_> {
} }
fn generate_contract(&self) -> TokenStream2 { fn generate_contract(&self) -> TokenStream2 {
let contract_ident_lit = self.contract.ident.to_string();
let constructors = self.generate_constructors(); let constructors = self.generate_constructors();
let messages = self.generate_messages(); let messages = self.generate_messages();
let events = self.generate_events(); let events = self.generate_events();
let docs = self.generate_docs(); let docs = self.generate_docs();
quote! { quote! {
::ink_metadata::ContractSpec::new(#contract_ident_lit) ::ink_metadata::ContractSpec::new()
.constructors(vec![ .constructors(vec![
#(#constructors ,)* #(#constructors ,)*
]) ])
......
...@@ -20,11 +20,11 @@ ink_primitives = { version = "2.1.0", path = "../primitives/", default-features ...@@ -20,11 +20,11 @@ ink_primitives = { version = "2.1.0", path = "../primitives/", default-features
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] } serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
derive_more = { version = "0.99", default-features = false, features = ["from"] } derive_more = { version = "0.99", default-features = false, features = ["from"] }
scale-info = { version = "0.2", default-features = false, features = ["derive"] } scale-info = { version = "0.3", default-features = false, features = ["derive"] }
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6.1"
serde_json = "1.0" serde_json = "1.0"
assert-json-diff = "1.0.1"
[features] [features]
default = [ default = [
......
...@@ -300,7 +300,7 @@ pub struct FieldLayout<F: Form = MetaForm> { ...@@ -300,7 +300,7 @@ pub struct FieldLayout<F: Form = MetaForm> {
/// The name of the field. /// The name of the field.
/// ///
/// Can be missing, e.g. in case of an enum tuple struct variant. /// Can be missing, e.g. in case of an enum tuple struct variant.
name: Option<F::String>, name: Option<&'static str>,
/// The kind of the field. /// The kind of the field.
/// ///
/// This is either a direct layout bound /// This is either a direct layout bound
...@@ -312,7 +312,7 @@ impl FieldLayout { ...@@ -312,7 +312,7 @@ impl FieldLayout {
/// Creates a new field layout. /// Creates a new field layout.
pub fn new<N, L>(name: N, layout: L) -> Self pub fn new<N, L>(name: N, layout: L) -> Self
where where
N: Into<Option<<MetaForm as Form>::String>>, N: Into<Option<&'static str>>,
L: Into<Layout>, L: Into<Layout>,
{ {
Self { Self {
...@@ -327,7 +327,7 @@ impl IntoCompact for FieldLayout { ...@@ -327,7 +327,7 @@ impl IntoCompact for FieldLayout {
fn into_compact(self, registry: &mut Registry) -> Self::Output { fn into_compact(self, registry: &mut Registry) -> Self::Output {
FieldLayout { FieldLayout {
name: self.name.map(|name| registry.register_string(name)), name: self.name,
layout: self.layout.into_compact(registry), layout: self.layout.into_compact(registry),
} }
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
use super::*; use super::*;
use ink_primitives::KeyPtr; use ink_primitives::KeyPtr;
use pretty_assertions::assert_eq;
#[test] #[test]
fn layout_key_works() { fn layout_key_works() {
...@@ -60,7 +61,7 @@ fn named_fields_work() { ...@@ -60,7 +61,7 @@ fn named_fields_work() {
"ty": 1, "ty": 1,
} }
}, },
"name": 1, "name": "a",
}, },
{ {
"layout": { "layout": {
...@@ -73,7 +74,7 @@ fn named_fields_work() { ...@@ -73,7 +74,7 @@ fn named_fields_work() {
"ty": 2, "ty": 2,
} }
}, },
"name": 2, "name": "b",
} }
] ]
} }
...@@ -293,7 +294,7 @@ fn mixed_enum_work() { ...@@ -293,7 +294,7 @@ fn mixed_enum_work() {
"ty": 1, "ty": 1,
} }
}, },
"name": 1, "name": "a",
}, },
{ {
"layout": { "layout": {
...@@ -306,7 +307,7 @@ fn mixed_enum_work() { ...@@ -306,7 +307,7 @@ fn mixed_enum_work() {
"ty": 2, "ty": 2,
} }
}, },
"name": 2, "name": "b",
} }
], ],
}, },
......
...@@ -41,6 +41,7 @@ pub use self::specs::{ ...@@ -41,6 +41,7 @@ pub use self::specs::{
ReturnTypeSpec, ReturnTypeSpec,
TypeSpec, TypeSpec,
}; };
#[cfg(feature = "derive")] #[cfg(feature = "derive")]
use scale_info::{ use scale_info::{
form::CompactForm, form::CompactForm,
...@@ -49,24 +50,25 @@ use scale_info::{ ...@@ -49,24 +50,25 @@ use scale_info::{
}; };
use serde::Serialize; use serde::Serialize;
/// An entire ink! project for ABI file generation purposes. /// An entire ink! project for metadata file generation purposes.
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
pub struct InkProject { pub struct InkProject {
#[serde(flatten)]
registry: Registry, registry: Registry,
#[serde(rename = "storage")] #[serde(rename = "storage")]
/// The layout of the storage data structure
layout: layout2::Layout<CompactForm>, layout: layout2::Layout<CompactForm>,
#[serde(rename = "contract")]
spec: ContractSpec<CompactForm>, spec: ContractSpec<CompactForm>,
} }
impl InkProject { impl InkProject {
/// Creates a new ink! project.
pub fn new<L, S>(layout: L, spec: S) -> Self pub fn new<L, S>(layout: L, spec: S) -> Self
where where
L: Into<layout2::Layout>, L: Into<layout2::Layout>,
S: Into<ContractSpec>, S: Into<ContractSpec>,
{ {
let mut registry = Registry::new(); let mut registry = Registry::new();
Self { Self {
layout: layout.into().into_compact(&mut registry), layout: layout.into().into_compact(&mut registry),
spec: spec.into().into_compact(&mut registry), spec: spec.into().into_compact(&mut registry),
......
...@@ -39,8 +39,6 @@ use serde::Serialize; ...@@ -39,8 +39,6 @@ use serde::Serialize;
#[derive(Debug, PartialEq, Eq, Serialize)] #[derive(Debug, PartialEq, Eq, Serialize)]
#[serde(bound = "F::TypeId: Serialize")] #[serde(bound = "F::TypeId: Serialize")]
pub struct ContractSpec<F: Form = MetaForm> { pub struct ContractSpec<F: Form = MetaForm> {
/// The name of the contract.
name: F::String,
/// The set of constructors of the contract. /// The set of constructors of the contract.
constructors: Vec<ConstructorSpec<F>>, constructors: Vec<ConstructorSpec<F>>,
/// The external messages of the contract. /// The external messages of the contract.
...@@ -56,7 +54,6 @@ impl IntoCompact for ContractSpec { ...@@ -56,7 +54,6 @@ impl IntoCompact for ContractSpec {
fn into_compact(self, registry: &mut Registry) -> Self::Output { fn into_compact(self, registry: &mut Registry) -> Self::Output {
ContractSpec { ContractSpec {
name: registry.register_string(&self.name),
constructors: self constructors: self
.constructors .constructors
.into_iter() .into_iter()
...@@ -171,10 +168,9 @@ impl ContractSpecBuilder<Valid> { ...@@ -171,10 +168,9 @@ impl ContractSpecBuilder<Valid> {
impl ContractSpec { impl ContractSpec {
/// Creates a new contract specification. /// Creates a new contract specification.
pub fn new(name: <MetaForm as Form>::String) -> ContractSpecBuilder { pub fn new() -> ContractSpecBuilder {
ContractSpecBuilder { ContractSpecBuilder {
spec: Self { spec: Self {
name,
constructors: Vec::new(), constructors: Vec::new(),
messages: Vec::new(), messages: Vec::new(),
events: Vec::new(), events: Vec::new(),
...@@ -190,7 +186,7 @@ impl ContractSpec { ...@@ -190,7 +186,7 @@ impl ContractSpec {
#[serde(bound = "F::TypeId: Serialize")] #[serde(bound = "F::TypeId: Serialize")]
pub struct ConstructorSpec<F: Form = MetaForm> { pub struct ConstructorSpec<F: Form = MetaForm> {
/// The name of the message. /// The name of the message.
name: F::String, name: &'static str,
/// The selector hash of the message. /// The selector hash of the message.
#[serde(serialize_with = "serialize_as_byte_str")] #[serde(serialize_with = "serialize_as_byte_str")]
selector: [u8; 4], selector: [u8; 4],
...@@ -205,7 +201,7 @@ impl IntoCompact for ConstructorSpec { ...@@ -205,7 +201,7 @@ impl IntoCompact for ConstructorSpec {
fn into_compact(self, registry: &mut Registry) -> Self::Output { fn into_compact(self, registry: &mut Registry) -> Self::Output {
ConstructorSpec { ConstructorSpec {
name: registry.register_string(&self.name), name: self.name,
selector: self.selector, selector: self.selector,
args: self args: self
.args .args
...@@ -231,9 +227,7 @@ pub struct ConstructorSpecBuilder<Selector> { ...@@ -231,9 +227,7 @@ pub struct ConstructorSpecBuilder<Selector> {
impl ConstructorSpec { impl ConstructorSpec {
/// Creates a new constructor spec builder. /// Creates a new constructor spec builder.
pub fn new( pub fn new(name: &'static str) -> ConstructorSpecBuilder<Missing<state::Selector>> {
name: <MetaForm as Form>::String,
) -> ConstructorSpecBuilder<Missing<state::Selector>> {
ConstructorSpecBuilder { ConstructorSpecBuilder {
spec: Self { spec: Self {
name, name,
...@@ -296,7 +290,7 @@ impl ConstructorSpecBuilder<state::Selector> { ...@@ -296,7 +290,7 @@ impl ConstructorSpecBuilder<state::Selector> {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MessageSpec<F: Form = MetaForm> { pub struct MessageSpec<F: Form = MetaForm> {
/// The name of the message. /// The name of the message.
name: F::String, name: &'static str,
/// The selector hash of the message. /// The selector hash of the message.
#[serde(serialize_with = "serialize_as_byte_str")] #[serde(serialize_with = "serialize_as_byte_str")]
selector: [u8; 4], selector: [u8; 4],
...@@ -329,7 +323,7 @@ mod state { ...@@ -329,7 +323,7 @@ mod state {
impl MessageSpec { impl MessageSpec {
/// Creates a new message spec builder. /// Creates a new message spec builder.
pub fn new( pub fn new(
name: <MetaForm as Form>::String, name: &'static str,
) -> MessageSpecBuilder< ) -> MessageSpecBuilder<
Missing<state::Selector>, Missing<state::Selector>,
Missing<state::Mutates>, Missing<state::Mutates>,
...@@ -443,7 +437,7 @@ impl IntoCompact for MessageSpec { ...@@ -443,7 +437,7 @@ impl IntoCompact for MessageSpec {
fn into_compact(self, registry: &mut Registry) -> Self::Output { fn into_compact(self, registry: &mut Registry) -> Self::Output {
MessageSpec { MessageSpec {
name: registry.register_string(&self.name), name: self.name,
selector: self.selector, selector: self.selector,
mutates: self.mutates, mutates: self.mutates,
args: self args: self
...@@ -462,7 +456,7 @@ impl IntoCompact for MessageSpec { ...@@ -462,7 +456,7 @@ impl IntoCompact for MessageSpec {
#[serde(bound = "F::TypeId: Serialize")] #[serde(bound = "F::TypeId: Serialize")]
pub struct EventSpec<F: Form = MetaForm> { pub struct EventSpec<F: Form = MetaForm> {
/// The name of the event. /// The name of the event.
name: F::String, name: &'static str,
/// The event arguments. /// The event arguments.
args: Vec<EventParamSpec<F>>, args: Vec<EventParamSpec<F>>,
/// The event documentation. /// The event documentation.
...@@ -508,7 +502,7 @@ impl IntoCompact for EventSpec { ...@@ -508,7 +502,7 @@ impl IntoCompact for EventSpec {
fn into_compact(self, registry: &mut Registry) -> Self::Output { fn into_compact(self, registry: &mut Registry) -> Self::Output {
EventSpec { EventSpec {
name: registry.register_string(&self.name), name: self.name,
args: self args: self
.args .args
.into_iter() .into_iter()
...@@ -549,7 +543,7 @@ impl EventSpec { ...@@ -549,7 +543,7 @@ impl EventSpec {
/// default setup. Even though it would be useful for third party tools /// default setup. Even though it would be useful for third party tools
/// such as the Polkadot UI to know that we are handling with `Balance` /// such as the Polkadot UI to know that we are handling with `Balance`
/// types, we currently cannot communicate this without display names. /// types, we currently cannot communicate this without display names.
pub type DisplayName<F> = scale_info::Path<F>; pub type DisplayName = scale_info::Path;
/// A type specification. /// A type specification.
/// ///
...@@ -575,7 +569,7 @@ pub struct TypeSpec<F: Form = MetaForm> { ...@@ -575,7 +569,7 @@ pub struct TypeSpec<F: Form = MetaForm> {
/// The actual type. /// The actual type.
id: F::TypeId, id: F::TypeId,
/// The compile-time known displayed representation of the type. /// The compile-time known displayed representation of the type.
display_name: DisplayName<F>, display_name: DisplayName,
}