You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Struct representing the storage fund, containing two <code>Balance</code>s:
58
58
- <code><ahref="../sui_system/storage_fund.md#sui_system_storage_fund_total_object_storage_rebates">total_object_storage_rebates</a></code> has the invariant that it's the sum of <code>storage_rebate</code> of
59
-
all objects currently stored on-chain. To maintain this invariant, the only inflow of this
60
-
balance is storage charges collected from transactions, and the only outflow is storage rebates
61
-
of transactions, including both the portion refunded to the transaction senders as well as
62
-
the non-refundable portion taken out and put into <code>non_refundable_balance</code>.
59
+
all objects currently stored on-chain. To maintain this invariant, the only inflow of this
60
+
balance is storage charges collected from transactions, and the only outflow is storage rebates
61
+
of transactions, including both the portion refunded to the transaction senders as well as
62
+
the non-refundable portion taken out and put into <code>non_refundable_balance</code>.
63
63
- <code>non_refundable_balance</code> contains any remaining inflow of the storage fund that should not
64
-
be taken out of the fund.
64
+
be taken out of the fund.
65
65
66
66
67
67
<pre><code><b>public</b> <b>struct</b> <ahref="../sui_system/storage_fund.md#sui_system_storage_fund_StorageFund">StorageFund</a> <b>has</b> store
Copy file name to clipboardExpand all lines: crates/sui-framework/docs/sui_system/sui_system.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,9 @@ To properly upgrade the <code>SuiSystemStateInner</code> type, we need to ship a
15
15
1. Define a new <code>SuiSystemStateInner</code>type (e.g. <code>SuiSystemStateInnerV2</code>).
16
16
2. Define a data migration function that migrates the old <code>SuiSystemStateInner</code> to the new one (i.e. SuiSystemStateInnerV2).
17
17
3. Replace all uses of <code>SuiSystemStateInner</code> with <code>SuiSystemStateInnerV2</code> in both sui_system.move and sui_system_state_inner.move,
18
-
with the exception of the <code><ahref="../sui_system/sui_system_state_inner.md#sui_system_sui_system_state_inner_create">sui_system_state_inner::create</a></code> function, which should always return the genesis type.
18
+
with the exception of the <code><ahref="../sui_system/sui_system_state_inner.md#sui_system_sui_system_state_inner_create">sui_system_state_inner::create</a></code> function, which should always return the genesis type.
19
19
4. Inside <code><ahref="../sui_system/sui_system.md#sui_system_sui_system_load_inner_maybe_upgrade">load_inner_maybe_upgrade</a></code> function, check the current version in the wrapper, and if it's not the latest version,
20
-
call the data migration function to upgrade the inner object. Make sure to also update the version in the wrapper.
20
+
call the data migration function to upgrade the inner object. Make sure to also update the version in the wrapper.
21
21
A detailed example can be found in sui/tests/framework_upgrades/mock_sui_systems/shallow_upgrade.
22
22
Along with the Move change, we also need to update the Rust code to support the new type. This includes:
23
23
1. Define a new <code>SuiSystemStateInner</code> struct type that matches the new Move type, and implement the SuiSystemStateTrait.
@@ -32,7 +32,7 @@ To upgrade Validator type, besides everything above, we also need to:
32
32
2. Define a data migration function that migrates the old Validator to the new one (i.e. ValidatorV2).
33
33
3. Replace all uses of Validator with ValidatorV2 except the genesis creation function.
34
34
4. In validator_wrapper::upgrade_to_latest, check the current version in the wrapper, and if it's not the latest version,
35
-
call the data migration function to upgrade it.
35
+
call the data migration function to upgrade it.
36
36
In Rust, we also need to add a new case in <code>get_validator_from_table</code>.
37
37
Note that it is possible to upgrade SuiSystemStateInner without upgrading Validator, but not the other way around.
38
38
And when we only upgrade SuiSystemStateInner, the version of Validator in the wrapper will not be updated, and hence may become
@@ -1556,7 +1556,7 @@ This function should be called at the end of an epoch, and advances the system t
1556
1556
It does the following things:
1557
1557
1. Add storage charge to the storage fund.
1558
1558
2. Burn the storage rebates from the storage fund. These are already refunded to transaction sender's
1559
-
gas coins.
1559
+
gas coins.
1560
1560
3. Distribute computation charge to validator stake.
0 commit comments