Skip to content

Miner actor methods #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions core/primitives/sector/sector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ namespace fc::primitives::sector {

struct PoStVerifyInfo {
PoStRandomness randomness;
/// CommR
CID sealed_cid;
/// From OnChainPoStVerifyInfo
std::vector<PoStCandidate> candidates;
std::vector<PoStProof> proofs;
std::vector<SectorInfo> eligible_sectors;
/// used to derive 32-byte prover ID
ActorId prover;
uint64_t challenge_count;
};

CBOR_TUPLE(SectorId, miner, sector)
Expand Down
893 changes: 892 additions & 1 deletion core/vm/actor/builtin/miner/miner_actor.cpp

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions core/vm/actor/builtin/miner/miner_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ namespace fc::vm::actor::builtin::miner {
constexpr MethodNumber kExtendSectorExpirationMethodNumber{9};
constexpr MethodNumber kTerminateSectorsMethodNumber{10};
constexpr MethodNumber kDeclareTemporaryFaultsMethodNumber{11};
constexpr MethodNumber kOnDeferredCronEventMethodNumber{11};
constexpr MethodNumber kOnDeferredCronEventMethodNumber{12};
constexpr MethodNumber kCheckSectorProvenMethodNumber{13};

constexpr MethodNumber kSubmitElectionPoStMethodNumber{20};

ACTOR_METHOD(constructor);

ACTOR_METHOD(controlAdresses);
ACTOR_METHOD(controlAddresses);

ACTOR_METHOD(changeWorkerAddress);

Expand All @@ -52,6 +53,8 @@ namespace fc::vm::actor::builtin::miner {

ACTOR_METHOD(onDeferredCronEvent);

ACTOR_METHOD(checkSectorProven);

extern const ActorExports exports;

} // namespace fc::vm::actor::builtin::miner
Expand Down
3 changes: 3 additions & 0 deletions core/vm/actor/builtin/miner/policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ namespace fc::vm::actor::builtin::miner {

constexpr EpochDuration kDeclaredFaultEffectiveDelay{20};

constexpr uint64_t kWindowedPoStSampleRateNumer{1};
constexpr uint64_t kWindowedPoStSampleRateDenum{25};

inline TokenAmount precommitDeposit(SectorSize sector_size,
ChainEpoch duration) {
return 0;
Expand Down
6 changes: 6 additions & 0 deletions core/vm/actor/builtin/miner/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ namespace fc::vm::actor::builtin::miner {
Buffer callback_payload;
};

struct CheckSectorProvenParams {
SectorNumber sector;
};

CBOR_TUPLE(PoStState, proving_period_start, num_consecutive_failures)

CBOR_TUPLE(
Expand Down Expand Up @@ -229,6 +233,8 @@ namespace fc::vm::actor::builtin::miner {
CBOR_TUPLE(DeclareTemporaryFaultsParams, sectors, duration)

CBOR_TUPLE(OnDeferredCronEventParams, callback_payload)

CBOR_TUPLE(CheckSectorProvenParams, sector)
} // namespace fc::vm::actor::builtin::miner

#endif // CPP_FILECOIN_CORE_VM_ACTOR_BUILTIN_MINER_TYPES_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace fc::vm::actor::builtin::storage_power {
TokenAmount pledge;
};

struct OnSectorTemporaryFaultEffectiveEndParams {
struct OnSectorTemporaryFaultEffectiveEndParameters {
std::vector<SectorStorageWeightDesc> weights;
TokenAmount pledge;
};
Expand Down Expand Up @@ -164,6 +164,8 @@ namespace fc::vm::actor::builtin::storage_power {

CBOR_TUPLE(OnSectorTemporaryFaultEffectiveBeginParameters, weights, pledge)

CBOR_TUPLE(OnSectorTemporaryFaultEffectiveEndParameters, weights, pledge)

CBOR_TUPLE(OnSectorModifyWeightDescParams,
prev_weight,
prev_pledge,
Expand Down
2 changes: 2 additions & 0 deletions core/vm/exit_code/exit_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ namespace fc::vm {
MINER_ACTOR_MINER_NOT_ACCOUNT,
MINER_ACTOR_MINER_NOT_BLS,
MINER_ACTOR_ILLEGAL_ARGUMENT,
MINER_ACTOR_NOT_FOUND,
MINER_ACTOR_WRONG_CALLER,
MINER_ACTOR_WRONG_EPOCH,
MINER_ACTOR_POST_TOO_LATE,
MINER_ACTOR_POST_TOO_EARLY,
MINER_ACTOR_INSUFFICIENT_FUNDS,
Expand Down
3 changes: 3 additions & 0 deletions core/vm/exit_code/impl/exit_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ namespace fc::vm {
case E::MINER_ACTOR_MINER_NOT_BLS:
case E::MINER_ACTOR_ILLEGAL_ARGUMENT:
return 16; // ErrIllegalArgument in actor-specs
case E::MINER_ACTOR_NOT_FOUND:
return 17; // ErrNotFound in actor-specs
case E::MINER_ACTOR_WRONG_CALLER:
case E::MINER_ACTOR_WRONG_EPOCH:
return 18; // ErrForbidden in actor-specs
case E::MINER_ACTOR_POST_TOO_LATE:
case E::MINER_ACTOR_POST_TOO_EARLY:
Expand Down