Skip to content

Commit 1f5d267

Browse files
committed
Make withdraw_funds_from_object public
1 parent e670384 commit 1f5d267

File tree

17 files changed

+35
-27
lines changed

17 files changed

+35
-27
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-framework/docs/sui/balance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ accumulator.
489489
Create a <code>Withdrawal&lt;<a href="../sui/balance.md#sui_balance_Balance">Balance</a>&lt;T&gt;&gt;</code> from an object to withdraw funds from it.
490490

491491

492-
<pre><code><b>public</b>(<a href="../sui/package.md#sui_package">package</a>) <b>fun</b> <a href="../sui/balance.md#sui_balance_withdraw_funds_from_object">withdraw_funds_from_object</a>&lt;T&gt;(obj: &<b>mut</b> <a href="../sui/object.md#sui_object_UID">sui::object::UID</a>, <a href="../sui/balance.md#sui_balance_value">value</a>: u64): <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">sui::funds_accumulator::Withdrawal</a>&lt;<a href="../sui/balance.md#sui_balance_Balance">sui::balance::Balance</a>&lt;T&gt;&gt;
492+
<pre><code><b>public</b> <b>fun</b> <a href="../sui/balance.md#sui_balance_withdraw_funds_from_object">withdraw_funds_from_object</a>&lt;T&gt;(obj: &<b>mut</b> <a href="../sui/object.md#sui_object_UID">sui::object::UID</a>, <a href="../sui/balance.md#sui_balance_value">value</a>: u64): <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">sui::funds_accumulator::Withdrawal</a>&lt;<a href="../sui/balance.md#sui_balance_Balance">sui::balance::Balance</a>&lt;T&gt;&gt;
493493
</code></pre>
494494

495495

@@ -498,7 +498,7 @@ Create a <code>Withdrawal&lt;<a href="../sui/balance.md#sui_balance_Balance">Bal
498498
<summary>Implementation</summary>
499499

500500

501-
<pre><code><b>public</b>(<a href="../sui/package.md#sui_package">package</a>) <b>fun</b> <a href="../sui/balance.md#sui_balance_withdraw_funds_from_object">withdraw_funds_from_object</a>&lt;T&gt;(
501+
<pre><code><b>public</b> <b>fun</b> <a href="../sui/balance.md#sui_balance_withdraw_funds_from_object">withdraw_funds_from_object</a>&lt;T&gt;(
502502
obj: &<b>mut</b> UID,
503503
<a href="../sui/balance.md#sui_balance_value">value</a>: u64,
504504
): Withdrawal&lt;<a href="../sui/balance.md#sui_balance_Balance">Balance</a>&lt;T&gt;&gt; {

crates/sui-framework/docs/sui/funds_accumulator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Aborts with <code><a href="../sui/funds_accumulator.md#sui_funds_accumulator_EOv
227227

228228

229229

230-
<pre><code><b>public</b>(<a href="../sui/package.md#sui_package">package</a>) <b>fun</b> <a href="../sui/funds_accumulator.md#sui_funds_accumulator_redeem">redeem</a>&lt;T: store&gt;(withdrawal: <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">sui::funds_accumulator::Withdrawal</a>&lt;T&gt;): T
230+
<pre><code><b>public</b> <b>fun</b> <a href="../sui/funds_accumulator.md#sui_funds_accumulator_redeem">redeem</a>&lt;T: store&gt;(withdrawal: <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">sui::funds_accumulator::Withdrawal</a>&lt;T&gt;): T
231231
</code></pre>
232232

233233

@@ -236,7 +236,7 @@ Aborts with <code><a href="../sui/funds_accumulator.md#sui_funds_accumulator_EOv
236236
<summary>Implementation</summary>
237237

238238

239-
<pre><code><b>public</b>(<a href="../sui/package.md#sui_package">package</a>) <b>fun</b> <a href="../sui/funds_accumulator.md#sui_funds_accumulator_redeem">redeem</a>&lt;/* internal */ T: store&gt;(withdrawal: <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">Withdrawal</a>&lt;T&gt;): T {
239+
<pre><code><b>public</b> <b>fun</b> <a href="../sui/funds_accumulator.md#sui_funds_accumulator_redeem">redeem</a>&lt;/* internal */ T: store&gt;(withdrawal: <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">Withdrawal</a>&lt;T&gt;): T {
240240
<b>let</b> <a href="../sui/funds_accumulator.md#sui_funds_accumulator_Withdrawal">Withdrawal</a> { owner, limit: value } = withdrawal;
241241
<a href="../sui/funds_accumulator.md#sui_funds_accumulator_withdraw_impl">withdraw_impl</a>(owner, value)
242242
}

crates/sui-framework/packages/sui-framework/sources/balance.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public fun redeem_funds<T>(withdrawal: sui::funds_accumulator::Withdrawal<Balanc
110110
}
111111

112112
/// Create a `Withdrawal<Balance<T>>` from an object to withdraw funds from it.
113-
public(package) fun withdraw_funds_from_object<T>(
113+
public fun withdraw_funds_from_object<T>(
114114
obj: &mut UID,
115115
value: u64,
116116
): Withdrawal<Balance<T>> {

crates/sui-framework/packages/sui-framework/sources/funds_accumulator.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public fun withdrawal_join<T: store>(withdrawal: &mut Withdrawal<T>, other: With
7171
// TODO When this becomes `public` we need
7272
// - custom verifier rules for `T`
7373
// - private generic rules for `T`
74-
public(package) fun redeem</* internal */ T: store>(withdrawal: Withdrawal<T>): T {
74+
public fun redeem</* internal */ T: store>(withdrawal: Withdrawal<T>): T {
7575
let Withdrawal { owner, limit: value } = withdrawal;
7676
withdraw_impl(owner, value)
7777
}
0 Bytes
Binary file not shown.

crates/sui-framework/published_api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ withdrawal_join
18171817
public fun
18181818
0x2::funds_accumulator
18191819
redeem
1820-
public(package) fun
1820+
public fun
18211821
0x2::funds_accumulator
18221822
withdraw_from_object
18231823
public(package) fun
@@ -1880,7 +1880,7 @@ redeem_funds
18801880
public fun
18811881
0x2::balance
18821882
withdraw_funds_from_object
1883-
public(package) fun
1883+
public fun
18841884
0x2::balance
18851885
create_supply_internal
18861886
public(package) fun

0 commit comments

Comments
 (0)