Skip to content

Commit fc73d88

Browse files
authored
Miner actor methods (#117)
Signed-off-by: turuslan <[email protected]>
1 parent 859c485 commit fc73d88

File tree

8 files changed

+917
-6
lines changed

8 files changed

+917
-6
lines changed

core/primitives/sector/sector.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ namespace fc::primitives::sector {
117117

118118
struct PoStVerifyInfo {
119119
PoStRandomness randomness;
120-
/// CommR
121-
CID sealed_cid;
122120
/// From OnChainPoStVerifyInfo
123121
std::vector<PoStCandidate> candidates;
124122
std::vector<PoStProof> proofs;
125123
std::vector<SectorInfo> eligible_sectors;
124+
/// used to derive 32-byte prover ID
125+
ActorId prover;
126+
uint64_t challenge_count;
126127
};
127128

128129
CBOR_TUPLE(SectorId, miner, sector)

core/vm/actor/builtin/miner/miner_actor.cpp

Lines changed: 892 additions & 1 deletion
Large diffs are not rendered by default.

core/vm/actor/builtin/miner/miner_actor.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ namespace fc::vm::actor::builtin::miner {
2424
constexpr MethodNumber kExtendSectorExpirationMethodNumber{9};
2525
constexpr MethodNumber kTerminateSectorsMethodNumber{10};
2626
constexpr MethodNumber kDeclareTemporaryFaultsMethodNumber{11};
27-
constexpr MethodNumber kOnDeferredCronEventMethodNumber{11};
27+
constexpr MethodNumber kOnDeferredCronEventMethodNumber{12};
28+
constexpr MethodNumber kCheckSectorProvenMethodNumber{13};
2829

2930
constexpr MethodNumber kSubmitElectionPoStMethodNumber{20};
3031

3132
ACTOR_METHOD(constructor);
3233

33-
ACTOR_METHOD(controlAdresses);
34+
ACTOR_METHOD(controlAddresses);
3435

3536
ACTOR_METHOD(changeWorkerAddress);
3637

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

5354
ACTOR_METHOD(onDeferredCronEvent);
5455

56+
ACTOR_METHOD(checkSectorProven);
57+
5558
extern const ActorExports exports;
5659

5760
} // namespace fc::vm::actor::builtin::miner

core/vm/actor/builtin/miner/policy.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ namespace fc::vm::actor::builtin::miner {
3737

3838
constexpr EpochDuration kDeclaredFaultEffectiveDelay{20};
3939

40+
constexpr uint64_t kWindowedPoStSampleRateNumer{1};
41+
constexpr uint64_t kWindowedPoStSampleRateDenum{25};
42+
4043
inline TokenAmount precommitDeposit(SectorSize sector_size,
4144
ChainEpoch duration) {
4245
return 0;

core/vm/actor/builtin/miner/types.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ namespace fc::vm::actor::builtin::miner {
180180
Buffer callback_payload;
181181
};
182182

183+
struct CheckSectorProvenParams {
184+
SectorNumber sector;
185+
};
186+
183187
CBOR_TUPLE(PoStState, proving_period_start, num_consecutive_failures)
184188

185189
CBOR_TUPLE(
@@ -229,6 +233,8 @@ namespace fc::vm::actor::builtin::miner {
229233
CBOR_TUPLE(DeclareTemporaryFaultsParams, sectors, duration)
230234

231235
CBOR_TUPLE(OnDeferredCronEventParams, callback_payload)
236+
237+
CBOR_TUPLE(CheckSectorProvenParams, sector)
232238
} // namespace fc::vm::actor::builtin::miner
233239

234240
#endif // CPP_FILECOIN_CORE_VM_ACTOR_BUILTIN_MINER_TYPES_HPP

core/vm/actor/builtin/storage_power/storage_power_actor_export.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace fc::vm::actor::builtin::storage_power {
8181
TokenAmount pledge;
8282
};
8383

84-
struct OnSectorTemporaryFaultEffectiveEndParams {
84+
struct OnSectorTemporaryFaultEffectiveEndParameters {
8585
std::vector<SectorStorageWeightDesc> weights;
8686
TokenAmount pledge;
8787
};
@@ -164,6 +164,8 @@ namespace fc::vm::actor::builtin::storage_power {
164164

165165
CBOR_TUPLE(OnSectorTemporaryFaultEffectiveBeginParameters, weights, pledge)
166166

167+
CBOR_TUPLE(OnSectorTemporaryFaultEffectiveEndParameters, weights, pledge)
168+
167169
CBOR_TUPLE(OnSectorModifyWeightDescParams,
168170
prev_weight,
169171
prev_pledge,

core/vm/exit_code/exit_code.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ namespace fc::vm {
3030
MINER_ACTOR_MINER_NOT_ACCOUNT,
3131
MINER_ACTOR_MINER_NOT_BLS,
3232
MINER_ACTOR_ILLEGAL_ARGUMENT,
33+
MINER_ACTOR_NOT_FOUND,
3334
MINER_ACTOR_WRONG_CALLER,
35+
MINER_ACTOR_WRONG_EPOCH,
3436
MINER_ACTOR_POST_TOO_LATE,
3537
MINER_ACTOR_POST_TOO_EARLY,
3638
MINER_ACTOR_INSUFFICIENT_FUNDS,

core/vm/exit_code/impl/exit_code.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ namespace fc::vm {
4343
case E::MINER_ACTOR_MINER_NOT_BLS:
4444
case E::MINER_ACTOR_ILLEGAL_ARGUMENT:
4545
return 16; // ErrIllegalArgument in actor-specs
46+
case E::MINER_ACTOR_NOT_FOUND:
47+
return 17; // ErrNotFound in actor-specs
4648
case E::MINER_ACTOR_WRONG_CALLER:
49+
case E::MINER_ACTOR_WRONG_EPOCH:
4750
return 18; // ErrForbidden in actor-specs
4851
case E::MINER_ACTOR_POST_TOO_LATE:
4952
case E::MINER_ACTOR_POST_TOO_EARLY:

0 commit comments

Comments
 (0)