Skip to content

Commit 4ee3487

Browse files
committed
Add ListAllocations/ListClaims verified registry methods.
1 parent 6b54250 commit 4ee3487

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

FIPS/fip-0076.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,63 @@ struct OnMinerSectorsTerminateParams {
542542
The sector is removed from the `ProviderSectors` mapping, if present.
543543
Any deals mapped to that sector are marked as terminated, and subsequent processing deferred to cron.
544544

545+
### Verified registry actor
546+
547+
The built-in verified registry actor exports FRC-0042 methods to iterate all allocations and claims.
548+
`ListAllocations` returns all allocation IDs up to some caller-specified limit,
549+
and an opaque cursor which can be used to continue the listing where the first response left off.
550+
`ListClaims` similarly returns all claim IDs up to some limit, and a cursor for continuation.
551+
The order of iteration is undefined to the caller, and will match the internal HAMT structure's ordering.
552+
A cursor is tied to the actor state from which it was generated.
553+
Clients can only assume a cursor is valid for use immediately after it is returned.
554+
555+
```
556+
// Exported API
557+
struct ListAllocationsParams {
558+
Cursor: RawBytes,
559+
Limit: u64,
560+
}
561+
562+
struct AllocationKey {
563+
Client: ActorID,
564+
ID: AllocationID,
565+
}
566+
567+
struct ListAllocationsResponse {
568+
Allocations: Vec<AllocationKey>,
569+
NextCursor: Option<RawBytes>,
570+
}
571+
572+
struct ListClaimsParams {
573+
Cursor: RawBytes,
574+
Limit: u64,
575+
}
576+
577+
struct ClaimKey {
578+
Provider: ActorID,
579+
ID: ClaimID,
580+
}
581+
582+
struct ListClaimsResponse {
583+
Claims: Vec<ClaimKey>,
584+
NextCursor: Option<RawBytes>,
585+
}
586+
```
587+
588+
A cursor is a serialized representation of the HAMT root CID, the next client/provider ID,
589+
and the next allocation/claim ID for that client/provider.
590+
A cursor is rejected with `USR_ILLEGAL_ARGUMENT` if the HAMT root does not match the verified registry state,
591+
or the IDs do not exist.
592+
593+
```
594+
// Internal structure
595+
struct Cursor {
596+
Root: Cid,
597+
OuterKey: ActorID,
598+
InnerKey: u64, // Allocation or claim ID
599+
}
600+
601+
```
545602
### Migration
546603

547604
The built-in market actor's `ProviderSectors` mapping is initialised from the existing deal state
@@ -622,6 +679,12 @@ as a side effect of publishing a deal.
622679
The reason for this change is that verified allocations and deals are independent: a client can allocate DataCap
623680
without necessarily involving the built-in market actor, and save the SP significant gas costs by doing so.
624681

682+
### Verified registry iteration APIs
683+
684+
The methods to list allocations and claims provide simpler accessibility of these structures,
685+
since in many cases they may be the only on-chain representation of a "deal".
686+
The methods are primarily intended to be invoked from off-chain, replacing direct state inspection.
687+
625688
## Backwards Compatibility
626689

627690
This proposal deprecated the miner methods `PreCommitSector` (method 6), `PreCommitSectorBatch` (method 25),

0 commit comments

Comments
 (0)