Skip to content

Commit

Permalink
refactor/feat:(iota-indexer, iota-types, iota-json-rpc-types): remove…
Browse files Browse the repository at this point in the history
… storage_fund_reinvestment mentions from code base (#996)

* refactor/feat:(iota-indexer, iota-types, iota-json-rpc-types): 
remove storage_fund_reinvestment mentions from code base (Rust, Move parts)
add new migration to remove reinvestment column
  • Loading branch information
Dkwcs authored Jul 25, 2024
1 parent e1e307c commit 5d00979
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,6 @@ total_stake: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>
storage_fund_reinvestment: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>
Expand Down Expand Up @@ -2389,8 +2382,6 @@ or smaller than the computation reward.
reference_gas_price: self.reference_gas_price,
total_stake: new_total_stake,
storage_charge: storage_charge_value,
// TODO: remove(obsolete)
storage_fund_reinvestment: 0,
storage_rebate: storage_rebate_amount,
storage_fund_balance: self.<Link to="storage_fund#0x3_storage_fund">storage_fund</Link>.total_balance(),
// TODO: remove(obsolete)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ module iota_system::iota_system_state_inner {
protocol_version: u64,
reference_gas_price: u64,
total_stake: u64,
storage_fund_reinvestment: u64,
storage_charge: u64,
storage_rebate: u64,
storage_fund_balance: u64,
Expand Down Expand Up @@ -932,8 +931,6 @@ module iota_system::iota_system_state_inner {
reference_gas_price: self.reference_gas_price,
total_stake: new_total_stake,
storage_charge: storage_charge_value,
// TODO: remove(obsolete)
storage_fund_reinvestment: 0,
storage_rebate: storage_rebate_amount,
storage_fund_balance: self.storage_fund.total_balance(),
// TODO: remove(obsolete)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE epochs ADD COLUMN storage_fund_reinvestment BIGINT;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE epochs DROP COLUMN storage_fund_reinvestment;
6 changes: 0 additions & 6 deletions crates/iota-indexer/src/models/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub struct StoredEpochInfo {
pub epoch_total_transactions: Option<i64>,
pub last_checkpoint_id: Option<i64>,
pub epoch_end_timestamp: Option<i64>,
// TODO: remove(obsolete)
pub storage_fund_reinvestment: Option<i64>,
pub storage_charge: Option<i64>,
pub storage_rebate: Option<i64>,
// TODO: remove(obsolete)
Expand All @@ -49,8 +47,6 @@ pub struct QueryableEpochInfo {
pub epoch_total_transactions: Option<i64>,
pub last_checkpoint_id: Option<i64>,
pub epoch_end_timestamp: Option<i64>,
// TODO: remove(obsolete)
pub storage_fund_reinvestment: Option<i64>,
pub storage_charge: Option<i64>,
pub storage_rebate: Option<i64>,
// TODO: remove(obsolete)
Expand Down Expand Up @@ -90,7 +86,6 @@ impl StoredEpochInfo {
epoch_total_transactions: e.epoch_total_transactions.map(|v| v as i64),
last_checkpoint_id: e.last_checkpoint_id.map(|v| v as i64),
epoch_end_timestamp: e.epoch_end_timestamp.map(|v| v as i64),
storage_fund_reinvestment: e.storage_fund_reinvestment.map(|v| v as i64),
storage_charge: e.storage_charge.map(|v| v as i64),
storage_rebate: e.storage_rebate.map(|v| v as i64),
stake_subsidy_amount: e.stake_subsidy_amount.map(|v| v as i64),
Expand Down Expand Up @@ -127,7 +122,6 @@ impl From<&StoredEpochInfo> for Option<EndOfEpochInfo> {
total_stake: info.total_stake as u64,
storage_fund_balance: info.storage_fund_balance as u64,
epoch_end_timestamp: info.epoch_end_timestamp.map(|v| v as u64)?,
storage_fund_reinvestment: info.storage_fund_reinvestment.map(|v| v as u64)?,
storage_charge: info.storage_charge.map(|v| v as u64)?,
storage_rebate: info.storage_rebate.map(|v| v as u64)?,
stake_subsidy_amount: info.stake_subsidy_amount.map(|v| v as u64)?,
Expand Down
1 change: 0 additions & 1 deletion crates/iota-indexer/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ diesel::table! {
epoch_total_transactions -> Nullable<Int8>,
last_checkpoint_id -> Nullable<Int8>,
epoch_end_timestamp -> Nullable<Int8>,
storage_fund_reinvestment -> Nullable<Int8>,
storage_charge -> Nullable<Int8>,
storage_rebate -> Nullable<Int8>,
stake_subsidy_amount -> Nullable<Int8>,
Expand Down
2 changes: 0 additions & 2 deletions crates/iota-indexer/src/store/pg_indexer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,6 @@ impl PgIndexerStore {
.eq(excluded(epochs::epoch_total_transactions)),
epochs::last_checkpoint_id.eq(excluded(epochs::last_checkpoint_id)),
epochs::epoch_end_timestamp.eq(excluded(epochs::epoch_end_timestamp)),
epochs::storage_fund_reinvestment
.eq(excluded(epochs::storage_fund_reinvestment)),
epochs::storage_charge.eq(excluded(epochs::storage_charge)),
epochs::storage_rebate.eq(excluded(epochs::storage_rebate)),
epochs::stake_subsidy_amount.eq(excluded(epochs::stake_subsidy_amount)),
Expand Down
3 changes: 0 additions & 3 deletions crates/iota-indexer/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ pub struct IndexedEpochInfo {
pub epoch_total_transactions: Option<u64>,
pub last_checkpoint_id: Option<u64>,
pub epoch_end_timestamp: Option<u64>,
// TODO: remove(obsolete)
pub storage_fund_reinvestment: Option<u64>,
pub storage_charge: Option<u64>,
pub storage_rebate: Option<u64>,
// TODO: remove(obsolete)
Expand Down Expand Up @@ -148,7 +146,6 @@ impl IndexedEpochInfo {
),
last_checkpoint_id: Some(*last_checkpoint_summary.sequence_number()),
epoch_end_timestamp: Some(last_checkpoint_summary.timestamp_ms),
storage_fund_reinvestment: Some(event.storage_fund_reinvestment),
storage_charge: Some(event.storage_charge),
storage_rebate: Some(event.storage_rebate),
burnt_leftover_amount: Some(event.burnt_leftover_amount),
Expand Down
3 changes: 0 additions & 3 deletions crates/iota-json-rpc-types/src/iota_extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ pub struct EndOfEpochInfo {
pub total_stake: u64,
#[schemars(with = "BigInt<u64>")]
#[serde_as(as = "BigInt<u64>")]
pub storage_fund_reinvestment: u64,
#[schemars(with = "BigInt<u64>")]
#[serde_as(as = "BigInt<u64>")]
pub storage_charge: u64,
#[schemars(with = "BigInt<u64>")]
#[serde_as(as = "BigInt<u64>")]
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,6 @@ pub struct ProtocolConfig {
/// storage rebate back. In basis point.
storage_rebate_rate: Option<u64>,

/// 5% of the storage fund's share of rewards are reinvested into the
/// storage fund. In basis point.
storage_fund_reinvest_rate: Option<u64>,

/// The share of rewards that will be slashed and redistributed is 50%.
/// In basis point.
reward_slashing_rate: Option<u64>,
Expand Down Expand Up @@ -1362,7 +1358,6 @@ impl ProtocolConfig {
obj_metadata_cost_non_refundable: Some(50),
gas_model_version: Some(8),
storage_rebate_rate: Some(10000),
storage_fund_reinvest_rate: Some(0),
// Change reward slashing rate to 100%.
reward_slashing_rate: Some(10000),
storage_gas_price: Some(76),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ gas_model_version: 8
obj_data_cost_refundable: 100
obj_metadata_cost_non_refundable: 50
storage_rebate_rate: 10000
storage_fund_reinvest_rate: 0
reward_slashing_rate: 10000
storage_gas_price: 76
validator_target_reward: 767000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ gas_model_version: 8
obj_data_cost_refundable: 100
obj_metadata_cost_non_refundable: 50
storage_rebate_rate: 10000
storage_fund_reinvest_rate: 0
reward_slashing_rate: 10000
storage_gas_price: 76
validator_target_reward: 767000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ gas_model_version: 8
obj_data_cost_refundable: 100
obj_metadata_cost_non_refundable: 50
storage_rebate_rate: 10000
storage_fund_reinvest_rate: 0
reward_slashing_rate: 10000
storage_gas_price: 76
validator_target_reward: 767000000000000
Expand Down
2 changes: 0 additions & 2 deletions crates/iota-types/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ pub struct SystemEpochInfoEvent {
pub protocol_version: u64,
pub reference_gas_price: u64,
pub total_stake: u64,
// TODO: remove(obsolete)
pub storage_fund_reinvestment: u64,
pub storage_charge: u64,
pub storage_rebate: u64,
pub storage_fund_balance: u64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub struct IotaSystemStateSummary {
#[schemars(with = "BigInt<u64>")]
#[serde_as(as = "Readable<BigInt<u64>, _>")]
pub storage_fund_total_object_storage_rebates: u64,
/// The non-refundable portion of the storage fund coming from storage
/// reinvestment, non-refundable storage rebates and any leftover
/// The non-refundable portion of the storage fund coming from
/// non-refundable storage rebates and any leftover
/// staking rewards.
#[schemars(with = "BigInt<u64>")]
#[serde_as(as = "Readable<BigInt<u64>, _>")]
Expand Down

0 comments on commit 5d00979

Please sign in to comment.