mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
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:
@@ -608,7 +608,7 @@ mod tests {
|
||||
System::set_block_number(4);
|
||||
assert_ok!(Collective::close(Origin::signed(4), hash.clone(), 0));
|
||||
|
||||
let record = |event| EventRecord { phase: Phase::Finalization, event, topics: vec![] };
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(System::events(), vec![
|
||||
record(Event::collective_Instance1(RawEvent::Proposed(1, 0, hash.clone(), 3))),
|
||||
record(Event::collective_Instance1(RawEvent::Voted(2, hash.clone(), true, 2, 0))),
|
||||
@@ -632,7 +632,7 @@ mod tests {
|
||||
System::set_block_number(4);
|
||||
assert_ok!(Collective::close(Origin::signed(4), hash.clone(), 0));
|
||||
|
||||
let record = |event| EventRecord { phase: Phase::Finalization, event, topics: vec![] };
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(System::events(), vec![
|
||||
record(Event::collective_Instance1(RawEvent::Proposed(1, 0, hash.clone(), 3))),
|
||||
record(Event::collective_Instance1(RawEvent::Voted(2, hash.clone(), true, 2, 0))),
|
||||
@@ -656,7 +656,7 @@ mod tests {
|
||||
System::set_block_number(4);
|
||||
assert_ok!(Collective::close(Origin::signed(4), hash.clone(), 0));
|
||||
|
||||
let record = |event| EventRecord { phase: Phase::Finalization, event, topics: vec![] };
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(System::events(), vec![
|
||||
record(Event::collective_Instance1(RawEvent::Proposed(1, 0, hash.clone(), 3))),
|
||||
record(Event::collective_Instance1(RawEvent::Voted(2, hash.clone(), true, 2, 0))),
|
||||
@@ -754,7 +754,7 @@ mod tests {
|
||||
|
||||
assert_eq!(System::events(), vec![
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Proposed(
|
||||
1,
|
||||
0,
|
||||
@@ -835,7 +835,7 @@ mod tests {
|
||||
|
||||
assert_eq!(System::events(), vec![
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Proposed(
|
||||
1,
|
||||
0,
|
||||
@@ -845,7 +845,7 @@ mod tests {
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Voted(
|
||||
1,
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
@@ -884,7 +884,7 @@ mod tests {
|
||||
|
||||
assert_eq!(System::events(), vec![
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(
|
||||
RawEvent::Proposed(
|
||||
1,
|
||||
@@ -895,7 +895,7 @@ mod tests {
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Voted(
|
||||
2,
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
@@ -906,7 +906,7 @@ mod tests {
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Disapproved(
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
)),
|
||||
@@ -927,7 +927,7 @@ mod tests {
|
||||
|
||||
assert_eq!(System::events(), vec![
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Proposed(
|
||||
1,
|
||||
0,
|
||||
@@ -937,7 +937,7 @@ mod tests {
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Voted(
|
||||
2,
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
@@ -948,14 +948,14 @@ mod tests {
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Approved(
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
phase: Phase::Initialization,
|
||||
event: Event::collective_Instance1(RawEvent::Executed(
|
||||
hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(),
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user