Add Deposit and Withdraw Events to Balances Pallet (#9425)

* add Deposit and Withdraw events to balances

+ add deposit_event() calls where appropriate to signal fund movement
+ adjust and extend tests

* line length

* move events to the end to avoid changing indices

* bump spec_version

* cargo fmt

* adjust block import bench to new event count

* fix node executor tests

* adjust import bench comment

* fix typo and formatting

* adjust event number

* fix copy pasta

* fix contracts pallets tests

* cargo fmt

* WIP fix events in tests

* fix offences tests

* fix tests

* cargo +nightly fmt

* fix contracts pallets tests

* cargo +nightly fmt

* fix offences tests

* formatting and compile fixes

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Alexander Popiak
2021-10-11 16:23:10 +02:00
committed by GitHub
parent 19a656e156
commit 32900294ba
9 changed files with 217 additions and 75 deletions
+10 -8
View File
@@ -135,18 +135,20 @@ impl core::Benchmark for ImportBenchmark {
.inspect_state(|| {
match self.block_type {
BlockType::RandomTransfersKeepAlive => {
// should be 5 per signed extrinsic + 1 per unsigned
// should be 7 per signed extrinsic + 1 per unsigned
// we have 1 unsigned and the rest are signed in the block
// those 5 events per signed are:
// - new account (RawEvent::NewAccount) as we always transfer fund to
// non-existant account
// - endowed (RawEvent::Endowed) for this new account
// - successful transfer (RawEvent::Transfer) for this transfer operation
// - deposit event for charging transaction fee
// those 7 events per signed are:
// - withdraw (Balances::Withdraw) for charging the transaction fee
// - new account (System::NewAccount) as we always transfer fund to
// non-existent account
// - endowed (Balances::Endowed) for this new account
// - successful transfer (Event::Transfer) for this transfer operation
// - 2x deposit (Balances::Deposit and Treasury::Deposit) for depositing
// the transaction fee into the treasury
// - extrinsic success
assert_eq!(
node_runtime::System::events().len(),
(self.block.extrinsics.len() - 1) * 5 + 1,
(self.block.extrinsics.len() - 1) * 7 + 1,
);
},
BlockType::Noop => {