Skip to content

Commit

Permalink
Remove methods moved to forest shim (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank authored Dec 12, 2024
1 parent 0850e23 commit 92fad01
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 225 deletions.
23 changes: 5 additions & 18 deletions actors/market/src/v10/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,22 +901,6 @@ impl State {
ret
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")
}

// Return true when the funds in escrow for the input address can cover an additional lockup of amountToLock
pub fn balance_covered<BS>(
&self,
Expand All @@ -927,8 +911,11 @@ impl State {
where
BS: Blockstore,
{
let escrow_table = self.escrow_table(store)?;
let locked_table = self.locked_table(store)?;
let escrow_table = BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")?;

let locked_table = BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")?;

let escrow_balance = escrow_table
.get(&addr)
Expand Down
23 changes: 5 additions & 18 deletions actors/market/src/v11/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,22 +891,6 @@ impl State {
ret
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")
}

// Return true when the funds in escrow for the input address can cover an additional lockup of amountToLock
pub fn balance_covered<BS>(
&self,
Expand All @@ -917,8 +901,11 @@ impl State {
where
BS: Blockstore,
{
let escrow_table = self.escrow_table(store)?;
let locked_table = self.locked_table(store)?;
let escrow_table = BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")?;

let locked_table = BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")?;

let escrow_balance = escrow_table
.get(&addr)
Expand Down
18 changes: 2 additions & 16 deletions actors/market/src/v12/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,20 +858,6 @@ impl State {
ret
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table, "escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table, "locked table")
}

// Return true when the funds in escrow for the input address can cover an additional lockup of amountToLock
pub fn balance_covered<BS>(
&self,
Expand All @@ -882,8 +868,8 @@ impl State {
where
BS: Blockstore,
{
let escrow_table = self.escrow_table(store)?;
let locked_table = self.locked_table(store)?;
let escrow_table = BalanceTable::from_root(store, &self.escrow_table, "escrow table")?;
let locked_table = BalanceTable::from_root(store, &self.locked_table, "locked table")?;

let escrow_balance = escrow_table.get(&addr)?;
let prev_locked = locked_table.get(&addr)?;
Expand Down
18 changes: 2 additions & 16 deletions actors/market/src/v13/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,29 +1186,15 @@ impl State {
ret
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table, "escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table, "locked table")
}

// Return true when the funds in escrow for the input address can cover an additional lockup of amountToLock
pub fn balance_covered<BS: Blockstore>(
&self,
store: &BS,
addr: Address,
amount_to_lock: &TokenAmount,
) -> Result<bool, ActorError> {
let escrow_table = self.escrow_table(store)?;
let locked_table = self.locked_table(store)?;
let escrow_table = BalanceTable::from_root(store, &self.escrow_table, "escrow table")?;
let locked_table = BalanceTable::from_root(store, &self.locked_table, "locked table")?;

let escrow_balance = escrow_table.get(&addr)?;
let prev_locked = locked_table.get(&addr)?;
Expand Down
14 changes: 0 additions & 14 deletions actors/market/src/v14/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,20 +1174,6 @@ impl State {
ret
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table, "escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table, "locked table")
}

// Return true when the funds in escrow for the input address can cover an additional lockup of amountToLock
pub fn balance_covered<BS>(
&self,
Expand Down
14 changes: 0 additions & 14 deletions actors/market/src/v15/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,6 @@ impl State {
Ok(removed)
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table, "escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table, "locked table")
}

/// Verify that a given set of storage deals is valid for a sector currently being PreCommitted
pub fn verify_deals_for_activation<BS>(
&self,
Expand Down
14 changes: 0 additions & 14 deletions actors/market/src/v16/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,20 +664,6 @@ impl State {
Ok(removed)
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table, "escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<&'a BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table, "locked table")
}

/// Verify that a given set of storage deals is valid for a sector currently being PreCommitted
pub fn verify_deals_for_activation<BS>(
&self,
Expand Down
19 changes: 1 addition & 18 deletions actors/market/src/v8/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
use super::balance_table::BalanceTable;
use anyhow::anyhow;
use cid::Cid;
use fil_actors_shared::v8::{make_empty_map, ActorError, Array, AsActorError as _, SetMultimap};
use fil_actors_shared::v8::{make_empty_map, Array, SetMultimap};
use fvm_ipld_blockstore::Blockstore;
use fvm_ipld_encoding::tuple::*;
use fvm_shared::clock::{ChainEpoch, EPOCH_UNDEFINED};
use fvm_shared::deal::DealID;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ExitCode;
use fvm_shared::HAMT_BIT_WIDTH;

use super::types::*;
Expand Down Expand Up @@ -97,20 +96,4 @@ impl State {
+ &self.total_provider_locked_collateral
+ &self.total_client_storage_fee
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")
}
}
19 changes: 1 addition & 18 deletions actors/market/src/v9/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use super::balance_table::BalanceTable;
use anyhow::anyhow;
use cid::Cid;
use fil_actor_verifreg_state::v9::AllocationID;
use fil_actors_shared::v9::{make_empty_map, ActorError, Array, AsActorError as _, SetMultimap};
use fil_actors_shared::v9::{make_empty_map, Array, SetMultimap};
use fvm_ipld_blockstore::Blockstore;
use fvm_ipld_encoding::tuple::*;
use fvm_shared::clock::{ChainEpoch, EPOCH_UNDEFINED};
use fvm_shared::deal::DealID;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ExitCode;
use fvm_shared::HAMT_BIT_WIDTH;

use super::types::*;
Expand Down Expand Up @@ -107,20 +106,4 @@ impl State {
+ &self.total_provider_locked_collateral
+ &self.total_client_storage_fee
}

pub fn escrow_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.escrow_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load escrow table")
}

pub fn locked_table<'a, BS: Blockstore>(
&self,
store: &'a BS,
) -> Result<BalanceTable<'a, BS>, ActorError> {
BalanceTable::from_root(store, &self.locked_table)
.context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load locked table")
}
}
1 change: 0 additions & 1 deletion actors/reward/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ version.workspace = true
keywords.workspace = true

[dependencies]
fil_actor_miner_state = { workspace = true }
fil_actors_shared = { workspace = true }
fvm_ipld_encoding = { workspace = true }
fvm_shared = { workspace = true }
Expand Down
13 changes: 0 additions & 13 deletions actors/reward/src/v11/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ impl State {
pub fn into_total_storage_power_reward(self) -> TokenAmount {
self.total_storage_power_reward
}

pub fn pre_commit_deposit_for_power(
&self,
reward_estimate: &FilterEstimate,
network_qa_power_estimate: &FilterEstimate,
qa_sector_power: &StoragePower,
) -> TokenAmount {
fil_actor_miner_state::v11::pre_commit_deposit_for_power(
reward_estimate,
network_qa_power_estimate,
qa_sector_power,
)
}
}

/// Defines vestion function type for reward actor.
Expand Down
13 changes: 0 additions & 13 deletions actors/reward/src/v12/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,6 @@ impl State {
pub fn into_total_storage_power_reward(self) -> TokenAmount {
self.total_storage_power_reward
}

pub fn pre_commit_deposit_for_power(
&self,
reward_estimate: &FilterEstimate,
network_qa_power_estimate: &FilterEstimate,
qa_sector_power: &StoragePower,
) -> TokenAmount {
fil_actor_miner_state::v12::pre_commit_deposit_for_power(
reward_estimate,
network_qa_power_estimate,
qa_sector_power,
)
}
}

/// Defines vestion function type for reward actor.
Expand Down
13 changes: 0 additions & 13 deletions actors/reward/src/v13/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,6 @@ impl State {
pub fn into_total_storage_power_reward(self) -> TokenAmount {
self.total_storage_power_reward
}

pub fn pre_commit_deposit_for_power(
&self,
reward_estimate: &FilterEstimate,
network_qa_power_estimate: &FilterEstimate,
qa_sector_power: &StoragePower,
) -> TokenAmount {
fil_actor_miner_state::v13::pre_commit_deposit_for_power(
reward_estimate,
network_qa_power_estimate,
qa_sector_power,
)
}
}

/// Defines vestion function type for reward actor.
Expand Down
13 changes: 0 additions & 13 deletions actors/reward/src/v14/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,6 @@ impl State {
pub fn into_total_storage_power_reward(self) -> TokenAmount {
self.total_storage_power_reward
}

pub fn pre_commit_deposit_for_power(
&self,
reward_estimate: &FilterEstimate,
network_qa_power_estimate: &FilterEstimate,
qa_sector_power: &StoragePower,
) -> TokenAmount {
fil_actor_miner_state::v14::pre_commit_deposit_for_power(
reward_estimate,
network_qa_power_estimate,
qa_sector_power,
)
}
}

/// Defines vestion function type for reward actor.
Expand Down
13 changes: 0 additions & 13 deletions actors/reward/src/v15/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,6 @@ impl State {
pub fn into_total_storage_power_reward(self) -> TokenAmount {
self.total_storage_power_reward
}

pub fn pre_commit_deposit_for_power(
&self,
reward_estimate: &FilterEstimate,
network_qa_power_estimate: &FilterEstimate,
qa_sector_power: &StoragePower,
) -> TokenAmount {
fil_actor_miner_state::v15::pre_commit_deposit_for_power(
reward_estimate,
network_qa_power_estimate,
qa_sector_power,
)
}
}

/// Defines vestion function type for reward actor.
Expand Down
Loading

0 comments on commit 92fad01

Please sign in to comment.