Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/refactor-fsm-i…
Browse files Browse the repository at this point in the history
…nput
  • Loading branch information
magik6k committed Feb 16, 2021
2 parents 6907e58 + ea7ea72 commit dd82729
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 52 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ MODULES+=$(FFI_PATH)
BUILD_DEPS+=build/.filecoin-install
CLEAN+=build/.filecoin-install

$(MODULES): build/.update-modules ;
ffi-version-check:
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 2 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
BUILD_DEPS+=ffi-version-check

.PHONY: ffi-version-check


$(MODULES): build/.update-modules ;
# dummy file that marks the last time modules were updated
build/.update-modules:
git submodule update --init --recursive
Expand Down
7 changes: 3 additions & 4 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,9 @@ type DataSize struct {
}

type DataCIDSize struct {
RawBlockSize uint64
PayloadSize int64
PieceSize abi.PaddedPieceSize
PieceCID cid.Cid
PayloadSize int64
PieceSize abi.PaddedPieceSize
PieceCID cid.Cid
}

type CommPRet struct {
Expand Down
12 changes: 5 additions & 7 deletions build/params_nerpanet.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ const UpgradeActorsV2Height = 120 // critical: the network can bootstrap from v1

const UpgradeKumquatHeight = -6

const UpgradeCalicoHeight = 999999999
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60)
const UpgradeCalicoHeight = 306000
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 12)

const UpgradeOrangeHeight = 9999999999
const UpgradeOrangeHeight = 307500

// 2020-12-22T02:00:00Z
const UpgradeClausHeight = 99999999999
const UpgradeClausHeight = 307600

// TODO
const UpgradeActorsV3Height = 999999999999
const UpgradeActorsV3Height = 308000

func init() {
// Minimum block production power is set to 4 TiB
Expand Down
25 changes: 12 additions & 13 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,8 @@ uiLoop:
TransferType: storagemarket.TTGraphsync,
Root: data,

PieceCid: &ds.PieceCID,
PieceSize: ds.PieceSize.Unpadded(),
RawBlockSize: ds.RawBlockSize,
PieceCid: &ds.PieceCID,
PieceSize: ds.PieceSize.Unpadded(),
},
Wallet: a,
Miner: maddr,
Expand Down Expand Up @@ -1568,7 +1567,7 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode,

