Commit 7d49f74
authored
Update to frame-metadata 22 (#8327)
The main change in [the proposed
`frame-metadata@22`](paritytech/frame-metadata#101)
is that the deprecation information was tidied to remove some possible
but confusing states, which simplifies making use of it in client code.
One change made in the process is that **the ability to deprecate the
entire of the Call/Error/Event enum was removed**.
In other words, prior to this change a pallet author could do either of
these:
```rust
/// Deprecate the entire enum (but this is ignored if any variants are deprecated):
#[deprecated(note = "This is deprecated")]
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
/// An account was created with some free balance.
Endowed { account: T::AccountId, free_balance: T::Balance },
/// An account was removed whose balance was non-zero but below ExistentialDeposit,
/// resulting in an outright loss.
DustLost { account: T::AccountId, amount: T::Balance },
}
/// Deprecate individual variants:
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
/// An account was created with some free balance.
#[deprecated(note = "This is deprecated")]
Endowed { account: T::AccountId, free_balance: T::Balance },
/// An account was removed whose balance was non-zero but below ExistentialDeposit,
/// resulting in an outright loss.
#[deprecated(note = "This is deprecated too")]
DustLost { account: T::AccountId, amount: T::Balance },
}
```
After this PR, **a pallet author can still deprecate individual
variants, but not the entire enum**.
Some reasoning behind this change:
1. It's unlikely that the entire of these enums would ever be entirely
deprecated.
2. In the case of calls, there is no obvious place to put such a warning
anyway.
3. Sticking to just deprecating variants makes it a little simpler for
client code; fewer cases to handle during codegen or whatever.
4. Avoid a confusing state where `#[deprecation]` can be put on the
entire enum _and_ some variants, which leads to the enum-wide
deprecation warning being ignored.
See paritytech/frame-metadata#100 for some
more context on the changes.
# Notes
This PR currently pulls `frame-metadata` via a github branch, for
testing purposes. If we are happy here, I'll merge that PR, release
`frame-metadata` and remove the github dependency before we merge this.1 parent ce69f0d commit 7d49f74
28 files changed
Lines changed: 349 additions & 233 deletions
File tree
- prdoc
- substrate
- frame
- examples/view-functions/src
- support
- procedural/src
- pallet
- expand
- parse
- tests
- src
- storage/types
- tests
- test/tests
- primitives
- api/proc-macro/src
- metadata-ir/src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
| 803 | + | |
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
| |||
60 | 81 | | |
61 | 82 | | |
62 | 83 | | |
63 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
64 | 90 | | |
65 | 91 | | |
66 | 92 | | |
67 | 93 | | |
68 | 94 | | |
69 | 95 | | |
70 | | - | |
| 96 | + | |
71 | 97 | | |
72 | 98 | | |
73 | 99 | | |
| |||
77 | 103 | | |
78 | 104 | | |
79 | 105 | | |
80 | | - | |
| 106 | + | |
81 | 107 | | |
82 | 108 | | |
83 | 109 | | |
84 | 110 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 111 | + | |
88 | 112 | | |
89 | 113 | | |
90 | 114 | | |
| |||
93 | 117 | | |
94 | 118 | | |
95 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
96 | 134 | | |
97 | 135 | | |
98 | | - | |
| 136 | + | |
99 | 137 | | |
100 | | - | |
| 138 | + | |
101 | 139 | | |
102 | 140 | | |
103 | 141 | | |
104 | 142 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
111 | 152 | | |
112 | 153 | | |
113 | 154 | | |
114 | 155 | | |
115 | 156 | | |
116 | | - | |
117 | 157 | | |
118 | 158 | | |
119 | | - | |
120 | | - | |
121 | 159 | | |
122 | 160 | | |
123 | | - | |
124 | | - | |
| 161 | + | |
| 162 | + | |
125 | 163 | | |
126 | 164 | | |
127 | 165 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
140 | 174 | | |
141 | 175 | | |
142 | 176 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
| |||
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
| |||
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
0 commit comments