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
33 commits
Select commit Hold shift + click to select a range
8e171a1
stub for construct_dev_runtime!
sam0x17 Oct 17, 2022
ba45d0b
revert
sam0x17 Oct 18, 2022
e1883c9
stub for dev_mode proc macro
sam0x17 Oct 19, 2022
1f3eb5a
preliminary docs for pallet::dev_mode (attribute) proc macro
sam0x17 Oct 19, 2022
ef886e2
add dev_mode to pallet_macros module
sam0x17 Oct 19, 2022
a62437a
add docs item for dev_mode to frame_support
sam0x17 Oct 19, 2022
89337a6
parsing of #[pallet(dev_mode)]
sam0x17 Oct 20, 2022
4d4f235
strip out dev_mode stub since it will be an arg for pallet instead
sam0x17 Oct 20, 2022
76eb78b
make pallet Def struct aware of dev mode
sam0x17 Oct 20, 2022
7ac54de
WIP
sam0x17 Oct 22, 2022
2a5857e
revert changes to call.rs
sam0x17 Oct 25, 2022
fce8e41
pass dev_mode to pallet parsing code
sam0x17 Oct 25, 2022
011f1e0
auto-specify default weights when in dev mode if not specified
sam0x17 Oct 25, 2022
41f159c
add proof / expect for syn::parse in dev mode weight processing
sam0x17 Oct 25, 2022
a7c85b3
set all storages to unbounded when in dev mode
sam0x17 Oct 25, 2022
bb71c7f
just use 0
sam0x17 Oct 25, 2022
45f9932
add invalid pallet arg test
sam0x17 Oct 27, 2022
0470808
add passing dev mode pallet test
sam0x17 Oct 27, 2022
b0cfc6a
add test confirming that dev mode features only work in dev mode
sam0x17 Oct 27, 2022
b5a82cb
cargo fmt + clean up
sam0x17 Oct 27, 2022
450f09d
bump CI
sam0x17 Oct 27, 2022
e765c42
fix pallet ui test
sam0x17 Oct 28, 2022
755a62c
add docs for dev mode
sam0x17 Oct 28, 2022
69411ab
add warning about using dev mode in production circumstances
sam0x17 Nov 1, 2022
4f8b58f
remove comment about no other attributes being supported
sam0x17 Nov 1, 2022
da619d7
fix unneeded assignment
sam0x17 Nov 1, 2022
d350781
make warning more explicit
sam0x17 Nov 7, 2022
6ac7643
more explicit warning about using dev mode in production
sam0x17 Nov 7, 2022
dc038d4
simpler assignment for dev_mode boolean
sam0x17 Nov 7, 2022
555516d
add note about MEL requirement
sam0x17 Nov 7, 2022
386a8c1
add comment specifying why weights can be omitted in example
sam0x17 Nov 7, 2022
b2d988a
tweak wording of comments
sam0x17 Nov 7, 2022
0aea2c8
bump ci
sam0x17 Nov 7, 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
Prev Previous commit
Next Next commit
make warning more explicit
  • Loading branch information
sam0x17 committed Nov 7, 2022
commit d350781f67dbd4c3b5b8948ee10a4c075608a5b0
7 changes: 4 additions & 3 deletions frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,10 @@ pub fn construct_runtime(input: TokenStream) -> TokenStream {
/// <div class="example-wrap" style="display:inline-block"><pre class="compile_fail"
Copy link
Member

Choose a reason for hiding this comment

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

Is it common to put HTML into the docs?

Copy link
Contributor Author

@sam0x17 sam0x17 Nov 7, 2022

Choose a reason for hiding this comment

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

Right now AFAIK there is no built-in way of doing a warning block unless something about the syntax of your code creates a doc warning (which isn't the case here), so the common workaround is to just use the same CSS classes rust docs use when there is a real warning and hard-code the HTML for now.

rust-lang/rust#73935 has tracked it since 2020

The actual HTML I use here was based on an SO answer that I am now having trouble locating, but yes it is using some of the built-in classes to achieve this warning look

TLDR: yes, for warnings

/// style="white-space:normal;font:inherit;">
/// <strong>WARNING</strong>:
/// You should not deploy or use dev mode pallets in production. Once you are done
/// tinkering, you should remove the 'dev_mode' argument from your #[pallet] declaration and
/// fix any compile errors before attempting to use your pallet in a production scenario.
/// You should not deploy or use dev mode pallets in production. Doing so can break your chain
/// and therefore should never be done. Once you are done tinkering, you should remove the
/// 'dev_mode' argument from your #[pallet] declaration and fix any compile errors before
/// attempting to use your pallet in a production scenario.
/// </pre></div>
///
/// See `frame_support::pallet` docs for more info.
Expand Down
7 changes: 4 additions & 3 deletions frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,9 +1505,10 @@ pub mod pallet_prelude {
/// <div class="example-wrap" style="display:inline-block"><pre class="compile_fail"
/// style="white-space:normal;font:inherit;">
/// <strong>WARNING</strong>:
/// You should not deploy or use dev mode pallets in production. Once you are done
/// tinkering, you should remove the 'dev_mode' argument from your #[pallet] declaration and
/// fix any compile errors before attempting to use your pallet in a production scenario.
/// You should not deploy or use dev mode pallets in production. Doing so can break your chain
/// and therefore should never be done. Once you are done tinkering, you should remove the
/// 'dev_mode' argument from your #[pallet] declaration and fix any compile errors before
/// attempting to use your pallet in a production scenario.
/// </pre></div>
///
/// # Pallet struct placeholder: `#[pallet::pallet]` (mandatory)
Expand Down