if verbose {
w := tabwriter.NewWriter(out, 2, 4, 2, ' ', 0)
fmt.Fprintf(w, "Created\tDealCid\tDealId\tProvider\tState\tOn Chain?\tSlashed?\tPieceCID\tSize\tPrice\tDuration\tTransferChannelID\tTransferStatus\tTransfer %%\tVerified\tMessage\n")
fmt.Fprintf(w, "Created\tDealCid\tDealId\tProvider\tState\tOn Chain?\tSlashed?\tPieceCID\tSize\tPrice\tDuration\tTransferChannelID\tTransferStatus\tVerified\tMessage\n")
for _, d := range deals {
onChain := "N"
if d.OnChainDealState.SectorStartEpoch != -1 {
Expand All @@ -1586,16 +1585,17 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode,
transferChannelID = d.LocalDeal.TransferChannelID.String()
}
transferStatus := ""
transferPct := ""
if d.LocalDeal.DataTransfer != nil {
transferStatus = datatransfer.Statuses[d.LocalDeal.DataTransfer.Status]
// Calculate transfer %
if d.LocalDeal.DataRef.RawBlockSize > 0 {
pct := (100 * d.LocalDeal.DataTransfer.Transferred) / d.LocalDeal.DataRef.RawBlockSize
transferPct = fmt.Sprintf("%d%%", pct)
}
}
fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%v\t%s\n",
// TODO: Include the transferred percentage once this bug is fixed:
// https://github.com/ipfs/go-graphsync/issues/126
//fmt.Printf("transferred: %d / size: %d\n", d.LocalDeal.DataTransfer.Transferred, d.LocalDeal.Size)
//if d.LocalDeal.Size > 0 {
// pct := (100 * d.LocalDeal.DataTransfer.Transferred) / d.LocalDeal.Size
// transferPct = fmt.Sprintf("%d%%", pct)
//}
}
fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t%v\t%s\n",
d.LocalDeal.CreationTime.Format(time.Stamp),
d.LocalDeal.ProposalCid,
d.LocalDeal.DealID,
Expand All @@ -1609,7 +1609,6 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode,
d.LocalDeal.Duration,
transferChannelID,
transferStatus,
transferPct,
d.LocalDeal.Verified,
d.LocalDeal.Message)
}
Expand Down
1 change: 1 addition & 0 deletions cli/test/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
dataCid2.String(),
duration,
minerAddr.String(),
"no",
"yes",
}
out = clientCLI.RunInteractiveCmd(cmd, interactiveCmds)
Expand Down
3 changes: 1 addition & 2 deletions documentation/en/api-methods-miner.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,7 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
"PieceSize": 1024
},
"AvailableForRetrieval": true,
"DealID": 5432,
Expand Down
10 changes: 3 additions & 7 deletions documentation/en/api-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,6 @@ Inputs:
Response:
```json
{
"RawBlockSize": 42,
"PayloadSize": 9,
"PieceSize": 1032,
"PieceCID": {
Expand Down Expand Up @@ -1029,8 +1028,7 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
"PieceSize": 1024
},
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
Expand Down Expand Up @@ -1100,8 +1098,7 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
"PieceSize": 1024
},
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
Expand Down Expand Up @@ -1419,8 +1416,7 @@ Inputs:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
"PieceSize": 1024
},
"Wallet": "f01234",
"Miner": "f01234",
Expand Down
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
Submodule filecoin-ffi updated 2 files
+79 −124 rust/Cargo.lock
+1 −1 version.go
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ require (
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f
github.com/filecoin-project/go-address v0.0.5
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect
github.com/filecoin-project/go-bitfield v0.2.3
github.com/filecoin-project/go-bitfield v0.2.4
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
github.com/filecoin-project/go-data-transfer v1.2.7
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a
github.com/filecoin-project/go-fil-markets v1.1.8
github.com/filecoin-project/go-fil-markets v1.1.7
github.com/filecoin-project/go-jsonrpc v0.1.2
github.com/filecoin-project/go-multistore v0.0.3
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ github.com/filecoin-project/go-bitfield v0.2.0 h1:gCtLcjskIPtdg4NfN7gQZSQF9yrBQ7
github.com/filecoin-project/go-bitfield v0.2.0/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-bitfield v0.2.3 h1:pedK/7maYF06Z+BYJf2OeFFqIDEh6SP6mIOlLFpYXGs=
github.com/filecoin-project/go-bitfield v0.2.3/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW8p9au0C68JPgk=
github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 h1:av5fw6wmm58FYMgJeoB/lK9XXrgdugYiTqkdxjTy9k8=
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg=
github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434 h1:0kHszkYP3hgApcjl5x4rpwONhN9+j7XDobf6at5XfHs=
Expand All @@ -269,8 +271,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg=
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c=
github.com/filecoin-project/go-fil-markets v1.1.8 h1:rnb+9Did4sClxTUHDpzmf9WmTzL1wQsBSsUb9RQa4Rg=
github.com/filecoin-project/go-fil-markets v1.1.8/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ=
github.com/filecoin-project/go-fil-markets v1.1.7 h1:7yy7alIDWzUxljxZhGmG3+wvaU4Ty5QDMbPmdZeaIJ8=
github.com/filecoin-project/go-fil-markets v1.1.7/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
Expand Down
15 changes: 2 additions & 13 deletions node/impl/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,13 +755,7 @@ func (a *API) ClientDealPieceCID(ctx context.Context, root cid.Cid) (api.DataCID
w := &writer.Writer{}
bw := bufio.NewWriterSize(w, int(writer.CommPBuf))

// Calculate the raw block size so we can figure out the transfer percentage
// (the raw block size is the denominator)
var rawBlockSize uint64
err := car.WriteCarWithWalker(ctx, dag, []cid.Cid{root}, w, func(nd ipld.Node) ([]*ipld.Link, error) {
rawBlockSize += uint64(len(nd.RawData()))
return nd.Links(), nil
})
err := car.WriteCar(ctx, dag, []cid.Cid{root}, w)
if err != nil {
return api.DataCIDSize{}, err
}
Expand All @@ -771,12 +765,7 @@ func (a *API) ClientDealPieceCID(ctx context.Context, root cid.Cid) (api.DataCID
}

dataCIDSize, err := w.Sum()
return api.DataCIDSize{
RawBlockSize: rawBlockSize,
PayloadSize: dataCIDSize.PayloadSize,
PieceSize: dataCIDSize.PieceSize,
PieceCID: dataCIDSize.PieceCID,
}, err
return api.DataCIDSize(dataCIDSize), err
}

func (a *API) ClientGenCar(ctx context.Context, ref api.FileRef, outputPath string) error {
Expand Down

0 comments on commit dd82729

Please sign in to comment.