Compare commits
127
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8aa30b6fe0 | ||
|
|
fc8600e1c0 | ||
|
|
a9038d28bc | ||
|
|
54d35ac88c | ||
|
|
0b6cf58995 | ||
|
|
f7a51f0387 | ||
|
|
fdb1108154 | ||
|
|
6d47bcba54 | ||
|
|
e461e672ea | ||
|
|
082a9159ce | ||
|
|
099a754a74 | ||
|
|
557c3c01f7 | ||
|
|
647aa48b11 | ||
|
|
65e89a08ca | ||
|
|
ba11769228 | ||
|
|
01e24969df | ||
|
|
9cfdea3447 | ||
|
|
a3ce23cf3b | ||
|
|
cf7ef3823f | ||
|
|
5d620a72f7 | ||
|
|
f5100a2a1d | ||
|
|
e2712a9157 | ||
|
|
2cd6aea94b | ||
|
|
73d830e2fb | ||
|
|
5091434f30 | ||
|
|
330afff2e9 | ||
|
|
32559aa463 | ||
|
|
512c70bb39 | ||
|
|
f9833391d6 | ||
|
|
170b9844ef | ||
|
|
aeed4cba6b | ||
|
|
0c7037b56f | ||
|
|
886020b7ed | ||
|
|
06f0e6beb8 | ||
|
|
92b67334ae | ||
|
|
fb3970a958 | ||
|
|
179d981a88 | ||
|
|
2ae68c841d | ||
|
|
5621c1a193 | ||
|
|
b93e89c401 | ||
|
|
9ce25d7a7b | ||
|
|
c3f0554dd3 | ||
|
|
3d1cc159b0 | ||
|
|
156a3a400c | ||
|
|
fc8e4c54f8 | ||
|
|
1d75af73fa | ||
|
|
fafaf0d7af | ||
|
|
ad8e90d31c | ||
|
|
a959c049b3 | ||
|
|
15128b69a7 | ||
|
|
56bbeb01af | ||
|
|
464e492fd2 | ||
|
|
83295e3a25 | ||
|
|
d9d1b4370c | ||
|
|
8dffab5d39 | ||
|
|
b0bc4a9632 | ||
|
|
bfc26cdc18 | ||
|
|
25b228c2f6 | ||
|
|
a65c8f1393 | ||
|
|
b12757485a | ||
|
|
223e08bb84 | ||
|
|
41bc8f8791 | ||
|
|
324748d01b | ||
|
|
c1b42a8ce0 | ||
|
|
b1c1839b57 | ||
|
|
62fe670c28 | ||
|
|
5bdea21ad5 | ||
|
|
6373701412 | ||
|
|
e473571dfb | ||
|
|
f885ffb44d | ||
|
|
fac1d11ccb | ||
|
|
b363bc3e70 | ||
|
|
17f6f4caf2 | ||
|
|
d75d7c78de | ||
|
|
6faeaa7d28 | ||
|
|
bc76004c15 | ||
|
|
5717ec8c0a | ||
|
|
8070e3424f | ||
|
|
17e17eaac3 | ||
|
|
4161c270d7 | ||
|
|
a478b734fd | ||
|
|
0175faf5c2 | ||
|
|
0bad4d910d | ||
|
|
cdcb96567c | ||
|
|
d0cfcd99f5 | ||
|
|
becfc470a2 | ||
|
|
39afeff95d | ||
|
|
c912f3bcd5 | ||
|
|
de38e77cfc | ||
|
|
96353e63ea | ||
|
|
47477c0b02 | ||
|
|
89fabbbbfe | ||
|
|
68c1e56cef | ||
|
|
9dca4346b1 | ||
|
|
4a5c241762 | ||
|
|
f2a4891ada | ||
|
|
7f684ec840 | ||
|
|
88e90aaa44 | ||
|
|
986f240d91 | ||
|
|
4ab92cae70 | ||
|
|
1e09e1e966 | ||
|
|
0e49673c49 | ||
|
|
cf8fed9440 | ||
|
|
efb4a09cf8 | ||
|
|
d32b8be99d | ||
|
|
bf5132e50b | ||
|
|
93fd408267 | ||
|
|
4b1445e3b2 | ||
|
|
9dd94585b6 | ||
|
|
3d30dedc39 | ||
|
|
e570693b3e | ||
|
|
e0a8fe3f18 | ||
|
|
91b0032ee4 | ||
|
|
685934a644 | ||
|
|
0490359ac6 | ||
|
|
2d75cc5f4e | ||
|
|
943c223dad | ||
|
|
2618b963e7 | ||
|
|
956ac8a77c | ||
|
|
538039fc8d | ||
|
|
271a011f81 | ||
|
|
c9f13253fd | ||
|
|
8db6e73c90 | ||
|
|
d7ea5561dc | ||
|
|
563975a85d | ||
|
|
e425322c2b | ||
|
|
0921c911a3 |
+38
-1
@@ -6,8 +6,43 @@
|
||||
|
||||
## Improvements
|
||||
|
||||
# v1.26.2 / 2024-04-08
|
||||
|
||||
**This is a mandatory patch release for the Filecoin network version 22 mainnet upgrade, for all node operators.**
|
||||
|
||||
There is an update in the upgrade epoch for nv22, you can read the [full discussion in Slack here.](https://filecoinproject.slack.com/archives/C05P37R9KQD/p1712548103521969)
|
||||
|
||||
The new upgrade epoch is scheduled to be on **epoch `3855360 - 2024-04-24 - 14:00:00Z`**. That means:
|
||||
|
||||
- **All mainnet node operators that have upgraded to v1.26.x, must upgrade to this patch release before 2024-04-11T14:00:00Z.**
|
||||
- **All mainnet node operators that are on a version lower the v1.26.x, must upgrade to this patch release before 2024-04-24T14:00:00Z.**
|
||||
|
||||
This patch also includes fixes for node operators who want to index builtin-actor events after the nv22 upgrade. Specifically, it ensures the builtin actor event entries are ordered by insertion order when selected ([#11834](https://github.com/filecoin-project/lotus/pull/11834)). It also includes a couple Lotus-Miner patch fixes, ensuring that SnapDeals works properly and are using the new ProveReplicaUpdate3 message after the network version 22 upgrade, ensuring that DDO-sectors has the correct sector expirations, as well as DDO-sector visibility in the `lotus-miner sectors list` cmd.
|
||||
|
||||
## Upgrade Warnings
|
||||
|
||||
For users currently on a version of Lotus lower than v1.26.0, please note that **this release requires a minimum Go version of v1.21.7 or higher to successfully build Lotus.**
|
||||
|
||||
## v1.26.x Inclusions
|
||||
|
||||
See the [v1.26.0](#v1260--2024-03-21) release notes below for inclusions and notes on the v1.26.x series.
|
||||
|
||||
* [v13 Builtin Actor Bundle](#v13-builtin-actor-bundle)
|
||||
* [Migration](#migration)
|
||||
* [New features](#new-features-1)
|
||||
* [Tracing API](#tracing-api)
|
||||
* [Ethereum Tracing API (`trace_block` and `trace_replayBlockTransactions`)](#ethereum-tracing-api-trace_block-and-trace_replayblocktransactions)
|
||||
* [GetActorEventsRaw and SubscribeActorEventsRaw](#getactoreventsraw-and-subscribeactoreventsraw)
|
||||
* [Events Configuration Changes](#events-configuration-changes)
|
||||
* [GetAllClaims and GetAllAlocations](#getallclaims-and-getallalocations)
|
||||
* [Lotus CLI](#lotus-cli)
|
||||
|
||||
#v1260--2024-03-21
|
||||
|
||||
# v1.26.1 / 2024-03-27
|
||||
|
||||
***RETRACTED: Due to a change in network version 22 upgrade epoch, Lotus v1.26.1 should not be used prior to the new upgrade epoch. See v1.26.2 release notes above.***
|
||||
|
||||
**This is a patch release for the Calibration network user.** The Calibration network is scheduled for an upgrade to include the two additional built-in actor events to ease the transition and observability of DDO for the ecosystem ([#964](https://github.com/filecoin-project/FIPs/pull/964) and [#968](https://github.com/filecoin-project/FIPs/pull/968)).
|
||||
|
||||
The agreed-upon epoch between the Filecoin implementer team for the update is `1493854`, corresponding to `2024-04-03T11:00:00Z`. All Calibration network users need to upgrade to this patch release before that.
|
||||
@@ -16,6 +51,8 @@ The agreed-upon epoch between the Filecoin implementer team for the update is `1
|
||||
|
||||
# v1.26.0 / 2024-03-21
|
||||
|
||||
***RETRACTED: Due to a change in network version 22 upgrade epoch, Lotus v1.26.0 should not be used prior to the new upgrade epoch. See v1.26.2 release notes above.***
|
||||
|
||||
This is the stable release for the upcoming MANDATORY Filecoin network upgrade v22, codenamed Dragon 🐉, at `epoch 3817920 - 2024-04-11 - 14:00:00Z`
|
||||
|
||||
The Filecoin network version 22 delivers the following FIPs:
|
||||
@@ -76,7 +113,7 @@ For certain node operators, such as full archival nodes or systems that need to
|
||||
- feat: implement FIP-0063 ([filecoin-project/lotus#11572](https://github.com/filecoin-project/lotus/pull/11572))
|
||||
- feat: events: Add Lotus APIs to consume smart contract and built-in actor events ([filecoin-project/lotus#11618](https://github.com/filecoin-project/lotus/pull/11618))
|
||||
|
||||
## Tracing API
|
||||
### Tracing API
|
||||
|
||||
Replace the `CodeCid` field in the message trace (added in 1.23.4) with an `InvokedActor` field.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -99,8 +99,8 @@ const UpgradeThunderHeight = UpgradeLightningHeight + 2880*21
|
||||
// 2023-12-12T13:30:00Z
|
||||
const UpgradeWatermelonHeight = 3469380
|
||||
|
||||
// 2024-04-11T14:00:00Z
|
||||
var UpgradeDragonHeight = abi.ChainEpoch(3817920)
|
||||
// 2024-04-24T14:00:00Z
|
||||
var UpgradeDragonHeight = abi.ChainEpoch(3855360)
|
||||
|
||||
// This epoch, 120 epochs after the "rest" of the nv22 upgrade, is when we switch to Drand quicknet
|
||||
// 2024-04-11T15:00:00Z
|
||||
@@ -132,6 +132,7 @@ func init() {
|
||||
|
||||
if os.Getenv("LOTUS_DISABLE_DRAGON") == "1" {
|
||||
UpgradeDragonHeight = math.MaxInt64 - 1
|
||||
delete(DrandSchedule, UpgradePhoenixHeight)
|
||||
UpgradePhoenixHeight = math.MaxInt64
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ func BuildTypeString() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version
|
||||
const BuildVersion = "1.26.1"
|
||||
const BuildVersion = "1.26.3"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
|
||||
@@ -577,7 +577,8 @@ func (ei *EventIndex) prefillFilter(ctx context.Context, f *eventFilter, exclude
|
||||
s = s + " WHERE " + strings.Join(clauses, " AND ")
|
||||
}
|
||||
|
||||
s += " ORDER BY event.height DESC"
|
||||
// retain insertion order of event_entry rows with the implicit _rowid_ column
|
||||
s += " ORDER BY event.height DESC, event_entry._rowid_ ASC"
|
||||
|
||||
stmt, err := ei.db.Prepare(s)
|
||||
if err != nil {
|
||||
|
||||
@@ -229,13 +229,25 @@ type EthCall struct {
|
||||
}
|
||||
|
||||
func (c *EthCall) UnmarshalJSON(b []byte) error {
|
||||
type TempEthCall EthCall
|
||||
var params TempEthCall
|
||||
type EthCallRaw EthCall // Avoid a recursive call.
|
||||
type EthCallDecode struct {
|
||||
// The field should be "input" by spec, but many clients use "data" so we support
|
||||
// both, but prefer "input".
|
||||
Input *EthBytes `json:"input"`
|
||||
EthCallRaw
|
||||
}
|
||||
|
||||
var params EthCallDecode
|
||||
if err := json.Unmarshal(b, ¶ms); err != nil {
|
||||
return err
|
||||
}
|
||||
*c = EthCall(params)
|
||||
|
||||
// If input is specified, prefer it.
|
||||
if params.Input != nil {
|
||||
params.Data = *params.Input
|
||||
}
|
||||
|
||||
*c = EthCall(params.EthCallRaw)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -194,11 +194,40 @@ func TestMaskedIDInF4(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnmarshalEthCall(t *testing.T) {
|
||||
data := `{"from":"0x4D6D86b31a112a05A473c4aE84afaF873f632325","to":"0xFe01CC39f5Ae8553D6914DBb9dC27D219fa22D7f","gas":"0x5","gasPrice":"0x6","value":"0x123","data":""}`
|
||||
data := `{"from":"0x4D6D86b31a112a05A473c4aE84afaF873f632325","to":"0xFe01CC39f5Ae8553D6914DBb9dC27D219fa22D7f","gas":"0x5","gasPrice":"0x6","value":"0x123","data":"0xFF"}`
|
||||
|
||||
var c EthCall
|
||||
err := c.UnmarshalJSON([]byte(data))
|
||||
require.Nil(t, err)
|
||||
require.EqualValues(t, []byte{0xff}, c.Data)
|
||||
}
|
||||
|
||||
func TestUnmarshalEthCallInput(t *testing.T) {
|
||||
data := `{"from":"0x4D6D86b31a112a05A473c4aE84afaF873f632325","to":"0xFe01CC39f5Ae8553D6914DBb9dC27D219fa22D7f","gas":"0x5","gasPrice":"0x6","value":"0x123","input":"0xFF"}`
|
||||
|
||||
var c EthCall
|
||||
err := c.UnmarshalJSON([]byte(data))
|
||||
require.Nil(t, err)
|
||||
require.EqualValues(t, []byte{0xff}, c.Data)
|
||||
}
|
||||
|
||||
func TestUnmarshalEthCallInputAndData(t *testing.T) {
|
||||
data := `{"from":"0x4D6D86b31a112a05A473c4aE84afaF873f632325","to":"0xFe01CC39f5Ae8553D6914DBb9dC27D219fa22D7f","gas":"0x5","gasPrice":"0x6","value":"0x123","data":"0xFE","input":"0xFF"}`
|
||||
|
||||
var c EthCall
|
||||
err := c.UnmarshalJSON([]byte(data))
|
||||
require.Nil(t, err)
|
||||
require.EqualValues(t, []byte{0xff}, c.Data)
|
||||
}
|
||||
|
||||
func TestUnmarshalEthCallInputAndDataEmpty(t *testing.T) {
|
||||
// Even if the input is empty, it should be used when specified.
|
||||
data := `{"from":"0x4D6D86b31a112a05A473c4aE84afaF873f632325","to":"0xFe01CC39f5Ae8553D6914DBb9dC27D219fa22D7f","gas":"0x5","gasPrice":"0x6","value":"0x123","data":"0xFE","input":""}`
|
||||
|
||||
var c EthCall
|
||||
err := c.UnmarshalJSON([]byte(data))
|
||||
require.Nil(t, err)
|
||||
require.EqualValues(t, []byte{}, c.Data)
|
||||
}
|
||||
|
||||
func TestUnmarshalEthBytes(t *testing.T) {
|
||||
|
||||
@@ -487,6 +487,13 @@ var sectorsListCmd = &cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
var pams int
|
||||
for _, p := range st.Pieces {
|
||||
if p.DealInfo != nil && p.DealInfo.PieceActivationManifest != nil {
|
||||
pams++
|
||||
}
|
||||
}
|
||||
|
||||
exp := st.Expiration
|
||||
if st.OnTime > 0 && st.OnTime < exp {
|
||||
exp = st.OnTime // Can be different when the sector was CC upgraded
|
||||
@@ -501,6 +508,8 @@ var sectorsListCmd = &cli.Command{
|
||||
|
||||
if deals > 0 {
|
||||
m["Deals"] = color.GreenString("%d", deals)
|
||||
} else if pams > 0 {
|
||||
m["Deals"] = color.MagentaString("DDO:%d", pams)
|
||||
} else {
|
||||
m["Deals"] = color.BlueString("CC")
|
||||
if st.ToUpgrade {
|
||||
|
||||
@@ -2,7 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
@@ -24,6 +26,11 @@ var log = logging.Logger("main")
|
||||
var AdvanceBlockCmd *cli.Command
|
||||
|
||||
func main() {
|
||||
libp2p_addr := os.Getenv("LOTUS_LIBP2P_LISTENADDRESSES")
|
||||
fmt.Println("env", libp2p_addr)
|
||||
if len(libp2p_addr) > 0 && strings.Contains(libp2p_addr, ",") {
|
||||
fmt.Println("env var is csv")
|
||||
}
|
||||
api.RunningNodeType = api.NodeFull
|
||||
|
||||
lotuslog.SetupLogLevels()
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-miner [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.26.1
|
||||
1.26.2
|
||||
|
||||
COMMANDS:
|
||||
init Initialize a lotus miner repo
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-provider [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.26.1
|
||||
1.26.2
|
||||
|
||||
COMMANDS:
|
||||
run Start a lotus provider process
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-worker [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.26.1
|
||||
1.26.2
|
||||
|
||||
COMMANDS:
|
||||
run Start lotus worker
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.26.1
|
||||
1.26.2
|
||||
|
||||
COMMANDS:
|
||||
daemon Start a lotus daemon process
|
||||
|
||||
@@ -111,7 +111,7 @@ require (
|
||||
github.com/kelseyhightower/envconfig v1.4.0
|
||||
github.com/koalacxr/quantile v0.0.1
|
||||
github.com/libp2p/go-buffer-pool v0.1.0
|
||||
github.com/libp2p/go-libp2p v0.33.1
|
||||
github.com/libp2p/go-libp2p v0.33.2
|
||||
github.com/libp2p/go-libp2p-consensus v0.0.1
|
||||
github.com/libp2p/go-libp2p-gorpc v0.6.0
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.25.2
|
||||
@@ -126,7 +126,7 @@ require (
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/multiformats/go-base32 v0.1.0
|
||||
github.com/multiformats/go-multiaddr v0.12.2
|
||||
github.com/multiformats/go-multiaddr v0.12.3
|
||||
github.com/multiformats/go-multiaddr-dns v0.3.1
|
||||
github.com/multiformats/go-multibase v0.2.0
|
||||
github.com/multiformats/go-multicodec v0.9.0
|
||||
|
||||
@@ -1012,8 +1012,8 @@ github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xS
|
||||
github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw=
|
||||
github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qDKwXujH5o=
|
||||
github.com/libp2p/go-libp2p v0.14.3/go.mod h1:d12V4PdKbpL0T1/gsUNN8DfgMuRPDX8bS2QxCZlwRH0=
|
||||
github.com/libp2p/go-libp2p v0.33.1 h1:tvJl9b9M6nSLBtZSXSguq+/lRhRj2oLRkyhBmQNMFLA=
|
||||
github.com/libp2p/go-libp2p v0.33.1/go.mod h1:zOUTMjG4I7TXwMndNyOBn/CNtVBLlvBlnxfi+8xzx+E=
|
||||
github.com/libp2p/go-libp2p v0.33.2 h1:vCdwnFxoGOXMKmaGHlDSnL4bM3fQeW8pgIa9DECnb40=
|
||||
github.com/libp2p/go-libp2p v0.33.2/go.mod h1:zTeppLuCvUIkT118pFVzA8xzP/p2dJYOMApCkFh0Yww=
|
||||
github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94=
|
||||
github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8=
|
||||
github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8=
|
||||
@@ -1309,8 +1309,8 @@ github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u
|
||||
github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI=
|
||||
github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc=
|
||||
github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0=
|
||||
github.com/multiformats/go-multiaddr v0.12.2 h1:9G9sTY/wCYajKa9lyfWPmpZAwe6oV+Wb1zcmMS1HG24=
|
||||
github.com/multiformats/go-multiaddr v0.12.2/go.mod h1:GKyaTYjZRdcUhyOetrxTk9z0cW+jA/YrnqTOvKgi44M=
|
||||
github.com/multiformats/go-multiaddr v0.12.3 h1:hVBXvPRcKG0w80VinQ23P5t7czWgg65BmIvQKjDydU8=
|
||||
github.com/multiformats/go-multiaddr v0.12.3/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII=
|
||||
github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
|
||||
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
|
||||
github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0=
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipld/go-ipld-prime"
|
||||
"github.com/ipld/go-ipld-prime/codec/dagcbor"
|
||||
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
|
||||
"github.com/ipld/go-ipld-prime/node/basicnode"
|
||||
"github.com/multiformats/go-multicodec"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -24,6 +25,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
minertypes "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
@@ -131,15 +133,17 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
var pieces []abi.PieceInfo
|
||||
var dealID abi.DealID
|
||||
|
||||
// market ddo piece
|
||||
var marketSector api.SectorOffset
|
||||
var marketPiece abi.PieceInfo
|
||||
marketPieceSize := abi.PaddedPieceSize(2048 / 2).Unpadded()
|
||||
{
|
||||
// market piece
|
||||
pieceSize := abi.PaddedPieceSize(2048 / 2).Unpadded()
|
||||
pieceData := make([]byte, pieceSize)
|
||||
pieceData := make([]byte, marketPieceSize)
|
||||
_, _ = rand.Read(pieceData)
|
||||
|
||||
dc, err := miner.ComputeDataCid(ctx, pieceSize, bytes.NewReader(pieceData))
|
||||
marketPiece, err = miner.ComputeDataCid(ctx, marketPieceSize, bytes.NewReader(pieceData))
|
||||
require.NoError(t, err)
|
||||
pieces = append(pieces, dc)
|
||||
pieces = append(pieces, marketPiece)
|
||||
|
||||
head, err := client.ChainHead(ctx)
|
||||
require.NoError(t, err)
|
||||
@@ -148,7 +152,7 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
|
||||
psdParams := market2.PublishStorageDealsParams{
|
||||
Deals: []market2.ClientDealProposal{
|
||||
makeMarketDealProposal(t, client, miner, dc.PieceCID, pieceSize.Padded(), head.Height()+2880*2, head.Height()+2880*400),
|
||||
makeMarketDealProposal(t, client, miner, marketPiece.PieceCID, marketPieceSize.Padded(), head.Height()+2880*2, head.Height()+2880*400),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -177,7 +181,7 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
|
||||
mcid := smsg.Cid()
|
||||
|
||||
so, err := miner.SectorAddPieceToAny(ctx, pieceSize, bytes.NewReader(pieceData), piece.PieceDealInfo{
|
||||
marketSector, err = miner.SectorAddPieceToAny(ctx, marketPieceSize, bytes.NewReader(pieceData), piece.PieceDealInfo{
|
||||
PublishCid: &mcid,
|
||||
DealID: dealID,
|
||||
DealProposal: &psdParams.Deals[0].Proposal,
|
||||
@@ -190,25 +194,26 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, abi.PaddedPieceSize(0), so.Offset)
|
||||
require.Equal(t, abi.SectorNumber(2), so.Sector)
|
||||
require.Equal(t, abi.PaddedPieceSize(0), marketSector.Offset)
|
||||
require.Equal(t, abi.SectorNumber(2), marketSector.Sector)
|
||||
}
|
||||
|
||||
// raw ddo piece
|
||||
var rawSector api.SectorOffset
|
||||
var rawPiece abi.PieceInfo
|
||||
rawPieceSize := abi.PaddedPieceSize(2048 / 2).Unpadded()
|
||||
{
|
||||
// raw ddo piece
|
||||
|
||||
pieceSize := abi.PaddedPieceSize(2048 / 2).Unpadded()
|
||||
pieceData := make([]byte, pieceSize)
|
||||
pieceData := make([]byte, rawPieceSize)
|
||||
_, _ = rand.Read(pieceData)
|
||||
|
||||
dc, err := miner.ComputeDataCid(ctx, pieceSize, bytes.NewReader(pieceData))
|
||||
rawPiece, err = miner.ComputeDataCid(ctx, rawPieceSize, bytes.NewReader(pieceData))
|
||||
require.NoError(t, err)
|
||||
pieces = append(pieces, dc)
|
||||
pieces = append(pieces, rawPiece)
|
||||
|
||||
head, err := client.ChainHead(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
so, err := miner.SectorAddPieceToAny(ctx, pieceSize, bytes.NewReader(pieceData), piece.PieceDealInfo{
|
||||
rawSector, err = miner.SectorAddPieceToAny(ctx, rawPieceSize, bytes.NewReader(pieceData), piece.PieceDealInfo{
|
||||
PublishCid: nil,
|
||||
DealID: 0,
|
||||
DealProposal: nil,
|
||||
@@ -218,18 +223,20 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
},
|
||||
KeepUnsealed: false,
|
||||
PieceActivationManifest: &minertypes.PieceActivationManifest{
|
||||
CID: dc.PieceCID,
|
||||
Size: dc.Size,
|
||||
CID: rawPiece.PieceCID,
|
||||
Size: rawPiece.Size,
|
||||
VerifiedAllocationKey: nil,
|
||||
Notify: nil,
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, abi.PaddedPieceSize(1024), so.Offset)
|
||||
require.Equal(t, abi.SectorNumber(2), so.Sector)
|
||||
require.Equal(t, abi.PaddedPieceSize(1024), rawSector.Offset)
|
||||
require.Equal(t, abi.SectorNumber(2), rawSector.Sector)
|
||||
}
|
||||
|
||||
require.Equal(t, marketSector.Sector, rawSector.Sector) // sanity check same sector
|
||||
|
||||
toCheck := map[abi.SectorNumber]struct{}{
|
||||
2: {},
|
||||
}
|
||||
@@ -272,7 +279,7 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
fmt.Println("piece", piece.PieceCID, piece.Size)
|
||||
}
|
||||
|
||||
// check "deal-published" actor event
|
||||
// check some actor events
|
||||
var epochZero abi.ChainEpoch
|
||||
allEvents, err := miner.FullNode.GetActorEventsRaw(ctx, &types.ActorEventFilter{
|
||||
FromHeight: &epochZero,
|
||||
@@ -282,21 +289,32 @@ func TestOnboardMixedMarketDDO(t *testing.T) {
|
||||
var found bool
|
||||
keyBytes := must.One(ipld.Encode(basicnode.NewString(key), dagcbor.Encode))
|
||||
for _, event := range allEvents {
|
||||
for _, e := range event.Entries {
|
||||
if e.Key == "$type" && bytes.Equal(e.Value, keyBytes) {
|
||||
found = true
|
||||
switch key {
|
||||
case "deal-published", "deal-activated":
|
||||
expectedEntries := []types.EventEntry{
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: keyBytes},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "id", Value: must.One(ipld.Encode(basicnode.NewInt(2), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "client", Value: must.One(ipld.Encode(basicnode.NewInt(int64(clientId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, event.Entries)
|
||||
require.True(t, len(event.Entries) > 0)
|
||||
if event.Entries[0].Key == "$type" && bytes.Equal(event.Entries[0].Value, keyBytes) {
|
||||
found = true
|
||||
switch key {
|
||||
case "deal-published", "deal-activated":
|
||||
expectedEntries := []types.EventEntry{
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: keyBytes},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "id", Value: must.One(ipld.Encode(basicnode.NewInt(2), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "client", Value: must.One(ipld.Encode(basicnode.NewInt(int64(clientId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
}
|
||||
break
|
||||
require.Equal(t, expectedEntries, event.Entries)
|
||||
case "sector-activated":
|
||||
// only one sector, that has both our pieces in it
|
||||
expectedEntries := []types.EventEntry{
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: must.One(ipld.Encode(basicnode.NewString("sector-activated"), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "sector", Value: must.One(ipld.Encode(basicnode.NewInt(int64(rawSector.Sector)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "unsealed-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: expectCommD}), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: marketPiece.PieceCID}), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(marketPieceSize.Padded())), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: rawPiece.PieceCID}), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(rawPieceSize.Padded())), dagcbor.Encode))},
|
||||
}
|
||||
require.Equal(t, expectedEntries, event.Entries)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found, "expected to find event %s", key)
|
||||
|
||||
@@ -175,11 +175,11 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
// first sector to start mining is CC
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "sector", Value: must.One(ipld.Encode(basicnode.NewInt(int64(so.Sector)-1), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, precommitedEvents[0].Entries)
|
||||
require.Equal(t, expectedEntries, precommitedEvents[0].Entries)
|
||||
|
||||
// second sector has our piece
|
||||
expectedEntries[1].Value = must.One(ipld.Encode(basicnode.NewInt(int64(so.Sector)), dagcbor.Encode))
|
||||
require.ElementsMatch(t, expectedEntries, precommitedEvents[1].Entries)
|
||||
require.Equal(t, expectedEntries, precommitedEvents[1].Entries)
|
||||
}
|
||||
|
||||
{
|
||||
@@ -192,7 +192,7 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "sector", Value: must.One(ipld.Encode(basicnode.NewInt(int64(so.Sector)-1), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "unsealed-cid", Value: must.One(ipld.Encode(datamodel.Null, dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, activatedEvents[0].Entries)
|
||||
require.Equal(t, expectedEntries, activatedEvents[0].Entries)
|
||||
|
||||
// second sector has our piece, and only our piece, so usealed-cid matches piece-cid,
|
||||
// unfortunately we don't have a case with multiple pieces
|
||||
@@ -202,7 +202,7 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
types.EventEntry{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: dc.PieceCID}), dagcbor.Encode))},
|
||||
types.EventEntry{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(pieceSize.Padded())), dagcbor.Encode))},
|
||||
)
|
||||
require.ElementsMatch(t, expectedEntries, activatedEvents[1].Entries)
|
||||
require.Equal(t, expectedEntries, activatedEvents[1].Entries)
|
||||
}
|
||||
|
||||
{
|
||||
@@ -232,21 +232,21 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: must.One(ipld.Encode(basicnode.NewString("allocation"), dagcbor.Encode))},
|
||||
// first, bogus, allocation
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "id", Value: must.One(ipld.Encode(basicnode.NewInt(int64(allocationId)-1), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "client", Value: must.One(ipld.Encode(basicnode.NewInt(int64(clientId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: bogusPieceCid}), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(pieceSize.Padded())), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-min", Value: must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MinimumVerifiedAllocationTerm), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-max", Value: must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MaximumVerifiedAllocationTerm), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "expiration", Value: must.One(ipld.Encode(basicnode.NewInt(int64(bogusAllocationExpiry)), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, allocationEvents[0].Entries)
|
||||
require.Equal(t, expectedEntries, allocationEvents[0].Entries)
|
||||
|
||||
// the second, real allocation
|
||||
expectedEntries[1].Value = must.One(ipld.Encode(basicnode.NewInt(int64(allocationId)), dagcbor.Encode)) // "id"
|
||||
expectedEntries[4].Value = must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: dc.PieceCID}), dagcbor.Encode)) // "piece-cid"
|
||||
expectedEntries[8].Value = must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MaximumVerifiedAllocationExpiration), dagcbor.Encode)) // "expiration"
|
||||
require.ElementsMatch(t, expectedEntries, allocationEvents[1].Entries)
|
||||
require.Equal(t, expectedEntries, allocationEvents[1].Entries)
|
||||
}
|
||||
|
||||
{
|
||||
@@ -257,15 +257,15 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
expectedEntries := []types.EventEntry{
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: must.One(ipld.Encode(basicnode.NewString("allocation-removed"), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "id", Value: must.One(ipld.Encode(basicnode.NewInt(int64(allocationId)-1), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "client", Value: must.One(ipld.Encode(basicnode.NewInt(int64(clientId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: bogusPieceCid}), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(pieceSize.Padded())), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-min", Value: must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MinimumVerifiedAllocationTerm), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-max", Value: must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MaximumVerifiedAllocationTerm), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "expiration", Value: must.One(ipld.Encode(basicnode.NewInt(int64(bogusAllocationExpiry)), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, allocationEvents[0].Entries)
|
||||
require.Equal(t, expectedEntries, allocationEvents[0].Entries)
|
||||
}
|
||||
|
||||
{
|
||||
@@ -276,8 +276,8 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: must.One(ipld.Encode(basicnode.NewString("claim"), dagcbor.Encode))},
|
||||
// claimId inherits from its original allocationId
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "id", Value: must.One(ipld.Encode(basicnode.NewInt(int64(allocationId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "client", Value: must.One(ipld.Encode(basicnode.NewInt(int64(clientId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "provider", Value: must.One(ipld.Encode(basicnode.NewInt(int64(minerId)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "piece-cid", Value: must.One(ipld.Encode(basicnode.NewLink(cidlink.Link{Cid: dc.PieceCID}), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "piece-size", Value: must.One(ipld.Encode(basicnode.NewInt(int64(pieceSize.Padded())), dagcbor.Encode))},
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-min", Value: must.One(ipld.Encode(basicnode.NewInt(verifregtypes13.MinimumVerifiedAllocationTerm), dagcbor.Encode))},
|
||||
@@ -285,7 +285,7 @@ func TestOnboardRawPieceVerified_WithActorEvents(t *testing.T) {
|
||||
{Flags: 0x01, Codec: uint64(multicodec.Cbor), Key: "term-start", Value: must.One(ipld.Encode(basicnode.NewInt(int64(claimEvents[0].Height)), dagcbor.Encode))},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "sector", Value: must.One(ipld.Encode(basicnode.NewInt(int64(si.SectorID)), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, claimEvents[0].Entries)
|
||||
require.Equal(t, expectedEntries, claimEvents[0].Entries)
|
||||
}
|
||||
|
||||
// verify that we can trace a datacap allocation through to a claim with the events, since this
|
||||
|
||||
@@ -189,7 +189,7 @@ loop:
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "$type", Value: keyBytes},
|
||||
{Flags: 0x03, Codec: uint64(multicodec.Cbor), Key: "sector", Value: must.One(ipld.Encode(basicnode.NewInt(int64(toTerminate)), dagcbor.Encode))},
|
||||
}
|
||||
require.ElementsMatch(t, expectedEntries, event.Entries)
|
||||
require.Equal(t, expectedEntries, event.Entries)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ if [ ! -z $DOCKER_LOTUS_IMPORT_SNAPSHOT ]; then
|
||||
# Don't init if already initialized.
|
||||
if [ ! -f "$GATE" ]; then
|
||||
echo importing minimal snapshot
|
||||
/usr/local/bin/lotus daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import
|
||||
echo "yes" | /usr/local/bin/lotus daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import
|
||||
# Block future inits
|
||||
date > "$GATE"
|
||||
fi
|
||||
|
||||
@@ -147,7 +147,7 @@ func (ds *PieceDealInfo) EndEpoch() (abi.ChainEpoch, error) {
|
||||
default:
|
||||
// note - when implementing make sure to cache any dynamically computed values
|
||||
// todo do we want a smarter mechanism here
|
||||
return ds.DealSchedule.StartEpoch, nil
|
||||
return ds.DealSchedule.EndEpoch, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
@@ -242,3 +243,37 @@ func TestMissingDealIsIgnored(t *testing.T) {
|
||||
|
||||
assert.Equal(t, 547300, int(exp))
|
||||
}
|
||||
|
||||
func TestBasicPolicyDDO(t *testing.T) {
|
||||
cfg := fakeConfigGetter(nil)
|
||||
pcp := pipeline.NewBasicPreCommitPolicy(&fakeChain{
|
||||
h: abi.ChainEpoch(55),
|
||||
}, cfg, 0)
|
||||
|
||||
pieces := []pipeline.SafeSectorPiece{
|
||||
pipeline.SafePiece(api.SectorPiece{
|
||||
Piece: abi.PieceInfo{
|
||||
Size: abi.PaddedPieceSize(1024),
|
||||
PieceCID: fakePieceCid(t),
|
||||
},
|
||||
DealInfo: &piece.PieceDealInfo{
|
||||
PublishCid: nil,
|
||||
DealID: abi.DealID(44),
|
||||
DealSchedule: piece.DealSchedule{
|
||||
StartEpoch: abi.ChainEpoch(100_000),
|
||||
EndEpoch: abi.ChainEpoch(1500_000),
|
||||
},
|
||||
PieceActivationManifest: &miner.PieceActivationManifest{
|
||||
Size: 0,
|
||||
VerifiedAllocationKey: nil,
|
||||
Notify: nil,
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
||||
exp, err := pcp.Expiration(context.Background(), pieces...)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, abi.ChainEpoch(1500_000), exp)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@@ -170,7 +171,12 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
||||
|
||||
// figure out message type
|
||||
|
||||
pams, deals, err := m.processPieces(ctx.Context(), sector)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("failed to get network version: %+v", err)
|
||||
}
|
||||
|
||||
pams, deals, err := m.processPieces(ctx.Context(), sector, nv >= network.Version22)
|
||||
if err != nil {
|
||||
log.Errorf("failed to process pieces: %+v", err)
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
|
||||
@@ -748,30 +748,33 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
// processPieces returns either:
|
||||
// - a list of piece activation manifests
|
||||
// - a list of deal IDs, if all non-filler pieces are deal-id pieces
|
||||
func (m *Sealing) processPieces(ctx context.Context, sector SectorInfo) ([]miner.PieceActivationManifest, []abi.DealID, error) {
|
||||
func (m *Sealing) processPieces(ctx context.Context, sector SectorInfo, forceDDO bool) ([]miner.PieceActivationManifest, []abi.DealID, error) {
|
||||
pams := make([]miner.PieceActivationManifest, 0, len(sector.Pieces))
|
||||
dealIDs := make([]abi.DealID, 0, len(sector.Pieces))
|
||||
var hasDDO bool
|
||||
hasDDO := forceDDO
|
||||
|
||||
for _, piece := range sector.Pieces {
|
||||
piece := piece
|
||||
if !forceDDO {
|
||||
// if not forcing DDO, check if we have any DDO pieces
|
||||
for _, piece := range sector.Pieces {
|
||||
piece := piece
|
||||
|
||||
// first figure out if this is a ddo sector
|
||||
err := piece.handleDealInfo(handleDealInfoParams{
|
||||
FillerHandler: func(info UniversalPieceInfo) error {
|
||||
// Fillers are implicit (todo review: Are they??)
|
||||
return nil
|
||||
},
|
||||
BuiltinMarketHandler: func(info UniversalPieceInfo) error {
|
||||
return nil
|
||||
},
|
||||
DDOHandler: func(info UniversalPieceInfo) error {
|
||||
hasDDO = true
|
||||
return nil
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("handleDealInfo: %w", err)
|
||||
// first figure out if this is a ddo sector
|
||||
err := piece.handleDealInfo(handleDealInfoParams{
|
||||
FillerHandler: func(info UniversalPieceInfo) error {
|
||||
// Fillers are implicit (todo review: Are they??)
|
||||
return nil
|
||||
},
|
||||
BuiltinMarketHandler: func(info UniversalPieceInfo) error {
|
||||
return nil
|
||||
},
|
||||
DDOHandler: func(info UniversalPieceInfo) error {
|
||||
hasDDO = true
|
||||
return nil
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("handleDealInfo: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, piece := range sector.Pieces {
|
||||
@@ -847,7 +850,7 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")})
|
||||
}
|
||||
|
||||
pams, dealIDs, err := m.processPieces(ctx.Context(), sector)
|
||||
pams, dealIDs, err := m.processPieces(ctx.Context(), sector, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user