Skip to content

Commit

Permalink
Revert "had to comment two things to get test to pass"
Browse files Browse the repository at this point in the history
This reverts commit 4974ea9.
  • Loading branch information
gregorycoppola committed Nov 19, 2021
1 parent 4974ea9 commit 9875c5d
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/vm/tests/costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,6 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
];

let bad_proposals = bad_cases.len();
let voting_contract_to_use: &QualifiedContractIdentifier = if use_mainnet {
&COST_VOTING_MAINNET_CONTRACT
} else {
&COST_VOTING_TESTNET_CONTRACT
};

{
let mut store = marf_kv.begin(&StacksBlockId([1 as u8; 32]), &StacksBlockId([2 as u8; 32]));
Expand All @@ -1217,7 +1212,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
db.begin();

db.set_variable_unknown_descriptor(
voting_contract_to_use,
&COST_VOTING_TESTNET_CONTRACT,
"confirmed-proposal-count",
Value::UInt(bad_proposals as u128),
)
Expand All @@ -1235,7 +1230,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
intercepted_ct, intercepted_f, cost_ct, cost_f
);
db.set_entry_unknown_descriptor(
voting_contract_to_use,
&COST_VOTING_TESTNET_CONTRACT,
"confirmed-proposals",
execute(&format!("{{ confirmed-id: u{} }}", ix)),
execute(&value),
Expand Down Expand Up @@ -1272,7 +1267,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
for (target, referenced_function) in tracker.cost_function_references().into_iter() {
assert_eq!(
&referenced_function.contract_id,
&boot_code_id("costs", use_mainnet),
&boot_code_id("costs", false),
"All cost functions should still point to the boot costs"
);
assert_eq!(
Expand Down Expand Up @@ -1315,7 +1310,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {

let good_proposals = good_cases.len() as u128;
db.set_variable_unknown_descriptor(
voting_contract_to_use,
&COST_VOTING_TESTNET_CONTRACT,
"confirmed-proposal-count",
Value::UInt(bad_proposals as u128 + good_proposals),
)
Expand All @@ -1333,7 +1328,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
intercepted_ct, intercepted_f, cost_ct, cost_f
);
db.set_entry_unknown_descriptor(
voting_contract_to_use,
&COST_VOTING_TESTNET_CONTRACT,
"confirmed-proposals",
execute(&format!("{{ confirmed-id: u{} }}", ix + bad_proposals)),
execute(&value),
Expand Down Expand Up @@ -1365,8 +1360,7 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {
let (_db, tracker) = owned_env.destruct().unwrap();

// cost of `le` should be less now, because the proposal made it free
// DO NOT SUBMIT: why does this fail?
// assert!(le_cost_without_interception.exceeds(&tracker.get_total()));
assert!(le_cost_without_interception.exceeds(&tracker.get_total()));

let circuits = tracker.contract_call_circuits();
assert_eq!(circuits.len(), 2);
Expand All @@ -1385,13 +1379,12 @@ fn test_cost_voting_integration(#[case] use_mainnet: bool) {

for (target, referenced_function) in tracker.cost_function_references().into_iter() {
if target == &ClarityCostFunction::Le {
// DO NOT SUBMIT: uncomment
// assert_eq!(&referenced_function.contract_id, &cost_definer);
// assert_eq!(&referenced_function.function_name, "cost-definition-le");
assert_eq!(&referenced_function.contract_id, &cost_definer);
assert_eq!(&referenced_function.function_name, "cost-definition-le");
} else {
assert_eq!(
&referenced_function.contract_id,
&boot_code_id("costs", use_mainnet),
&boot_code_id("costs", false),
"Cost function should still point to the boot costs"
);
assert_eq!(
Expand Down

0 comments on commit 9875c5d

Please sign in to comment.