Skip to content

Commit

Permalink
chore(platform)!: updated fees (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Jul 17, 2024
1 parent 785dd6c commit 782fd97
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 95 deletions.
19 changes: 8 additions & 11 deletions packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ mod tests {
)
.expect("expected to process state transition");

assert_eq!(processing_result.aggregated_fees().processing_fee, 3085850); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610);

let check_result = platform
.check_tx(
Expand Down Expand Up @@ -680,7 +680,7 @@ mod tests {
// We have one invalid paid for state transition
assert_eq!(processing_result.invalid_paid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 909400); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 346660);

let check_result = platform
.check_tx(
Expand Down Expand Up @@ -830,10 +830,7 @@ mod tests {

// The processing fees should be twice as much as a fee multiplier of 0,
// since a fee multiplier of 100 means 100% more of 1 (gives 2)
assert_eq!(
processing_result.aggregated_fees().processing_fee,
3085850 * 2 // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
);
assert_eq!(processing_result.aggregated_fees().processing_fee, 4967220);

let check_result = platform
.check_tx(
Expand Down Expand Up @@ -1090,7 +1087,7 @@ mod tests {
)
.expect("expected to process state transition");

assert_eq!(processing_result.aggregated_fees().processing_fee, 3085850); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610);

platform
.drive
Expand Down Expand Up @@ -1174,8 +1171,8 @@ mod tests {

assert_eq!(
update_processing_result.aggregated_fees().processing_fee,
7446290
); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
2495990
);

let check_result = platform
.check_tx(
Expand Down Expand Up @@ -1296,7 +1293,7 @@ mod tests {
)
.expect("expected to process state transition");

assert_eq!(processing_result.aggregated_fees().processing_fee, 3085850); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2483610);

platform
.drive
Expand Down Expand Up @@ -1416,7 +1413,7 @@ mod tests {
// We have one invalid paid for state transition
assert_eq!(processing_result.invalid_paid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1238700); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 448640);

let check_result = platform
.check_tx(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1487,8 +1487,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 3837600);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 1449980);
}

#[test]
Expand Down Expand Up @@ -1628,8 +1627,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 103200);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 41880);
}

#[test]
Expand Down Expand Up @@ -1808,7 +1806,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1261600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 445700);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -1912,8 +1910,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1252800);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 624280);
}
}

Expand Down Expand Up @@ -2052,8 +2049,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 5612800);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 1717580);
}

#[test]
Expand Down Expand Up @@ -2214,8 +2210,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1261600);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 445700);
}

#[test]
Expand Down Expand Up @@ -2376,8 +2371,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 9993800);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2762400);
}

#[test]
Expand Down Expand Up @@ -2520,8 +2514,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1516000);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 552580);
}

#[test]
Expand Down Expand Up @@ -2610,8 +2603,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1252800);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 624280);
}
}

Expand Down Expand Up @@ -2770,8 +2762,7 @@ mod tests {

assert_eq!(processing_result.aggregated_fees().storage_fee, 0); // There is no storage fee, as there are no indexes that will change

assert_eq!(processing_result.aggregated_fees().processing_fee, 4972400);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 1985420);
}

#[test]
Expand Down Expand Up @@ -2962,7 +2953,7 @@ mod tests {
Some(14992395)
);

assert_eq!(processing_result.aggregated_fees().processing_fee, 8691400); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 3369260);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -3154,7 +3145,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1261600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 445700);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -3304,7 +3295,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 25600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 36200);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -3499,7 +3490,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 9622200); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 3730120);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -3566,8 +3557,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 1115600);
// TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 571240);
}
}

Expand Down Expand Up @@ -3903,7 +3893,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 6133600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -4024,11 +4014,11 @@ mod tests {
.change(),
&BalanceChange::RemoveFromBalance {
required_removed_balance: 123579000,
desired_removed_balance: 127991300, // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
desired_removed_balance: 126435860,
}
);

let original_creation_cost = 127991300; // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
let original_creation_cost = 126435860;

