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
28 commits
Select commit Hold shift + click to select a range
12dc5ef
Initial idea of `on_runtime_upgrade`
shawntabrizi Feb 25, 2020
c0f524a
Runtime storage for module version
shawntabrizi Feb 25, 2020
42f8297
Merge remote-tracking branch 'upstream/master' into shawntabrizi-runt…
shawntabrizi Mar 3, 2020
8e8d588
Gui shawntabrizi runtime upgrade (#5118)
shawntabrizi Mar 3, 2020
731ea6c
make compile
shawntabrizi Mar 3, 2020
a36e3ab
Add some tests
shawntabrizi Mar 3, 2020
9eb8a21
docs
shawntabrizi Mar 3, 2020
dd6c6c3
Remove "useless" code
shawntabrizi Mar 3, 2020
5edb8e8
Fix merge and use n + 1 block number
shawntabrizi Mar 3, 2020
464229a
Fix tests
shawntabrizi Mar 3, 2020
9806b4d
unfix ui tests
shawntabrizi Mar 3, 2020
2f51595
Update on_initialize.stderr
shawntabrizi Mar 3, 2020
d039747
fix test
shawntabrizi Mar 3, 2020
7a23da9
Fix test
shawntabrizi Mar 3, 2020
3b55060
Bump spec
shawntabrizi Mar 3, 2020
f31ff58
Remove `on_finalise` and `on_initialise`
shawntabrizi Mar 3, 2020
8aecd6e
Use bool for tracking runtime upgraded
shawntabrizi Mar 3, 2020
107436e
typo
shawntabrizi Mar 4, 2020
ef19542
Support runtime upgrade with `set_storage`
shawntabrizi Mar 4, 2020
f0ddeb8
Refactor migration code location
shawntabrizi Mar 4, 2020
cf9a189
add trailing newlines
shawntabrizi Mar 4, 2020
fbc40bb
Remove old `IsUpgraded` flag
shawntabrizi Mar 4, 2020
490d69c
Merge remote-tracking branch 'upstream/master' into shawntabrizi-runt…
shawntabrizi Mar 4, 2020
0de3f97
Update state root
shawntabrizi Mar 4, 2020
446f77e
Exhaustive match statement
shawntabrizi Mar 5, 2020
d91b972
Merge branch 'master' into shawntabrizi-runtime-upgrade
shawntabrizi Mar 5, 2020
d8e7607
Apply suggestions from code review
shawntabrizi Mar 5, 2020
0a68c6f
Merge branch 'master' into shawntabrizi-runtime-upgrade
shawntabrizi Mar 5, 2020
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
Remove on_finalise and on_initialise
  • Loading branch information
shawntabrizi committed Mar 3, 2020
commit f31ff58f0572daee0dcab8b193cf898ecb981c75
6 changes: 0 additions & 6 deletions frame/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2037,15 +2037,9 @@ macro_rules! __check_reserved_fn_name {
(on_runtime_upgrade $( $rest:ident )*) => {
$crate::__check_reserved_fn_name!(@compile_error on_runtime_upgrade);
};
(on_initialise $( $rest:ident )*) => {
$crate::__check_reserved_fn_name!(@compile_error_renamed on_initialise on_initialize);
};
(on_finalize $( $rest:ident )*) => {
$crate::__check_reserved_fn_name!(@compile_error on_finalize);
};
(on_finalise $( $rest:ident )*) => {
$crate::__check_reserved_fn_name!(@compile_error_renamed on_finalise on_finalize);
};
(offchain_worker $( $rest:ident )*) => {
$crate::__check_reserved_fn_name!(@compile_error offchain_worker);
};
Expand Down
2 changes: 1 addition & 1 deletion frame/support/test/tests/reserved_keyword/on_initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ macro_rules! reserved {
}
}

reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);

fn main() {}
36 changes: 10 additions & 26 deletions frame/support/test/tests/reserved_keyword/on_initialize.stderr
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
error: Invalid call fn name: `on_finalize`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
30 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: Invalid call fn name: `on_initialize`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: `on_finalise` was renamed to `on_finalize`. Please rename your function accordingly.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: `on_initialise` was renamed to `on_initialize`. Please rename your function accordingly.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
30 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: Invalid call fn name: `on_runtime_upgrade`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
30 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: Invalid call fn name: `offchain_worker`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
30 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: `deposit_event` function is reserved and must follow the syntax: `$vis:vis fn deposit_event() = default;`
--> $DIR/on_initialize.rs:30:1
|
30 | reserved!(on_finalize on_initialize on_finalise on_initialise on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
30 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
4 changes: 2 additions & 2 deletions primitives/consensus/common/src/select_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
/// specific chain build.
///
/// The Strategy can be customized for the two use cases of authoring new blocks
/// upon the best chain or which fork to finalise. Unless implemented differently
/// upon the best chain or which fork to finalize. Unless implemented differently
/// by default finalization methods fall back to use authoring, so as a minimum
/// `_authoring`-functions must be implemented.
///
/// Any particular user must make explicit, however, whether they intend to finalise
/// Any particular user must make explicit, however, whether they intend to finalize
/// or author through the using the right function call, as these might differ in
/// some implementations.
///
Expand Down
2 changes: 1 addition & 1 deletion primitives/runtime/src/offchain/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<'a, I: AsRef<[u8]>, T: IntoIterator<Item=I>> Request<'a, T> {
sp_io::offchain::http_request_write_body(id, chunk.as_ref(), self.deadline)?;
}

// finalise the request
// finalize the request
sp_io::offchain::http_request_write_body(id, &[], self.deadline)?;

Ok(PendingRequest {
Expand Down