Skip to content

Commit

Permalink
Market actor transfers datacap and makes verified allocations for dea…
Browse files Browse the repository at this point in the history
…ls, instead of UseBytes (#657)
  • Loading branch information
anorth authored Sep 15, 2022
1 parent 4a855fd commit 968d4c0
Show file tree
Hide file tree
Showing 21 changed files with 682 additions and 369 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions actors/market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fvm_ipld_hamt = "0.5.1"
fvm_shared = { version = "2.0.0-alpha.2", default-features = false }
fvm_ipld_bitfield = "0.5.2"
num-traits = "0.2.14"
num-derive = "0.3.3"
serde = { version = "1.0.136", features = ["derive"] }
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
log = "0.4.14"

anyhow = "1.0.56"
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
fil_fungible_token = { git = "https://github.com/helix-onchain/filecoin", rev = "39320534b8e992b9c5e53e15641ea4c9c113ed3e" }
fvm_ipld_bitfield = "0.5.2"
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.2.2"
fvm_ipld_hamt = "0.5.1"
fvm_shared = { version = "2.0.0-alpha.2", default-features = false }
integer-encoding = { version = "3.0.3", default-features = false }
libipld-core = { version = "0.13.1", features = ["serde-codec"] }
log = "0.4.14"
num-derive = "0.3.3"
num-traits = "0.2.14"
serde = { version = "1.0.136", features = ["derive"] }

[dev-dependencies]
fil_actors_runtime = { path = "../../runtime", features = ["test_utils", "sector-default"] }
Expand Down
3 changes: 3 additions & 0 deletions actors/market/src/deal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use crate::ext::verifreg::AllocationID;
use cid::{Cid, Version};
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{BytesSer, Cbor};
Expand Down Expand Up @@ -146,4 +147,6 @@ pub struct DealState {
pub last_updated_epoch: ChainEpoch,
// -1 if deal never slashed
pub slash_epoch: ChainEpoch,
// ID of the verified registry allocation/claim for this deal's data (0 if none).
pub verified_claim: AllocationID,
}
36 changes: 25 additions & 11 deletions actors/market/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,38 @@ pub mod miner {

pub mod verifreg {
use super::*;
use cid::Cid;
use fvm_shared::clock::ChainEpoch;
use fvm_shared::piece::PaddedPieceSize;

// based on fil_actor_verifreg
pub const USE_BYTES_METHOD: u64 = 5;
pub const RESTORE_BYTES_METHOD: u64 = 6;
pub type AllocationID = u64;
pub type ClaimID = u64;

pub type UseBytesParams = BytesParams;
pub type RestoreBytesParams = BytesParams;
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: Address,
pub data: Cid,
pub size: PaddedPieceSize,
pub term_min: ChainEpoch,
pub term_max: ChainEpoch,
pub expiration: ChainEpoch,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct BytesParams {
/// Address of verified client.
pub address: Address,
/// Number of bytes to use.
#[serde(with = "bigint_ser")]
pub deal_size: StoragePower,
pub struct AllocationsRequest {
pub requests: Vec<AllocationRequest>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
pub allocations: Vec<AllocationID>,
}
}

pub mod datacap {
pub const TRANSFER_FROM_METHOD: u64 = 15;
}

pub mod reward {
pub const THIS_EPOCH_REWARD_METHOD: u64 = 3;
}
Expand Down
Loading

0 comments on commit 968d4c0

Please sign in to comment.