lotus/node/hello/cbor_gen.go

305 lines
6.0 KiB
Go
Raw Normal View History

// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
package hello
import (
"fmt"
"io"
integrate DAG store and CARv2 in deal-making (#6671) This commit removes badger from the deal-making processes, and moves to a new architecture with the dagstore as the cental component on the miner-side, and CARv2s on the client-side. Every deal that has been handed off to the sealing subsystem becomes a shard in the dagstore. Shards are mounted via the LotusMount, which teaches the dagstore how to load the related piece when serving retrievals. When the miner starts the Lotus for the first time with this patch, we will perform a one-time migration of all active deals into the dagstore. This is a lightweight process, and it consists simply of registering the shards in the dagstore. Shards are backed by the unsealed copy of the piece. This is currently a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so when it's time to acquire a shard to serve a retrieval, the unsealed CARv1 is joined with its index (safeguarded by the dagstore), to form a read-only blockstore, thus taking the place of the monolithic badger. Data transfers have been adjusted to interface directly with CARv2 files. On inbound transfers (client retrievals, miner storage deals), we stream the received data into a CARv2 ReadWrite blockstore. On outbound transfers (client storage deals, miner retrievals), we serve the data off a CARv2 ReadOnly blockstore. Client-side imports are managed by the refactored *imports.Manager component (when not using IPFS integration). Just like it before, we use the go-filestore library to avoid duplicating the data from the original file in the resulting UnixFS DAG (concretely the leaves). However, the target of those imports are what we call "ref-CARv2s": CARv2 files placed under the `$LOTUS_PATH/imports` directory, containing the intermediate nodes in full, and the leaves as positional references to the original file on disk. Client-side retrievals are placed into CARv2 files in the location: `$LOTUS_PATH/retrievals`. A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore` subcommands have been introduced on the miner-side to inspect and manage the dagstore. Despite moving to a CARv2-backed system, the IPFS integration has been respected, and it continues to be possible to make storage deals with data held in an IPFS node, and to perform retrievals directly into an IPFS node. NOTE: because the "staging" and "client" Badger blockstores are no longer used, existing imports on the client will be rendered useless. On startup, Lotus will enumerate all imports and print WARN statements on the log for each import that needs to be reimported. These log lines contain these messages: - import lacks carv2 path; import will not work; please reimport - import has missing/broken carv2; please reimport At the end, we will print a "sanity check completed" message indicating the count of imports found, and how many were deemed broken. Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com> Co-authored-by: Dirk McCormick <dirkmdev@gmail.com> Co-authored-by: Raúl Kripalani <raul@protocol.ai> Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 22:34:32 +00:00
"math"
"sort"
2020-08-20 04:37:21 +00:00
cid "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
2022-06-14 15:00:51 +00:00
abi "github.com/filecoin-project/go-state-types/abi"
)
var _ = xerrors.Errorf
var _ = cid.Undef
integrate DAG store and CARv2 in deal-making (#6671) This commit removes badger from the deal-making processes, and moves to a new architecture with the dagstore as the cental component on the miner-side, and CARv2s on the client-side. Every deal that has been handed off to the sealing subsystem becomes a shard in the dagstore. Shards are mounted via the LotusMount, which teaches the dagstore how to load the related piece when serving retrievals. When the miner starts the Lotus for the first time with this patch, we will perform a one-time migration of all active deals into the dagstore. This is a lightweight process, and it consists simply of registering the shards in the dagstore. Shards are backed by the unsealed copy of the piece. This is currently a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so when it's time to acquire a shard to serve a retrieval, the unsealed CARv1 is joined with its index (safeguarded by the dagstore), to form a read-only blockstore, thus taking the place of the monolithic badger. Data transfers have been adjusted to interface directly with CARv2 files. On inbound transfers (client retrievals, miner storage deals), we stream the received data into a CARv2 ReadWrite blockstore. On outbound transfers (client storage deals, miner retrievals), we serve the data off a CARv2 ReadOnly blockstore. Client-side imports are managed by the refactored *imports.Manager component (when not using IPFS integration). Just like it before, we use the go-filestore library to avoid duplicating the data from the original file in the resulting UnixFS DAG (concretely the leaves). However, the target of those imports are what we call "ref-CARv2s": CARv2 files placed under the `$LOTUS_PATH/imports` directory, containing the intermediate nodes in full, and the leaves as positional references to the original file on disk. Client-side retrievals are placed into CARv2 files in the location: `$LOTUS_PATH/retrievals`. A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore` subcommands have been introduced on the miner-side to inspect and manage the dagstore. Despite moving to a CARv2-backed system, the IPFS integration has been respected, and it continues to be possible to make storage deals with data held in an IPFS node, and to perform retrievals directly into an IPFS node. NOTE: because the "staging" and "client" Badger blockstores are no longer used, existing imports on the client will be rendered useless. On startup, Lotus will enumerate all imports and print WARN statements on the log for each import that needs to be reimported. These log lines contain these messages: - import lacks carv2 path; import will not work; please reimport - import has missing/broken carv2; please reimport At the end, we will print a "sanity check completed" message indicating the count of imports found, and how many were deemed broken. Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com> Co-authored-by: Dirk McCormick <dirkmdev@gmail.com> Co-authored-by: Raúl Kripalani <raul@protocol.ai> Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 22:34:32 +00:00
var _ = math.E
var _ = sort.Sort
2020-05-04 22:19:48 +00:00
var lengthBufHelloMessage = []byte{132}
func (t *HelloMessage) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
2022-05-23 19:11:46 +00:00
cw := cbg.NewCborWriter(w)
if _, err := cw.Write(lengthBufHelloMessage); err != nil {
return err
}
// t.HeaviestTipSet ([]cid.Cid) (slice)
if len(t.HeaviestTipSet) > 8192 {
return xerrors.Errorf("Slice value in field t.HeaviestTipSet was too long")
}
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.HeaviestTipSet))); err != nil {
return err
}
for _, v := range t.HeaviestTipSet {
2023-09-23 21:21:22 +00:00
if err := cbg.WriteCid(cw, v); err != nil {
return xerrors.Errorf("failed to write cid field v: %w", err)
}
2023-09-23 21:21:22 +00:00
}
2020-02-25 20:21:58 +00:00
// t.HeaviestTipSetHeight (abi.ChainEpoch) (int64)
if t.HeaviestTipSetHeight >= 0 {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.HeaviestTipSetHeight)); err != nil {
2020-02-25 20:21:58 +00:00
return err
}
} else {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.HeaviestTipSetHeight-1)); err != nil {
2020-02-25 20:21:58 +00:00
return err
}
}
2020-02-25 20:21:58 +00:00
// t.HeaviestTipSetWeight (big.Int) (struct)
2022-05-23 19:11:46 +00:00
if err := t.HeaviestTipSetWeight.MarshalCBOR(cw); err != nil {
return err
}
// t.GenesisHash (cid.Cid) (struct)
2022-05-23 19:11:46 +00:00
if err := cbg.WriteCid(cw, t.GenesisHash); err != nil {
return xerrors.Errorf("failed to write cid field t.GenesisHash: %w", err)
}
return nil
}
2022-05-23 19:11:46 +00:00
func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) {
*t = HelloMessage{}
2022-05-23 19:11:46 +00:00
cr := cbg.NewCborReader(r)
2022-05-23 19:11:46 +00:00
maj, extra, err := cr.ReadHeader()
if err != nil {
return err
}
2022-05-23 19:11:46 +00:00
defer func() {
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
}()
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 4 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.HeaviestTipSet ([]cid.Cid) (slice)
2022-05-23 19:11:46 +00:00
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.HeaviestTipSet: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
2020-04-17 17:53:09 +00:00
if extra > 0 {
t.HeaviestTipSet = make([]cid.Cid, extra)
}
2020-04-17 17:53:09 +00:00
for i := 0; i < int(extra); i++ {
2023-09-23 21:21:22 +00:00
{
var maj byte
var extra uint64
var err error
_ = maj
_ = extra
_ = err
2023-09-23 21:21:22 +00:00
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.HeaviestTipSet[i]: %w", err)
}
t.HeaviestTipSet[i] = c
}
feat: sealing: Support nv22 DDO features in the sealing pipeline (#11226) * Initial work supporting DDO pieces in lotus-miner * sealing: Update pipeline input to operate on UniversalPiece * sealing: Update pipeline checks/sealing states to operate on UniversalPiece * sealing: Make pipeline build with UniversalPiece * move PieceDealInfo out of api * make gen * make sealing pipeline unit tests pass * fix itest ensemble build * don't panic in SectorsStatus with deals * stop linter from complaining about checkPieces * fix sector import tests * mod tidy * sealing: Add logic for (pre)committing DDO sectors * sealing: state-types with method defs * DDO non-snap pipeline works(?), DDO Itests * DDO support in snapdeals pipeline * make gen * update actor bundles * update the gst market fix * fix: chain: use PreCommitSectorsBatch2 when setting up genesis * some bug fixes * integration working changes * update actor bundles * Make TestOnboardRawPieceSnap pass * Appease the linter * Make deadlines test pass with v12 actors * Update go-state-types, abstract market DealState * make gen * mod tidy, lint fixes * Fix some more tests * Bump version in master Bump version in master * Make gen Make gen * fix sender * fix: lotus-provider: Fix winning PoSt * fix: sql Scan cannot write to an object * Actually show miner-addrs in info-log Actually show miner-addrs in lotus-provider info-log * [WIP] feat: Add nv22 skeleton Addition of Network Version 22 skeleton * update FFI * ddo is now nv22 * make gen * temp actor bundle with ddo * use working go-state-types * gst with v13 market migration * update bundle, builtin.MethodsMiner.ProveCommitSectors2 -> 3 * actually working v13 migration, v13 migration itest * Address review * sealing: Correct DDO snap pledge math * itests: Mixed ddo itest * pipeline: Fix sectorWeight * sealing: convert market deals into PAMs in mixed sectors * sealing: make market to ddo conversion work * fix lint * update gst * Update actors and GST to lastest integ branch * commit batcher: Update ProveCommitSectors3Params builder logic * make gen * use builtin-actors master * ddo: address review * itests: Add commd assertions to ddo tests * make gen * gst with fixed types * config knobs for RequireActivationSuccess * storage: Drop obsolete flaky tasts --------- Co-authored-by: Jennifer Wang <jiayingw703@gmail.com> Co-authored-by: Aayush <arajasek94@gmail.com> Co-authored-by: Shrenuj Bansal <shrenuj.bansal@protocol.ai> Co-authored-by: Phi <orjan.roren@gmail.com> Co-authored-by: Andrew Jackson (Ajax) <snadrus@gmail.com> Co-authored-by: TippyFlits <james.bluett@protocol.ai>
2024-01-25 14:15:55 +00:00
}
}
2020-02-25 20:21:58 +00:00
// t.HeaviestTipSetHeight (abi.ChainEpoch) (int64)
{
2022-05-23 19:11:46 +00:00
maj, extra, err := cr.ReadHeader()
2020-02-25 20:21:58 +00:00
if err != nil {
return err
}
var extraI int64
2020-02-25 20:21:58 +00:00
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
2020-02-25 20:21:58 +00:00
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
2020-02-25 20:21:58 +00:00
t.HeaviestTipSetHeight = abi.ChainEpoch(extraI)
}
2020-02-25 20:21:58 +00:00
// t.HeaviestTipSetWeight (big.Int) (struct)
{
2022-05-23 19:11:46 +00:00
if err := t.HeaviestTipSetWeight.UnmarshalCBOR(cr); err != nil {
2020-03-21 21:17:01 +00:00
return xerrors.Errorf("unmarshaling t.HeaviestTipSetWeight: %w", err)
}
}
// t.GenesisHash (cid.Cid) (struct)
{
2022-05-23 19:11:46 +00:00
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.GenesisHash: %w", err)
}
t.GenesisHash = c
}
return nil
}
2020-05-04 22:19:48 +00:00
var lengthBufLatencyMessage = []byte{130}
func (t *LatencyMessage) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
2022-05-23 19:11:46 +00:00
cw := cbg.NewCborWriter(w)
if _, err := cw.Write(lengthBufLatencyMessage); err != nil {
return err
}
2020-08-04 15:33:29 +00:00
// t.TArrival (int64) (int64)
if t.TArrival >= 0 {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TArrival)); err != nil {
return err
}
} else {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TArrival-1)); err != nil {
return err
}
}
// t.TSent (int64) (int64)
if t.TSent >= 0 {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TSent)); err != nil {
return err
}
} else {
2022-05-23 19:11:46 +00:00
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TSent-1)); err != nil {
return err
}
}
return nil
}
2022-05-23 19:11:46 +00:00
func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) {
*t = LatencyMessage{}
2022-05-23 19:11:46 +00:00
cr := cbg.NewCborReader(r)
2022-05-23 19:11:46 +00:00
maj, extra, err := cr.ReadHeader()
if err != nil {
return err
}
2022-05-23 19:11:46 +00:00
defer func() {
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
}()
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 2 {
return fmt.Errorf("cbor input had wrong number of fields")
}
2020-08-04 15:33:29 +00:00
// t.TArrival (int64) (int64)
{
2022-05-23 19:11:46 +00:00
maj, extra, err := cr.ReadHeader()
if err != nil {
return err
}
var extraI int64
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
2020-08-04 15:33:29 +00:00
t.TArrival = int64(extraI)
}
// t.TSent (int64) (int64)
{
2022-05-23 19:11:46 +00:00
maj, extra, err := cr.ReadHeader()
if err != nil {
return err
}
var extraI int64
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.TSent = int64(extraI)
}
return nil
}