Skip to content

Commit

Permalink
Fix increase_storage_compute_cost tests (#11133)
Browse files Browse the repository at this point in the history
This fixes #10979
  • Loading branch information
aborg-dev authored Apr 23, 2024
1 parent 8b82e1b commit 7e530dc
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use near_primitives::transaction::{
};
use near_primitives::types::AccountId;
use near_primitives::version::ProtocolFeature;
use near_primitives_core::version::PROTOCOL_VERSION;
use nearcore::test_utils::TestEnvNightshadeSetupExt;

/// Tracked in https://github.com/near/nearcore/issues/8938
Expand All @@ -33,8 +34,6 @@ enum Expectation {
}

/// Test that `storage_write` compute limit is respected in new version.
// TODO(10979): Fix and enable this test.
#[ignore]
#[test]
fn test_storage_write() {
// `insert_strings(from: u64, to: u64)` makes (`to` - `from`) `storage_write` calls.
Expand All @@ -57,8 +56,6 @@ fn test_storage_write() {
}

/// Test that `storage_remove` compute limit is respected in new version.
// TODO(10979): Fix and enable this test.
#[ignore]
#[test]
fn test_storage_remove() {
// `delete_strings(from: u64, to: u64)` makes (`to` - `from`) `storage_remove` calls.
Expand All @@ -82,8 +79,6 @@ fn test_storage_remove() {

/// Test that `storage_write` compute limit is respected in new version,
/// specifically when running out of gas.
// TODO(10979): Fix and enable this test.
#[ignore]
#[test]
fn test_storage_write_gas_exceeded() {
// `insert_strings(from: u64, to: u64)` makes (`to` - `from`) `storage_write` calls.
Expand All @@ -107,8 +102,6 @@ fn test_storage_write_gas_exceeded() {
}

/// Check receipts that don't touch storage are unaffected by the new compute costs.
// TODO(10979): Fix and enable this test.
#[ignore]
#[test]
fn test_non_storage() {
// `sum_n(u64)` just does some WASM computation.
Expand Down Expand Up @@ -139,8 +132,6 @@ fn test_non_storage() {
}

/// Test the case where a function call fails and the limit is unaffected by compute costs.
// TODO(10979): Fix and enable this test.
#[ignore]
#[test]
fn test_non_storage_gas_exceeded() {
// `loop_forever()` loops until either gas is exhausted.
Expand Down Expand Up @@ -189,12 +180,12 @@ fn assert_compute_limit_reached(
std::env::set_var("NEAR_TESTS_IMMEDIATE_PROTOCOL_UPGRADE", "1");
near_o11y::testonly::init_test_logger();

let new_protocol_version = INCREASED_STORAGE_COSTS_PROTOCOL_VERSION;
let old_protocol_version = INCREASED_STORAGE_COSTS_PROTOCOL_VERSION - 1;
let new_protocol_version = PROTOCOL_VERSION;
assert!(
new_protocol_version >= ProtocolFeature::ComputeCosts.protocol_version(),
"relies on compute costs feature"
);
let old_protocol_version = new_protocol_version - 1;

// Prepare TestEnv with a contract at the old protocol version.
let epoch_length = 100;
Expand Down

0 comments on commit 7e530dc

Please sign in to comment.