Adds new event phase Initialization (#5302)

* Adds new event phase `Initialization`

Every event that was deposited inside of `on_initialize` was assigned to
the `ApplyExtrinsic(0)` phase which wasn't correct. This pr introduces a
new phase `Initialization`. This is the new phase while initializing
a block. After initialization we switch to `ApplyExtrinsic(N)` and at
the end to `Finalization` as before.

* Set `ExecutionPhase` in `initialize`

* Increment `spec_version`
This commit is contained in:
Bastian Köcher
2020-03-20 19:34:51 +01:00
committed by GitHub
parent 459557aadc
commit 7693bd5ee5
5 changed files with 96 additions and 71 deletions
+2 -2
View File
@@ -129,7 +129,7 @@ fn should_deposit_event() {
assert_eq!(
System::events(),
vec![EventRecord {
phase: Phase::ApplyExtrinsic(0),
phase: Phase::Initialization,
event: TestEvent::offences(crate::Event::Offence(KIND, time_slot.encode())),
topics: vec![],
}]
@@ -164,7 +164,7 @@ fn doesnt_deposit_event_for_dups() {
assert_eq!(
System::events(),
vec![EventRecord {
phase: Phase::ApplyExtrinsic(0),
phase: Phase::Initialization,
event: TestEvent::offences(crate::Event::Offence(KIND, time_slot.encode())),
topics: vec![],
}]