Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [E2E] Allow testing with live-chain state - [#1949](https://github.com/paritytech/ink/pull/1949)
- [E2E] Call builders and extra gas margin option - [#1917](https://github.com/paritytech/ink/pull/1917)
- Make `set_code_hash` generic - [#1906](https://github.com/paritytech/ink/pull/1906)
- Linter: `storage_never_freed` lint - [#1932](https://github.com/paritytech/ink/pull/1932)
- Linter: `strict_balance_equality` lint - [#1914](https://github.com/paritytech/ink/pull/1914)
- Clean E2E configuration parsing - [#1922](https://github.com/paritytech/ink/pull/1922)
- Make `set_code_hash` generic - [#1906](https://github.com/paritytech/ink/pull/1906)

### Changed
- Messages return `TypeSpec` directly - #[1999](https://github.com/paritytech/ink/pull/1999)
- Fail when decoding from storage and not all bytes consumed - [#1897](https://github.com/paritytech/ink/pull/1897)
- [E2E] resolve DispatchError error details for dry-runs - [#1944](https://github.com/paritytech/ink/pull/1994)

### Added
- Linter: `storage_never_freed` lint - [#1932](https://github.com/paritytech/ink/pull/1932)
- Linter: `strict_balance_equality` lint - [#1914](https://github.com/paritytech/ink/pull/1914)

## Version 5.0.0-alpha

Expand Down
22 changes: 7 additions & 15 deletions crates/ink/codegen/src/generator/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ impl Metadata<'_> {
let ident = message.ident();
let args = message.inputs().map(Self::generate_dispatch_argument);
let cfg_attrs = message.get_cfg_attrs(span);
let ret_ty = Self::generate_return_type(Some(&message.wrapped_output()));
let ret_ty =
Self::generate_message_return_type(&message.wrapped_output());
quote_spanned!(span =>
#( #cfg_attrs )*
::ink::metadata::MessageSpec::from_label(::core::stringify!(#ident))
Expand Down Expand Up @@ -311,7 +312,7 @@ impl Metadata<'_> {
as #trait_path>::__ink_TraitInfo
as ::ink::reflect::TraitMessageInfo<#local_id>>::SELECTOR
}};
let ret_ty = Self::generate_return_type(Some(&message.wrapped_output()));
let ret_ty = Self::generate_message_return_type(&message.wrapped_output());
let label = [trait_ident.to_string(), message_ident.to_string()].join("::");
quote_spanned!(message_span=>
#( #cfg_attrs )*
Expand All @@ -333,19 +334,10 @@ impl Metadata<'_> {
}

/// Generates ink! metadata for the given return type.
fn generate_return_type(ret_ty: Option<&syn::Type>) -> TokenStream2 {
match ret_ty {
None => {
quote! {
::ink::metadata::ReturnTypeSpec::new(::core::option::Option::None)
}
}
Some(ty) => {
let type_spec = Self::generate_type_spec(ty);
quote! {
::ink::metadata::ReturnTypeSpec::new(#type_spec)
}
}
fn generate_message_return_type(ret_ty: &syn::Type) -> TokenStream2 {
let type_spec = Self::generate_type_spec(ret_ty);
quote! {
::ink::metadata::ReturnTypeSpec::new(#type_spec)
}
}

Expand Down