Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fendermint/actors/blobs/shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ pub enum Method {
GetPendingBlobs = frc42_dispatch::method_hash!("GetPendingBlobs"),
FinalizeBlob = frc42_dispatch::method_hash!("FinalizeBlob"),
DeleteBlob = frc42_dispatch::method_hash!("DeleteBlob"),
GetStorageStaked = frc42_dispatch::method_hash!("GetStorageStaked"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion here, but I think in our earlier discussions, we were going to call this "commitments" versus "staking" which technically happens elsewhere? So that would make this one (for example) GetStorageCommitment..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Changed it to "commitment" and friends for uniformity.

StakeStorage = frc42_dispatch::method_hash!("StakeStorage"),
UnstakeStorage = frc42_dispatch::method_hash!("UnstakeStorage"),
}

pub fn buy_credit(rt: &impl Runtime, recipient: Address) -> Result<Account, ActorError> {
Expand Down
25 changes: 25 additions & 0 deletions fendermint/actors/blobs/shared/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,31 @@ use serde::{Deserialize, Serialize};

use crate::state::{BlobStatus, Hash, PublicKey};

/// Params to get storage staked per validator.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(transparent)]
pub struct GetStorageStakedParams(pub Address);

#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct StorageStakedReturn {
pub address: Address,
pub storage: u64,
}

/// Params to increase storage staked per validator.
#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct StakeStorageParams {
pub address: Address,
pub storage: u64,
}

/// Params to decrease storage staked per validator.
#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct UnstakeStorageParams {
pub address: Address,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need the address property for here? If we're always going to assert_message_source (which of course, we should!), could we just pull this from the origin or caller?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair concern. It is not clear who the origin or the caller can be though considering the call could be originated from an ETH contract. It is similar to how credits work IMO:

pub storage: u64,
}

/// Params for buying credits.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(transparent)]
Expand Down
Loading
Loading