Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ac824b1
frame-metadata: Point to unreleased branch
lexnv May 11, 2023
e9c2fd3
frame: Generalize outer enum generation for events and errors
lexnv May 12, 2023
6707973
frame: Remove individual generation of outer enum events
lexnv May 12, 2023
a41c847
primitives/traits: Add marker trait for outer runtime enums
lexnv May 15, 2023
a04007f
frame: Derive Clone, PartialEq, Eq for RuntimeEvents only
lexnv May 15, 2023
cb6309f
frame/pallet: Include `#[pallet::error]` enum into pallet parts
lexnv May 15, 2023
cf0e3e2
metadata-ir: Include call, event, error types
lexnv May 15, 2023
8638fbb
frame/metadata: Include outer enum types in V15 metadata
lexnv May 15, 2023
6d9af4b
frame/tests: Ensure `RuntimeError` includes `#[pallet::error]` parts
lexnv May 15, 2023
eca5422
frame/support: Document the reserved name for `RuntimeError`
lexnv May 15, 2023
ca130b3
frame: Use self-generated `RuntimeEvent` for `GetRuntimeOuterEnumTypes`
lexnv May 15, 2023
b004ae3
frame/ui: Fix UI tests
lexnv May 15, 2023
1e00fed
frame/support: Remove unused system path
lexnv May 15, 2023
42b7d98
frame/ui: Unexpected field and reintroduce frame_system::Config for R…
lexnv May 15, 2023
85c5aeb
frame/support: Remove `GetRuntimeOuterEnumTypes` marker trait
lexnv May 25, 2023
f65172d
frame/support: Remove `;` from macro
lexnv May 25, 2023
8ac30ba
Update frame-metadata to point to unreleased branch
lexnv Jun 7, 2023
9849d4b
Rename error_enum_ty to module_error_enum_ty
lexnv Jun 7, 2023
7228348
Merge remote-tracking branch 'origin/master' into lexnv/metadata_oute…
lexnv Jun 7, 2023
e7b9829
Update module_error_ty documentation
lexnv Jun 7, 2023
f546387
frame: Implement from_dispatch_error
lexnv Jun 7, 2023
9e175b9
frame/support: Adjust test to ModuleErrorType
lexnv Jun 7, 2023
a998d91
Fix clippy
lexnv Jun 7, 2023
6e86299
Improve documentation
lexnv Jun 8, 2023
f4e1c7c
frame/tests: Check `from_dispatch_error` impl
lexnv Jun 13, 2023
c4c0b98
Merge remote-tracking branch 'origin/master' into lexnv/metadata_oute…
lexnv Jun 13, 2023
3abc0d7
Update frame-metadata
lexnv Jun 15, 2023
98de5b2
Remove the module_error_ty
lexnv Jun 15, 2023
9b1c3e7
Apply fmt
lexnv Jun 15, 2023
b94bbd1
Revert unneeded parts
lexnv Jun 15, 2023
c0dc3d5
Revert "Revert unneeded parts"
lexnv Jun 19, 2023
547dc6f
Update frame-metadata to origin/master
lexnv Jun 19, 2023
9965290
Add outerEnums to the metadata
lexnv Jun 19, 2023
e9eee8d
Add tests
lexnv Jun 19, 2023
90ca4fa
Keep backwards compatibility for explicit pallet parts
lexnv Jun 19, 2023
a58ee17
Rename tt_error_part to be more generic
lexnv Jun 19, 2023
065a77d
Increase recursion_limit to 1k
lexnv Jun 20, 2023
7382986
Rename `fully_expanded` to `expanded`
lexnv Jun 20, 2023
a540c00
Improve documentation
lexnv Jun 20, 2023
157eb85
Adjust UI tests
lexnv Jun 20, 2023
55bf26c
Update UI tests
lexnv Jun 20, 2023
c1823a1
Update undefined_validate_unsigned_part.stderr UI test
lexnv Jun 20, 2023
82deaa2
Adjust yet again
lexnv Jun 20, 2023
94e07b9
Optimise macro expansions
lexnv Jun 20, 2023
88beae9
Use latest frame-metadata and rename `moduleErrorType` to `RuntimeError`
lexnv Jun 20, 2023
8970e50
Fix comment
lexnv Jun 20, 2023
029ec04
Apply fmt
lexnv Jun 20, 2023
5c5cda1
Merge remote-tracking branch 'origin/master' into lexnv/metadata_oute…
lexnv Jun 20, 2023
b00e525
Update frame/support/procedural/src/construct_runtime/parse.rs
lexnv Jun 21, 2023
81dfddd
Update frame/support/procedural/src/construct_runtime/parse.rs
lexnv Jun 21, 2023
2be265f
Update frame-metadata PR
lexnv Jun 21, 2023
64ee759
Merge remote-tracking branch 'origin/master' into lexnv/metadata_oute…
lexnv Jun 21, 2023
dd8008e
Remove `expanded` from error messages and fix typo
lexnv Jun 21, 2023
643e8e0
Move docs to the function
lexnv Jun 21, 2023
a472b11
ui: Use the intermed syntax for pallet parts
lexnv Jun 21, 2023
2f50050
Update frame-metadata with latest release
lexnv Jun 27, 2023
386fd68
frame: Address feedback for `from_dispatch_error`
lexnv Jun 27, 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
Update UI tests
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Jun 20, 2023
commit 55bf26ca0865a80e20d5b45be47d780f8161cb44
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Event},
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet expanded::{}::{Pallet, Event},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Config},
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet expanded::{}::{Pallet, Config},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Inherent},
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet expanded::{}::{Pallet, Inherent},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Origin},
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet expanded::{}::{Pallet, Origin},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, ValidateUnsigned},
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you provide here expanded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be the "final state" of the construct_runtime!, without this the macro will try to get expanded one more time. And the expansions require the pallets to expose tt_extra_parts macro, and for dummy pallets that's not the case (not sure here if this is constructed with only valid pallets 🤔 )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted this to remove the expanded word, the output looks similar to before.
Some small differences in how the compiler reports the error, most probably related to the extra expansion