platform
.drive
Expand Down Expand Up @@ -4155,7 +4145,7 @@ mod tests {
None
);

assert_eq!(processing_result.aggregated_fees().processing_fee, 6133600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880);

let seller_balance = platform
.drive
Expand All @@ -4166,8 +4156,8 @@ mod tests {
// the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee
assert_eq!(
seller_balance,
dash_to_credits!(0.1) - original_creation_cost - 6349600
); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
dash_to_credits!(0.1) - original_creation_cost - 2689880
);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -4261,7 +4251,7 @@ mod tests {

assert_eq!(processing_result.aggregated_fees().storage_fee, 64611000);

assert_eq!(processing_result.aggregated_fees().processing_fee, 10210200); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 4080480);

assert_eq!(
processing_result
Expand Down Expand Up @@ -4295,8 +4285,8 @@ mod tests {
// the seller should have received 0.1 and already had 0.1 minus the processing fee and storage fee
assert_eq!(
seller_balance,
dash_to_credits!(0.2) - original_creation_cost + 16354903
); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
dash_to_credits!(0.2) - original_creation_cost + 20014623
);

let buyers_balance = platform
.drive
Expand All @@ -4305,7 +4295,7 @@ mod tests {
.expect("expected that purchaser exists");

// the buyer payed 0.1, but also storage and processing fees
assert_eq!(buyers_balance, dash_to_credits!(0.9) - 74821200); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(buyers_balance, dash_to_credits!(0.9) - 68691480);
}

#[test]
Expand Down Expand Up @@ -5171,7 +5161,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 6133600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2473880);

let query_sender_results = platform
.drive
Expand Down Expand Up @@ -5400,7 +5390,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 25600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 36200);

let sender_documents_sql_string =
format!("select * from card where $ownerId == '{}'", identity.id());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 2658800); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 1823240);

platform
.drive
Expand All @@ -322,7 +322,7 @@ mod tests {
.expect("expected to get identity balance")
.expect("expected there to be an identity balance for this identity");

assert_eq!(identity_balance, 99916071200); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(identity_balance, 99916906760);
}

#[test]
Expand Down Expand Up @@ -463,7 +463,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 10013000); // 10000000 penalty + 13800 processing
assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing

platform
.drive
Expand Down Expand Up @@ -525,7 +525,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 3263600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2098900);

platform
.drive
Expand All @@ -540,7 +540,7 @@ mod tests {
.expect("expected to get identity balance")
.expect("expected there to be an identity balance for this identity");

assert_eq!(identity_balance, 99911204400); // The identity balance is smaller than if there hadn't been any issue // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(identity_balance, 99912301400); // The identity balance is smaller than if there hadn't been any issue
}

#[test]
Expand Down Expand Up @@ -692,7 +692,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 10013000); // 10000000 penalty + 13800 processing
assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing

platform
.drive
Expand Down Expand Up @@ -917,7 +917,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 10013000); // 10000000 penalty + 13800 processing
assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 13800 processing

platform
.drive
Expand Down Expand Up @@ -1130,7 +1130,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 0);

assert_eq!(processing_result.aggregated_fees().processing_fee, 10013000); // 10000000 penalty + 13800 processing
assert_eq!(processing_result.aggregated_fees().processing_fee, 10080700); // 10000000 penalty + 80700 processing

platform
.drive
Expand Down Expand Up @@ -1215,7 +1215,7 @@ mod tests {

assert_eq!(processing_result.valid_count(), 1);

assert_eq!(processing_result.aggregated_fees().processing_fee, 3263600); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(processing_result.aggregated_fees().processing_fee, 2098900);

platform
.drive
Expand All @@ -1230,6 +1230,6 @@ mod tests {
.expect("expected to get identity balance")
.expect("expected there to be an identity balance for this identity");

assert_eq!(identity_balance, 99911204400); // The identity balance is smaller than if there hadn't been any issue // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised
assert_eq!(identity_balance, 99912301400); // The identity balance is smaller than if there hadn't been any issue
}
}
Loading

0 comments on commit 782fd97

Please sign in to comment.