Skip to content

Commit e7b3047

Browse files
committed
Allow disabling accumulator
1 parent e670384 commit e7b3047

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

crates/sui-core/src/authority/shared_object_version_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ mod tests {
10141014
// Create a shared object for testing
10151015
let shared_objects = vec![Object::shared_for_testing()];
10161016
let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
1017-
config.enable_accumulators_for_testing();
1017+
config.set_enable_accumulators_for_testing(true);
10181018
let authority = TestAuthorityBuilder::new()
10191019
.with_starting_objects(&shared_objects)
10201020
.with_protocol_config(config)

crates/sui-core/src/execution_scheduler/balance_withdraw_scheduler/e2e_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async fn create_test_env(init_balances: BTreeMap<TypeTag, u64>) -> TestEnv {
6262
let account_objects = starting_objects.iter().map(|o| o.id()).collect();
6363
starting_objects.push(gas_object.clone());
6464
let mut protocol_config = ProtocolConfig::get_for_max_version_UNSAFE();
65-
protocol_config.enable_accumulators_for_testing();
65+
protocol_config.set_enable_accumulators_for_testing(true);
6666
let state = TestAuthorityBuilder::new()
6767
.with_protocol_config(protocol_config)
6868
.with_starting_objects(&starting_objects)

crates/sui-core/src/unit_tests/coin_deny_list_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ async fn new_authority_and_publish(path: &str) -> TestEnv {
418418

419419
let mut protocol_config =
420420
ProtocolConfig::get_for_version(ProtocolVersion::max(), Chain::Unknown);
421-
protocol_config.enable_accumulators_for_testing();
421+
protocol_config.set_enable_accumulators_for_testing(true);
422422
protocol_config
423423
.set_per_object_congestion_control_mode_for_testing(PerObjectCongestionControlMode::None);
424424

crates/sui-e2e-tests/tests/address_balance_tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async fn test_accumulators_root_created() {
105105
cfg.set_buffer_stake_for_protocol_upgrade_bps_for_testing(0);
106106
}
107107
if version == ProtocolVersion::MAX_ALLOWED {
108-
cfg.enable_accumulators_for_testing();
108+
cfg.set_enable_accumulators_for_testing(true);
109109
}
110110
cfg
111111
});
@@ -176,7 +176,7 @@ async fn test_accumulators_disabled() {
176176
cfg.set_buffer_stake_for_protocol_upgrade_bps_for_testing(0);
177177
}
178178
if version == ProtocolVersion::MAX_ALLOWED {
179-
cfg.enable_accumulators_for_testing();
179+
cfg.set_enable_accumulators_for_testing(true);
180180
}
181181
cfg
182182
});
@@ -293,7 +293,7 @@ async fn test_accumulators_disabled() {
293293
async fn test_deposits() {
294294
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
295295
cfg.create_root_accumulator_object_for_testing();
296-
cfg.enable_accumulators_for_testing();
296+
cfg.set_enable_accumulators_for_testing(true);
297297
cfg
298298
});
299299

@@ -347,7 +347,7 @@ async fn test_deposits() {
347347
#[sim_test]
348348
async fn test_multiple_settlement_txns() {
349349
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
350-
cfg.enable_accumulators_for_testing();
350+
cfg.set_enable_accumulators_for_testing(true);
351351
cfg.set_max_updates_per_settlement_txn_for_testing(3);
352352
cfg
353353
});
@@ -463,7 +463,7 @@ fn verify_accumulator_exists(
463463
async fn test_deposit_and_withdraw() {
464464
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
465465
cfg.create_root_accumulator_object_for_testing();
466-
cfg.enable_accumulators_for_testing();
466+
cfg.set_enable_accumulators_for_testing(true);
467467
cfg
468468
});
469469

@@ -510,7 +510,7 @@ async fn test_deposit_and_withdraw() {
510510
async fn test_deposit_and_withdraw_with_larger_reservation() {
511511
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
512512
cfg.create_root_accumulator_object_for_testing();
513-
cfg.enable_accumulators_for_testing();
513+
cfg.set_enable_accumulators_for_testing(true);
514514
cfg
515515
});
516516