Example

missing_event_generic_on_module_with_instance.rs (this is the entire file)

use frame_support::construct_runtime;

construct_runtime! {
	pub struct Runtime where
		Block = Block,
		NodeBlock = Block,
		UncheckedExtrinsic = UncheckedExtrinsic
	{
		System: system::{Pallet},
		Balance: balances::<Instance1>::{Event},
	}
}

fn main() {}

If we don't add the expanded keyword this would produce:

error[E0433]: failed to resolve: use of undeclared crate or module `balances`
  --> tests/construct_runtime_ui/missing_event_generic_on_module_with_instance.rs:10:12
   |
10 |         Balance: balances::<Instance1> ::{Event},
   |                  ^^^^^^^^ use of undeclared crate or module `balances`

When we would actually expect:

error: Instantiable pallet with no generic `Event` cannot be constructed: pallet `Balance` must have generic `Event`
  --> $DIR/missing_event_generic_on_module_with_instance.rs:10:3
   |
10 |         Balance: balances::<Instance1> ::{Event},
   |         ^^^^^^^

I'm presuming that because the construct_runtime! is not in it's final expression (does not contain the expanded), the macro tries to expand the pallet one more time. In doing so it calls balances::tt_extra_parts!, which does not exist (ie theres no balances module).

The "Instantiable pallet with no generic Event cannot be constructed: pallet Balance must have generic" compile error should be coming from the final step of the construct_runtime! macro. And I think it's not outputted/detected because the missing module error has priority for the compiler 🤔

Let me know if this sounds right :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkchr would love to get your feedback on the above 🙏

Pallet: pallet expanded::{}::{Pallet, ValidateUnsigned},
}
}

Expand Down