@@ -543,7 +543,7 @@ async fn test_deposit_and_withdraw_with_larger_reservation() {
543543
async fn test_withdraw_non_existent_balance() {
544544
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
545545
cfg.create_root_accumulator_object_for_testing();
546-
cfg.enable_accumulators_for_testing();
546+
cfg.set_enable_accumulators_for_testing(true);
547547
cfg
548548
});
549549

@@ -572,7 +572,7 @@ async fn test_withdraw_non_existent_balance() {
572572
async fn test_withdraw_insufficient_balance() {
573573
let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
574574
cfg.create_root_accumulator_object_for_testing();
575-
cfg.enable_accumulators_for_testing();
575+
cfg.set_enable_accumulators_for_testing(true);
576576
cfg
577577
});
578578

crates/sui-protocol-config/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4206,7 +4206,7 @@ impl ProtocolConfig {
42064206
95 => {
42074207
cfg.type_name_id_base_cost = Some(52);
42084208

4209-
// Reudce the frequency of checkpoint splitting under high TPS.
4209+
// Reduce the frequency of checkpoint splitting under high TPS.
42104210
cfg.max_transactions_per_checkpoint = Some(20_000);
42114211
}
42124212
96 => {
@@ -4581,8 +4581,8 @@ impl ProtocolConfig {
45814581
.prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
45824582
}
45834583

4584-
pub fn enable_accumulators_for_testing(&mut self) {
4585-
self.feature_flags.enable_accumulators = true;
4584+
pub fn set_enable_accumulators_for_testing(&mut self, val: bool) {
4585+
self.feature_flags.enable_accumulators = val;
45864586
}
45874587

45884588
pub fn create_root_accumulator_object_for_testing(&mut self) {
@@ -4596,7 +4596,7 @@ impl ProtocolConfig {
45964596
}
45974597

45984598
pub fn enable_authenticated_event_streams_for_testing(&mut self) {
4599-
self.enable_accumulators_for_testing();
4599+
self.set_enable_accumulators_for_testing(true);
46004600
self.feature_flags.enable_authenticated_event_streams = true;
46014601
self.feature_flags
46024602
.include_checkpoint_artifacts_digest_in_summary = true;

crates/sui-transactional-test-runner/src/simulator_persisted_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl PersistedStore {
135135
move |_, cfg| {
136136
let mut c = cfg;
137137
if enable_accumulators {
138-
c.enable_accumulators_for_testing();
138+
c.set_enable_accumulators_for_testing(true);
139139
}
140140
if enable_authenticated_event_streams {
141141
c.enable_authenticated_event_streams_for_testing();

crates/sui-transactional-test-runner/src/test_adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl AdapterInitConfig {
269269
ProtocolConfig::get_for_max_version_UNSAFE()
270270
};
271271
if enable_accumulators {
272-
protocol_config.enable_accumulators_for_testing();
272+
protocol_config.set_enable_accumulators_for_testing(true);
273273
}
274274
if enable_authenticated_event_streams {
275275
protocol_config.enable_authenticated_event_streams_for_testing();

crates/sui-types/src/unit_tests/address_balance_gas_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn test_address_balance_payment_requires_accumulators_enabled() {
6666
#[test]
6767
fn test_address_balance_payment_requires_feature_flag() {
6868
let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
69-
config.enable_accumulators_for_testing();
69+
config.set_enable_accumulators_for_testing(true);
7070

7171
let tx_data = create_test_transaction_data(
7272
vec![],

crates/sui-types/src/unit_tests/balance_withdraw_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616

1717
fn protocol_config() -> ProtocolConfig {
1818
let mut cfg = ProtocolConfig::get_for_max_version_UNSAFE();
19-
cfg.enable_accumulators_for_testing();
19+
cfg.set_enable_accumulators_for_testing(true);
2020
cfg
2121
}
2222

0 commit comments

Comments
 (0)